Package de.sciss.app

Examples of de.sciss.app.AbstractCompoundEdit


    final Span          union    = fullScale.getSpan();
    final Span          extSpan;
    final long          fullrateStop, fullrateLen; // , insertLen;
    final int          numFullBuf;
    // final CacheManager cm = CacheManager.getInstance();
    final AbstractCompoundEdit  ce      = null; // XXX
    final Object        source    = null; // XXX
    final AudioStake      cacheReadAS;
    final AudioStake      cacheWriteAS;

    synchronized( fileSync ) {
View Full Code Here


    final Span          union    = fullScale.getSpan();
    final Span          extSpan;
    final long          fullrateStop, fullrateLen; // , insertLen;
    final int          numFullBuf;
    // final CacheManager cm = CacheManager.getInstance();
    final AbstractCompoundEdit  ce      = null; // XXX
    final Object        source    = null; // XXX
//    final AudioStake      cacheReadAS;
//    final AudioStake      cacheWriteAS;

    synchronized( fileSync ) {
View Full Code Here

     
      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 );
View Full Code Here

     */
    public int processRun( ProcessingThread context )
    throws IOException
    {
      final List          tis      = (List) context.getClientArg( "tis" );
      final AbstractCompoundEdit  edit    = (AbstractCompoundEdit) context.getClientArg( "edit" );
      final Span          insertSpan  = (Span) context.getClientArg( "span" );
      Track.Info          ti;
      AudioTrail          audioTrail;

      for( int i = 0; i < tis.size(); i++ ) {
View Full Code Here

      return DONE;
    }

    public void processFinished( ProcessingThread context )
    {
      final AbstractCompoundEdit  edit    = (AbstractCompoundEdit) context.getClientArg( "edit" );
      final Span          insertSpan  = (Span) context.getClientArg( "span" );

      if( context.getReturnCode() == DONE ) {
        if( !insertSpan.isEmpty() ) {  // adjust timeline
          edit.addPerform( new EditSetTimelineLength( this, Session.this, timeline.getLength() + insertSpan.getLength() ));
          if( timeline.getVisibleSpan().isEmpty() ) {
            edit.addPerform( TimelineVisualEdit.scroll( this, Session.this, insertSpan ));
          }
        }
        if( !insertSpan.isEmpty() ) {
          edit.addPerform( TimelineVisualEdit.select( this, Session.this, insertSpan ));
          edit.addPerform( TimelineVisualEdit.position( this, Session.this, insertSpan.stop ));
        }
        edit.perform();
        edit.end();
        getUndoManager().addEdit( edit );
      } else {
        edit.cancel();
      }
    }
View Full Code Here

     
      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 ));
View Full Code Here

    {
      final ClipboardTrackList    tl          = (ClipboardTrackList) context.getClientArg( "tl" );
      final long            insertPos      = ((Long) context.getClientArg( "pos" )).longValue();
      final int            mode        = ((Integer) context.getClientArg( "mode" )).intValue();
      final List            tis          = (List) context.getClientArg( "tis" );
      final AbstractCompoundEdit    edit        = (AbstractCompoundEdit) context.getClientArg( "edit" );
      final BlendContext        bcPre        = (BlendContext) context.getClientArg( "bcPre" );
      final BlendContext        bcPost        = (BlendContext) context.getClientArg( "bcPost" );
      final Span            insertSpan      = (Span) context.getClientArg( "insertSpan" );
      final Span            copySpan      = (Span) context.getClientArg( "copySpan" );
      final boolean          cutTimeline      = ((Boolean) context.getClientArg( "cut" )).booleanValue();
View Full Code Here

    }

    public void processFinished( ProcessingThread context )
    {
      final ProcessingThread.Client  doneAction  = (ProcessingThread.Client) context.getClientArg( "doneAction" );
      final AbstractCompoundEdit    edit    = (AbstractCompoundEdit) context.getClientArg( "edit" );
      final boolean          expTimeline  = ((Boolean) context.getClientArg( "exp" )).booleanValue();
      final long            pasteLength  = ((Long) context.getClientArg( "pasteLen" )).longValue();
      final Span            insertSpan  = (Span) context.getClientArg( "insertSpan" );
     
      if( (context.getReturnCode() == DONE) ) {
        if( expTimeline && (pasteLength != 0) ) {  // adjust timeline
          edit.addPerform( new EditSetTimelineLength( this, Session.this, timeline.getLength() + pasteLength ));
          if( timeline.getVisibleSpan().isEmpty() ) {
            edit.addPerform( TimelineVisualEdit.scroll( this, Session.this, insertSpan ));
          }
        }
        if( !insertSpan.isEmpty() ) {
          edit.addPerform( TimelineVisualEdit.select( this, Session.this, insertSpan ));
          edit.addPerform( TimelineVisualEdit.position( this, Session.this, insertSpan.stop ));
        }

        edit.perform();
        edit.end();
        getUndoManager().addEdit( edit );
      } else {
        edit.cancel();
      }

//      if( doneAction != null ) doneAction.processFinished( context, doc );
      if( doneAction != null ) doneAction.processFinished( context );
    }
