Package de.sciss.io

Examples of de.sciss.io.Span


    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++ ) {
        ti = (Track.Info) tis.get( i );
View Full Code Here


    }

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

      perform();
    }
   
    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

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

     *  This method is called by ProcessingThread
     */
    public int processRun( ProcessingThread context )
    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" );
      AudioTrail            audioTrail;
      Track.Info            ti;
      boolean              isAudio;

      for( int i = 0; i < tis.size(); i++ ) {
        ti    = (Track.Info) tis.get( i );
        try {
          ti.trail.editBegin( edit );
          isAudio = ti.trail instanceof AudioTrail;
          if( ti.selected ) {
            if( mode == EDIT_INSERT ) {
              if( isAudio ) {
                if( bc == null ) {
                  ti.trail.editRemove( this, span, edit );
                } else {
                  ti.trail.editRemove( this, new Span( span.start - left, span.stop + right ), edit );
                  ti.trail.editInsert( this, new Span( span.start - left, span.start + right ), edit );
                }
                audioTrail = (AudioTrail) ti.trail;
                audioTrail.clearRange( span, EDIT_INSERT, this, edit, ti.trackMap, bc );
              } else {
                ti.trail.editRemove( this, span, edit );
View Full Code Here

   
    final int  w  = getWidth();
    Rectangle  cr;
    int      y;
   
    info = dt.getBestSubsample( new Span( viewSpan.start, viewSpan.stop + 1 ), w );
    dt.drawWaveform( info, this, g2 );

    if( nullLinie ) {
      g2.setPaint( pntNull );
      g2.setStroke( strkNull );
View Full Code Here

   
    final int  w  = getWidth();
    Rectangle  cr;
    int      y;
   
    info = dt.getBestSubsample( new Span( viewSpan.start, viewSpan.stop + 1 ), w );
    dt.drawWaveform( info, this, g2 );

    if( nullLinie ) {
      g2.setPaint( pntNull );
      g2.setStroke( strkNull );
View Full Code Here

   
    final int  w    = getWidth();
//    Rectangle  cr;
//    int      y;
   
    info  = dt.getBestSubsample( new Span( viewSpan.start, viewSpan.stop + 1 ), w );
    dt.drawWaveform( info, this, g2 );

// XXX
//    if( nullLinie ) {
//      g2.setPaint( pntNull );
View Full Code Here

    public void mouseReleased( MouseEvent e )
    {
      super.mouseReleased( e );

      Span span;

      if( dragStarted ) {
        cancelGesture();
        span = new Span( Math.min( startPos, position ),
                 Math.max( startPos, position ));
        if( !span.isEmpty() ) {
          doc.timeline.editScroll( this, span );
        }
      }
     
      validDrag  = false;
View Full Code Here

      if( stop > start ) {
        // it's crucial to update internal var timelineVis here because
        // otherwise the delay between emitting the edit and receiving the
        // change via timelineScrolled might be two big, causing setPosition
        // to fire more than one edit!
        timelineVis = new Span( start, stop );
        doc.timeline.editScroll( this, timelineVis );
//          doc.getUndoManager().addEdit( TimelineVisualEdit.scroll( this, doc, timelineVis ));
        return;
      }
    }
View Full Code Here

TOP

Related Classes of de.sciss.io.Span

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.