Package de.sciss.common

Examples of de.sciss.common.ProcessingThread$Event


      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


        return;
      }
     
      if( !checkProcess() ) return;
System.out.println( "F" );
      final ProcessingThread proc = initiate( tl, timeline.getPosition(), name, 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( !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( name );
      oldSelSpan    = timeline.getSelectionSpan();
      if( !oldSelSpan.isEmpty() ) { // deselect
        edit.addPerform( TimelineVisualEdit.select( this, Session.this, new Span() ));
      }

      proc  = new ProcessingThread( this, getFrame(), name );
      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 Flag        confirmed  = new Flag( false );
      final DocumentFrame    frame    = (DocumentFrame) getApplication().getComponent( Main.COMP_MAIN );
      final ProcessingThread  pt      = frame.confirmUnsaved( text, confirmed );
      if( pt == null ) {
        if( !confirmed.isSet() ) return;
        queryAndPerform();
      } else {
        pt.addListener( new ProcessingThread.Listener() {
          public void processStarted( ProcessingThread.Event e ) {}
          public void processStopped( ProcessingThread.Event e ) {
            if( e.getProcessingThread().getReturnCode() == ProgressComponent.DONE ) {
              queryAndPerform();
            }
          }
        });
        pt.start();
      }
    }
View Full Code Here

      }
    }
   
    private void perform( File f )
    {
      final ProcessingThread pt = doc.initiateLoad( f );
      pt.addListener( this );
      pt.start();
    }
View Full Code Here

      return( new File( strDir, strFile ));
    }
   
    public void processStopped( ProcessingThread.Event e )
    {
      final ProcessingThread pt = e.getProcessingThread();
      if( pt.getReturnCode() == ProgressComponent.DONE ) {
        final Map options = (Map) pt.getClientArg( "options" );
        addRecent( (File) options.get( "file" ));
// EEE
//        if( AbstractApplication.getApplication().getUserPrefs().getBoolean(
//          PrefsUtil.KEY_RECALLFRAMES, false )) {
//          BasicFrame.restoreAllFromPrefs();
View Full Code Here

        BasicWindowHandler.showErrorDialog( null, e1, getValue( NAME ).toString() );
      }

      final Main root = (Main) AbstractApplication.getApplication();
//      new ProcessingThread( this, root, root, doc, text, coll, Session.DOOR_TIMETRNSMTE | Session.DOOR_GRP );
      final ProcessingThread pt;
      pt = new ProcessingThread( this, root, text );
      pt.putClientArg( "trns", collNewTrns );
      pt.putClientArg( "span", span );
      pt.putClientArg( "edit", edit );
      pt.start();
    }
View Full Code Here

  public synchronized void quit()
  {
    final Flag        confirmed  = new Flag( false );
//    final ProcessingThread  pt      = getMenuFactory().closeAll( forcedQuit, confirmed );
    final ProcessingThread  pt      = doc.closeDocument( getResourceString( "menuQuit" ), forcedQuit, confirmed );

    if( pt != null ) {
      pt.addListener( quitAfterSaveListener );
      ((Session) pt.getClientArg( "doc" )).start( pt );
    } else if( confirmed.isSet() ) {
//      OSCRoot.getInstance().quit();
//      SuperColliderClient.getInstance().quit();
      super.quit();
    }
View Full Code Here

      ggOutputDir.getPath()
    };
       
    final Main root = (Main) AbstractApplication.getApplication();
//    new ProcessingThread( this, root, root, doc, getTitle(), fileArgs, 0 );
    final ProcessingThread pt;
    pt = new ProcessingThread( this, root, getTitle() );
    pt.putClientArg( "files", fileArgs );
    pt.start();
  }
View Full Code Here

    if( context == null || plugIn == null || renderingRunning ) return;
 
    context.setOption( RenderContext.KEY_PLUGIN, plugIn );
    renderingRunning = true;
//    pt  = new ProcessingThread( this, pc, root, doc, getTitle(), context, Session.DOOR_ALL );
    pt  = new ProcessingThread( this, pc, getTitle() );
    pt.putClientArg( "context", context );

    ggClose.setEnabled( false );
    ggRender.setAction( actionCancel );
    ggRender.requestFocus();
View Full Code Here

TOP

Related Classes of de.sciss.common.ProcessingThread$Event

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.