Package de.sciss.common

Examples of de.sciss.common.ProcessingThread


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

      final ProcessingThread proc = new ProcessingThread( this, getFrame(), name );
      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


//                                   AbstractApplication.getApplication().getResourceString( "toolWriteTransmitter" ),
//                                   null, Session.DOOR_TIMETRNSMTE );
          final String name = AbstractApplication.getApplication().
            getResourceString( "toolWriteTransmitter" );

          renderThread = new ProcessingThread( this, root, name );
          renderThread.putClientArg( "span", span );
          renderThread.putClientArg( "trns", collTrns );
          renderThread.putClientArg( "blend", root.getBlending() );
          renderThread.putClientArg( "edit",
              new CompoundSessionObjEdit( this, collTrns,
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

    final AbstractCompoundEdit edit;
    edit = new CompoundSessionObjEdit( this, collTrns, Transmitter.OWNER_TRAJ,
                                       null, null, "Geometric Tool" );

    renderThread = new ProcessingThread( this, root,
        AbstractApplication.getApplication().getResourceString( "toolWriteTransmitter" ));
    renderThread.putClientArg( "points", ctrlPoints );
    renderThread.putClientArg( "span", span );
    renderThread.putClientArg( "trns", collTrns );
    renderThread.putClientArg( "edit", edit );
View Full Code Here

      getTransport().stop();
      ((MainFrame) root.getComponent( Main.COMP_MAIN )).clearLog();
//      Map options = new HashMap();
//      options.put( "file", path );
//      return( new ProcessingThread( this, root, root, doc, text, options, Session.DOOR_ALL ));
      final ProcessingThread pt;
      final Map options = new HashMap();
      pt = new ProcessingThread( this, root, getResourceString( "menuOpen" ));
      options.put( "file", path );
      options.put( XMLRepresentation.KEY_BASEPATH, path.getParentFile() );
      pt.putClientArg( "options", options );
//      pt.start();
     
      final org.w3c.dom.Document    domDoc;
      final DocumentBuilderFactory  builderFactory;
      final DocumentBuilder      builder;

      builderFactory  = DocumentBuilderFactory.newInstance();
      builderFactory.setValidating( true );
      getUndoManager().discardAllEdits();

      try {
        builder  =   builderFactory.newDocumentBuilder();
        builder.setEntityResolver( Session.this );
        domDoc  =   builder.parse( path );
//        context.setProgression( -1f );
        fromXML( domDoc, domDoc.getDocumentElement(), options );
//        doc.getMap().putValue( this, Session.MAP_KEY_PATH, f );
//        doc.setName( f.getName() );
//        setFile( path );

//        context.setProgression( 1.0f );
//        success = true;
      }
      catch( ParserConfigurationException e1 ) {
        pt.putClientArg( "exception", e1 );
      }
      catch( SAXParseException e1 ) {
        pt.putClientArg( "exception", e1 );
      }
      catch( SAXException e1 ) {
        pt.putClientArg( "exception", e1 );
      }
      catch( IOException e1 ) {
        pt.putClientArg( "exception", e1 );
      }
   
      return pt;
    }
View Full Code Here

      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

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.