View Full Code Here

      final BlendContext      bc;
      final long          cutLength, docLength, newDocLength, maxLen;
      final Flag          hasSelectedAudio;
      final List          tis;
      final AbstractCompoundEdit  edit;
      final boolean         cutTimeline;
      final Span          cutTimelineSpan, selSpan;
      Span            visiSpan;

      hasSelectedAudio  = new Flag( false );
      tis          = Track.getInfos( selectedTracks.getAll(), tracks.getAll() );
      if( !AudioTracks.checkSyncedAudio( tis, mode == EDIT_INSERT, null, hasSelectedAudio )) return null;
     
      docLength      = timeline.getLength();
      cutLength      = span.getLength();
      if( mode == EDIT_INSERT ) {
        /*
         *  before delete:
         *
         *  |,,,,,,,,,,,,,,,,,|$$$$$$$#######|............|
         *  |,,,,,,,,,,,,,,,,,|$$$$$$$#######|............|
         *  |,,,,,,,,,,,,,,,,,|$$$$$$$#######|............|
         *  |,,,,,,,,A,,,,,,,,|$$B1$$$###B2##|......C.....|
         *  +-----------------+--------------+------------+
         *                    |     span     |
         *
         *  after delete:
         *                left right
         *  |,,,,,,,,,,,,,    |            |
         *  |,,,,,,,,,,,,,,,  |            |
         *  |,,,,,,,,,,,,,,,,,|            |
         *  |,,,,,,,,,,,,,,,,,|$$          |
         *  |,,,,,,,,,,,,,,,,,|$$$$        |
         *  |,,,,,,,,A,,,,,,,,|$B2$$$      |
         *  +-----------------+------------+
         *                    |
         *      plus
         *  |                 |    ........|
         *  |                 |  ..........|
         *  |                 |............|
         *  |               ##|............|
         *  |             ####|............|
         *  |           ###B2#|......C.....|
         *  +-----------------+------------+
         *                    |
         *                span.start
         */
        maxLen        = Math.min( cutLength, Math.min( span.start, docLength - span.stop ) << 1 );
        bc          = createBlendContext( maxLen >> 1, (maxLen + 1) >> 1, hasSelectedAudio.isSet() );
      } else {
        /*
         *  after delete:
         *                     blend-   blend-
         *                     Len      Len
         *  |,,,,,,,,,,,,,,,,,|$            #|............|
         *  |,,,,,,,,,,,,,,,,,|$$          ##|............|
         *  |,,,,,,,,,,,,,,,,,|$$$        ###|............|
         *  |,,,,,,,,A,,,,,,,,|$B1$      #B2#|......C.....|
         *  +-----------------+--------------+------------+
         *                    |     span     |
         */
        maxLen        = cutLength >> 1;
        bc          = createBlendContext( maxLen, 0, hasSelectedAudio.isSet() );
      }
//      bc          = createBlendContext( Math.min( cutLength, span.start ), Math.min( cutLength, docLength - span.stop ), hasSelectedAudio );
      edit        = new BasicCompoundEdit( procName );

//      if( bc != null )  System.out.println( "bc  : " + bc.getLen() + ", " + bc.getLeftLen() + ", "+ bc.getRightLen() );
     
      cutTimeline      = (mode == EDIT_INSERT) && hasSelectedAudio.isSet();
      newDocLength    = cutTimeline ? docLength - cutLength : docLength;
      cutTimelineSpan    = cutTimeline ? new Span( newDocLength, docLength ) : null;
      selSpan        = timeline.getSelectionSpan();
     
      if( (mode == EDIT_INSERT) && !selSpan.isEmpty() ) {
        edit.addPerform( TimelineVisualEdit.position( this, Session.this, span.start ));
        edit.addPerform( TimelineVisualEdit.select( this, Session.this, new Span() ));
      }
      if( cutTimeline ) {
        visiSpan = timeline.getVisibleSpan();
        if( visiSpan.stop > span.start ) {
          if( visiSpan.stop > newDocLength ) {
            visiSpan = new Span( Math.max( 0, newDocLength - visiSpan.getLength() ), newDocLength );
            TimelineVisualEdit tve = TimelineVisualEdit.scroll( this, Session.this, visiSpan );
            edit.addPerform( tve );
          } // 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 ));
View Full Code Here

    throws IOException
    {
      final Span            span        = (Span) context.getClientArg( "span" );
      final int            mode        = ((Integer) context.getClientArg( "mode" )).intValue();
      final List            tis          = (List) context.getClientArg( "tis" );
      final AbstractCompoundEdit    edit        = (AbstractCompoundEdit) context.getClientArg( "edit" );
      final BlendContext        bc          = (BlendContext) context.getClientArg( "bc" );
      final long            left        = bc == null ? 0L : bc.getLeftLen();
      final long            right        = bc == null ? 0L : bc.getRightLen();
      final boolean          cutTimeline      = ((Boolean) context.getClientArg( "cut" )).booleanValue();
      final Span            cutTimelineSpan    = (Span) context.getClientArg( "cutSpan" );
View Full Code Here

TOP

Related Classes of de.sciss.app.AbstractCompoundEdit

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.