Package de.sciss.common

Examples of de.sciss.common.ProcessingThread


      perform();
    }
   
    protected void perform()
    {
      final ProcessingThread proc; // = null;
     
      if( actionCopy.perform() ) {
//        if( !bird.attemptShared( Session.DOOR_TIME | Session.DOOR_MTE )) return;
//        try {
          proc = procDelete( getValue( NAME ).toString(), timeline.getSelectionSpan(), getEditMode() );
View Full Code Here


      if( result == JOptionPane.OK_OPTION ) {
        value      = ggDuration.getValue();
        space      = ggDuration.getSpace();
        durationSmps  = timeTrans.translate( value, ParamSpace.spcTimeSmps );
        if( durationSmps.val > 0.0 ) {
          final ProcessingThread proc;
         
          proc = initiate( timeline.getPosition(), (long) durationSmps.val );
          if( proc != null ) start( proc );
        }
      }
View Full Code Here

      if( !checkProcess() || (numFrames == 0) ) return null;
     
      if( numFrames < 0 ) throw new IllegalArgumentException( String.valueOf( numFrames ));
      if( (pos < 0) || (pos > timeline.getLength()) ) throw new IllegalArgumentException( String.valueOf( pos ));

      final ProcessingThread     proc;
      final AbstractCompoundEdit  edit;
      final Span          oldSelSpan, insertSpan;

      proc = new ProcessingThread( this, getFrame(), getValue( NAME ).toString() );

      edit    = new BasicCompoundEdit( proc.getName() );
      oldSelSpan  = timeline.getSelectionSpan();
      insertSpan  = new Span( pos, pos + numFrames );

      if( !oldSelSpan.isEmpty() ) { // deselect
        edit.addPerform( TimelineVisualEdit.select( this, Session.this, new Span() ));
      }

      proc.putClientArg( "tis", Track.getInfos( selectedTracks.getAll(), tracks.getAll() ));
      proc.putClientArg( "edit", edit );
      proc.putClientArg( "span", insertSpan );
      return proc;
    }
View Full Code Here

 
  public ProcessingThread closeAll( boolean force, Flag confirmed )
  {
    final de.sciss.app.DocumentHandler  dh  = AbstractApplication.getApplication().getDocumentHandler();
    Session                doc;
    ProcessingThread          pt;

    while( dh.getDocumentCount() > 0 ) {
      doc  = (Session) dh.getDocument( 0 );
if( doc.getFrame() == null ) {
  System.err.println( "Yukk, no doc frame for "+doc.getDisplayDescr().file );
View Full Code Here

        System.err.println( getResourceString( "errClipboard" ));
        return;
      }
     
      if( !checkProcess() ) return;
      final ProcessingThread proc = initiate( tl, timeline.getPosition(), procName, mode )// XXX sync
      if( proc != null ) {
        start( proc );
      }
    }
View Full Code Here

    {
      if( !checkProcess() ) return null;
     
      if( (insertPos < 0) || (insertPos > timeline.getLength()) ) throw new IllegalArgumentException( String.valueOf( insertPos ));
     
      final ProcessingThread    proc;
      final Span          oldSelSpan, insertSpan, copySpan, cutTimelineSpan;
      final AbstractCompoundEdit  edit;
      final Flag          hasSelectedAudio;
      final List          tis;
      final boolean        expTimeline, cutTimeline;
      final long          docLength, pasteLength, preMaxLen, postMaxLen;
      final BlendContext      bcPre, bcPost;
     
      hasSelectedAudio  = new Flag( false );
      tis          = Track.getInfos( selectedTracks.getAll(), tracks.getAll() );
      if( !AudioTracks.checkSyncedAudio( tis, mode == EDIT_INSERT, null, hasSelectedAudio )) return null;

      expTimeline      = (mode == EDIT_INSERT) && hasSelectedAudio.isSet();
      docLength      = timeline.getLength();
      pasteLength      = expTimeline ? tl.getSpan().getLength() :
        Math.min( tl.getSpan().getLength(), docLength - insertPos );
      if( pasteLength == 0 ) return null;
     
      if( mode == EDIT_INSERT ) {
        /*
         *  before paste:
         *
         *   maxRight / post   maxLeft / pre
         *
         *  |                 |              |
         *  |                 |              |
         *  |                 |              |
         *  |        A        |     B        |
         *  +-----------------+--------------+
         *                    |
         *                 insertPos
         *
         *  after paste:
         *
         *  |                 | B #$$$$# A |              |
         *  |                 |  ##$$$$##  |              |
         *  |                 | ###$$$$### |              |
         *  |        A        |####$$$$####|      B       |
         *  +-----------------+------------+--------------+
         *                    |
         *                 insertPos
         */
        // note: now the discrepancy between postMaxLen and preMaxLen is
        // limited to 100%, so pasting at the very end or beginning of
        // a doc will not produce a single sided xfade any more
        // (answering bug 1922862)
        if( insertPos < (docLength - insertPos) ) {
          postMaxLen  = Math.min( insertPos, pasteLength >> 1 );
//          preMaxLen  = Math.min( docLength - insertPos, pasteLength - postMaxLen );
          preMaxLen  = Math.min( postMaxLen << 1, Math.min( docLength - insertPos, pasteLength - postMaxLen ));
//System.out.println( "A" );
        } else {
          preMaxLen  = Math.min( docLength - insertPos, pasteLength >> 1 );
          postMaxLen  = Math.min( preMaxLen << 1, Math.min( insertPos, pasteLength - preMaxLen ));
//System.out.println( "B" );
        }
      } else {
        preMaxLen  = pasteLength >> 1// note: pasteLength already clipped to be <= docLength - insertPos !
        postMaxLen  = pasteLength - preMaxLen;
//System.out.println( "C" );
      }
      bcPre      = createBlendContext( preMaxLen, 0, hasSelectedAudio.isSet() );
      bcPost      = createBlendContext( postMaxLen, 0, hasSelectedAudio.isSet() );
//System.out.println( "D ; preMaxLen = " + preMaxLen + "; postMaxLen = " + postMaxLen + "; bcPre.getLeftLen() = " + (bcPre == null ? null : String.valueOf( bcPre.getLeftLen())) + "; bcPre.getRightLen() = " + (bcPre == null ? null : String.valueOf( bcPre.getRightLen() )) + "; bcPost.getLeftLen() = " + (bcPost == null ? null : String.valueOf( bcPost.getLeftLen() )) + "; bcPost.getRightLen() = " + (bcPost == null ? null : String.valueOf( bcPost.getRightLen() )));

//      if( bcPre != null )  System.out.println( "bcPre  : " + bcPre.getLen() + ", " + bcPre.getLeftLen() + ", "+ bcPre.getRightLen() );
//      if( bcPost != null ) System.out.println( "bcPost : " + bcPost.getLen() + ", " + bcPost.getLeftLen() + ", "+ bcPost.getRightLen() );
     
      insertSpan      = new Span( insertPos, insertPos + pasteLength );
      copySpan      = new Span( tl.getSpan().start, tl.getSpan().start + pasteLength );
      cutTimeline      = (mode == EDIT_INSERT) && !hasSelectedAudio.isSet();
      cutTimelineSpan    = cutTimeline ? new Span( docLength, docLength + pasteLength ) : null;
     
      edit      = new BasicCompoundEdit( procName );
      oldSelSpan    = timeline.getSelectionSpan();
      if( !oldSelSpan.isEmpty() ) { // deselect
        edit.addPerform( TimelineVisualEdit.select( this, Session.this, new Span() ));
      }

      proc  = new ProcessingThread( this, getFrame(), procName );
      proc.putClientArg( "tl", tl );
      proc.putClientArg( "pos", new Long( insertPos ));
      proc.putClientArg( "mode", new Integer( mode ));
      proc.putClientArg( "tis", tis );
      proc.putClientArg( "pasteLen", new Long( pasteLength ));
      proc.putClientArg( "exp", new Boolean( expTimeline ));
      proc.putClientArg( "bcPre", bcPre );
      proc.putClientArg( "bcPost", bcPost );
      proc.putClientArg( "insertSpan", insertSpan );
      proc.putClientArg( "copySpan", copySpan );
      proc.putClientArg( "cut", new Boolean( cutTimeline ));
      proc.putClientArg( "cutSpan", cutTimelineSpan );
      proc.putClientArg( "edit", edit );

      return proc;
    }
View Full Code Here

    protected void perform()
    {   
      final Span        span  = timeline.getSelectionSpan(); // XXX sync
      if( span.isEmpty() ) return;
     
      final ProcessingThread  proc    = initiate( getValue( NAME ).toString(), span, getEditMode() );
      if( proc != null ) start( proc );
    }
View Full Code Here

          } // else visiSpan untouched
        }
        edit.addPerform( new EditSetTimelineLength( this, Session.this, newDocLength ));
      }

      final ProcessingThread proc = new ProcessingThread( this, getFrame(), procName );
      proc.putClientArg( "span", span );
      proc.putClientArg( "mode", new Integer( mode ));
      proc.putClientArg( "tis", tis );
      proc.putClientArg( "edit", edit );
      proc.putClientArg( "bc", bc );
      proc.putClientArg( "cut", new Boolean( cutTimeline ));
      proc.putClientArg( "cutSpan", cutTimelineSpan );
      return proc;
    }
View Full Code Here

    {
      final RecorderDialog    recDlg;
      final File          recFile;
      final Session        tmpDoc;
      final ClipboardTrackList  tl;
      final ProcessingThread    pt;
      final Session        targetDoc;
      final AudioFileDescr    afd, afd2;
   
      try {
        recDlg  = new RecorderDialog( doc );
      }
      catch( IOException e1 ) {
        BasicWindowHandler.showErrorDialog( getWindow(), e1, getValue( NAME ).toString() );
        return;
      }
      recFile  = recDlg.getResult();
     
      if( recFile != null ) {
        try {
//          if( true ) throw new IOException( "test" );
          tmpDoc  = Session.newFrom( recFile, false, false );
        }
        catch( IOException e1 ) {
          GUIUtil.displayError( getWindow(), e1, getValue( NAME ).toString() );
          confirmDelete( recFile );
          return;
        }
        tl    = new ClipboardTrackList( tmpDoc, new Span( 0, tmpDoc.timeline.getLength() ), tmpDoc.tracks.getAll() );
        if( doc.checkProcess()) {
          targetDoc      = doc;
        } else // doc busy, save the recording by creating a separate document
          afd          = doc.getDisplayDescr();
          afd2        = new AudioFileDescr();
          afd2.bitsPerSample  = afd.bitsPerSample;
          afd2.channels    = afd.channels;
          afd2.rate      = afd.rate;
          afd2.sampleFormat  = afd.sampleFormat;
          targetDoc      = ((MenuFactory) app.getMenuFactory()).newDocument( afd2 );
        }
//pt = null;
        pt = targetDoc == null ? null : targetDoc.pasteTrackList( tl, targetDoc.timeline.getPosition(), getValue( NAME ).toString(), targetDoc.getEditMode() );

        if( pt != null ) {
          pt.addListener( new ProcessingThread.Listener() {
            public void processStarted( ProcessingThread.Event e1 ) { /* ignored */ }
            public void processStopped( ProcessingThread.Event e2 )
            {
              tl.dispose();
              tmpDoc.dispose();
View Full Code Here

    protected void perform()
    {   
      final Span        span  = timeline.getSelectionSpan(); // XXX sync
      if( span.isEmpty() ) return;
     
      final ProcessingThread  proc    = initiate( getValue( NAME ).toString(), span, getEditMode() );
      if( proc != null ) start( proc );
    }
View Full Code Here

TOP

Related Classes of de.sciss.common.ProcessingThread

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.