Package de.sciss.io

Examples of de.sciss.io.Span


    return new InterleavedAudioStake( span, f, fileSpan, maxFileSpan, fileName );
  }

  public Stake replaceStart( long newStart )
  {
    final Span newFileSpan  = fileSpan.replaceStart( fileSpan.start + newStart - span.start );
    final Span newSpan    = span.replaceStart( newStart );
    if( (newSpan.getLength() < 0) || (newFileSpan.getLength() < 0) || !maxFileSpan.contains( newFileSpan )) {
      throw new IllegalArgumentException( String.valueOf( newStart ));
    }
 
    return new InterleavedAudioStake( newSpan, f, newFileSpan, maxFileSpan, fileName );
  }
View Full Code Here


    return new InterleavedAudioStake( newSpan, f, newFileSpan, maxFileSpan, fileName );
  }
 
  public Stake replaceStop( long newStop )
  {
    final Span newFileSpan  = fileSpan.replaceStop( fileSpan.stop + newStop - span.stop );
    final Span newSpan    = span.replaceStop( newStop );
    if( (newSpan.getLength() < 0) || (newFileSpan.getLength() < 0) || !maxFileSpan.contains( newFileSpan )) {
      throw new IllegalArgumentException( String.valueOf( newStop ));
    }
 
    return new InterleavedAudioStake( newSpan, f, newFileSpan, maxFileSpan, fileName );
  }
View Full Code Here

  public Stake replaceStart( long newStart )
  {
    final long delta      = newStart - span.start;
    final Span[] newFileSpans  = new Span[ fileSpans.length ];
    final Span newSpan      = span.replaceStart( newStart );

    if( newSpan.getLength() < 0 ) throw new IllegalArgumentException( String.valueOf( newStart ));
   
    for( int i = 0; i < fileSpans.length; i++ ) {
      newFileSpans[ i = fileSpans[ i ].replaceStart( fileSpans[ i ].start + delta );
      if( (newFileSpans[ i ].getLength() < 0) || !maxFileSpans[ i ].contains( newFileSpans[ i ] )) {
        throw new IllegalArgumentException( String.valueOf( newStart ));
View Full Code Here

  }
 
  public Stake replaceStop( long newStop )
  {
    final long delta      = newStop - span.stop;
    final Span newSpan      = span.replaceStop( newStop );
    final Span[] newFileSpans  = new Span[ fileSpans.length ];

    if( newSpan.getLength() < 0 ) throw new IllegalArgumentException( String.valueOf( newStop ));

    for( int i = 0; i < fileSpans.length; i++ ) {
      newFileSpans[ i = fileSpans[ i ].replaceStop( fileSpans[ i ].stop + delta );
      if( (newFileSpans[ i ].getLength() < 0) || !maxFileSpans[ i ].contains( newFileSpans[ i ])) {
        throw new IllegalArgumentException( String.valueOf( newStop ));
View Full Code Here

    if( ce != null ) {
      checkEdit( ce );
    }

    final Span span = removeAllPr( stakes, ce );

    // ____ dep ____
    if( (dependants != null) && (span != null) ) {
      synchronized( dependants ) {
        for( int i = 0; i < dependants.size(); i++ ) {
View Full Code Here

    if( stakes.isEmpty() ) return null;
 
    long    start  = Long.MAX_VALUE;
    long    stop  = Long.MIN_VALUE;
    Stake    stake;
    final Span  span;
 
    for( int i = 0; i < stakes.size(); i++ ) {
      stake  = (Stake) stakes.get( i );
      sortRemoveStake( stake, ce );
      start  = Math.min( start, stake.getSpan().start );
      stop  = Math.max( stop, stake.getSpan().stop );
      if( ce == null ) stake.dispose();
    }
    span    = new Span( start, stop );
    if( ce != null ) ce.addPerform( new Edit( this, stakes, span, EDIT_REMOVE ));

    return span;
  }
View Full Code Here

    }
   
    public void debugVerifyContiguity()
    {
      Stake   stake;
      final   Span totalSpan = this.getSpan();
      long    lastStop  = totalSpan.start;
      Span    stakeSpan;
      boolean  ok      = true;
     
      System.err.println( "total Span = " + totalSpan );
      for( int i = 0; i < collStakesByStart.size(); i++ ) {
        stake    = (Stake) collStakesByStart.get( i );
        stakeSpan  = stake.getSpan();
        if( stakeSpan.start != lastStop ) {
          System.err.println( "! broken contiguity for stake #" + i + " (" + stake + ") : "
              + stakeSpan + " should have start of " + lastStop );
          ok  = false;
        }
        if( stakeSpan.getLength() == 0 ) {
          System.err.println( "! warning : stake #" + i + " (" + stake + ") has zero length" );
        } else if( stakeSpan.getLength() < 0 ) {
          System.err.println( "! illegal span length for stake #" + i + " (" + stake + ") : " + stakeSpan );
          ok  = false;
        }
        lastStop = stakeSpan.stop;
      }
View Full Code Here

  throws IOException
  {
//System.err.println( "consumerBegin" );
    final AudioTrail    at;
    final ConsumerContext  consc   = (ConsumerContext) source.context.getOption( KEY_CONSC );
    final Span        span  = source.context.getTimeSpan();
   
//    consc.edit    = new SyncCompoundSessionObjEdit(
//      this, doc.bird, Session.DOOR_ALL, context.getTracks(),
//      AudioTrack.OWNER_WAVE, null, null, consc.plugIn.getName() );
    consc.edit    = new BasicCompoundEdit( consc.plugIn.getName() );
   
//    consc.bc    = BlendingAction.createBlendContext(
//      AbstractApplication.getApplication().getUserPrefs().node( BlendingAction.DEFAULT_NODE ),
//      context.getSourceRate(), context.getTimeSpan().getLength() / 2, context.getTimeSpan().getLength() / 2 ); // XXXXXXX

    at        = consc.doc.getAudioTrail();
// XXX
//    consc.bs    = mte.beginOverwrite( context.getTimeSpan(), consc.bc, consc.edit );
    consc.as    = at.alloc( span );
    consc.progOff  = getProgression();
    consc.progWeight= (1.0f - consc.progOff) / span.getLength();
   
    return true;
  }
View Full Code Here

    final int        inTrnsLen, outTrnsLen;
    final int        minBlockSize, maxBlockSize, prefBlockSize;
    final Set        newOptions;
    final RandomAccessRequester rar;
    final long        pasteLength, preMaxLen, postMaxLen;
    final Span        span;
//    final int        numClipChannels    = 0;
    boolean          hasSelectedMarkers  = false;
    Track.Info        ti;
    Object          val;

    consc      = new ConsumerContext();
    consc.plugIn  = plugIn;
    consc.doc    = doc;
    context.setOption( KEY_CONSC, consc );
   
    source      = new RenderSource( context );
   
    if( !AudioTracks.checkSyncedAudio( tis, consc.plugIn.getLengthPolicy() == RenderPlugIn.POLICY_MODIFY, null, hasSelectedAudio )) {
      return; // FAILED;
    }
    source.validAudio = (consc.plugIn.getAudioPolicy() == RenderPlugIn.POLICY_MODIFY) && hasSelectedAudio.isSet();
    for( int i = 0; i < tis.size(); i++ ) {
      ti = (Track.Info) tis.get( i );
      if( (ti.trail instanceof MarkerTrail) && ti.selected ) {
        hasSelectedMarkers = true;
        break;
      }
    }
    source.validMarkers  = (consc.plugIn.getMarkerPolicy() == RenderPlugIn.POLICY_MODIFY) && hasSelectedMarkers;
    if( source.validMarkers ) source.markers = doc.markers.getCuttedTrail( context.getTimeSpan(), doc.markers.getDefaultTouchMode(), 0 );
   
    consc.restoreUnused = plugIn.getUnselectedAudioPolicy() == RenderPlugIn.POLICY_MODIFY;
   
    try {
      if( !invokeProducerBegin( source, plugIn )) {
        BasicWindowHandler.showErrorDialog( getWindow(), new IOException( getResourceString( "errAudioWillLooseSync" )), plugIn.getName() );
        return; // FAILED;
      }
//      consStarted      = true;
//      remainingRead    = context.getTimeSpan().getLength();
      newOptions      = context.getModifiedOptions();
      if( newOptions.contains( RenderContext.KEY_MINBLOCKSIZE )) {
        val        = context.getOption( RenderContext.KEY_MINBLOCKSIZE );
        minBlockSize  = ((Integer) val).intValue();
      } else {
        minBlockSize  = 1;
      }
      if( newOptions.contains( RenderContext.KEY_MAXBLOCKSIZE )) {
        val        = context.getOption( RenderContext.KEY_MAXBLOCKSIZE );
        maxBlockSize  = ((Integer) val).intValue();
      } else {
        maxBlockSize  = 0x7FFFFF;
      }
      if( newOptions.contains( RenderContext.KEY_PREFBLOCKSIZE )) {
        val        = context.getOption( RenderContext.KEY_PREFBLOCKSIZE );
        prefBlockSize  = ((Integer) val).intValue();
      } else {
        prefBlockSize   = Math.max( minBlockSize, Math.min( maxBlockSize, 1024 ));
      }
      if( newOptions.contains( RenderContext.KEY_RANDOMACCESS )) {
        rar        = (RandomAccessRequester) context.getOption( RenderContext.KEY_RANDOMACCESS );
//        randomAccess  = true;
      } else {
        rar        = null;
      }
      if( newOptions.contains( RenderContext.KEY_CLIPBOARD )) {
        return; // FAILED;
      }
      assert minBlockSize <= maxBlockSize : "minmaxblocksize";
     
      inTrnsLen    = prefBlockSize;
      outTrnsLen    = inTrnsLen;

      // ---  ---
      for( int ch = 0; ch < source.numAudioChannels; ch++ ) {
        source.audioBlockBuf[ ch = new float[ outTrnsLen ];
      }
    }
    catch( IOException e1 ) {
      GUIUtil.displayError( getWindow(), e1, plugIn.getName() );
      return;
    }

    consc.inBuf    = new float[ source.numAudioChannels ][ inTrnsLen ];
    consc.outBuf  = new float[ source.numAudioChannels ][];
    pasteLength    = context.getTimeSpan().getLength();
    preMaxLen    = pasteLength >> 1;
    postMaxLen    = pasteLength - preMaxLen;
    consc.bcPre    = doc.createBlendContext( preMaxLen, 0, source.validAudio );
    consc.bcPost  = doc.createBlendContext( postMaxLen, 0, source.validAudio );
    span      = context.getTimeSpan();
    consc.blendPreSpan = consc.bcPre == null ? new Span() :
      span.replaceStop( span.start + consc.bcPre.getLen() );
    consc.blendPostSpan = consc.bcPost == null ? new Span() :
      span.replaceStart( span.stop - consc.bcPost.getLen() );

    progress    = 0.0f;
//    pt  = new ProcessingThread( this, doc.getFrame(), doc.bird, plugIn.getName(), new Object[] { context, null },
//                  Session.DOOR_ALL );
    pt  = new ProcessingThread( this, doc.getFrame(), plugIn.getName() );
View Full Code Here

        if( randomAccess ) {
          source.blockSpan = rar.getNextSpan();
          readLen       = (int) source.blockSpan.getLength();
        } else {
          readLen       = (int) Math.min( inTrnsLen - inOff, remainingRead );
          source.blockSpan = new Span( readOffset, readOffset + readLen );
          // preparation for next loop iteration
          remainingRead   -= readLen;
          readOffset      += readLen;
        }
        if( readLen == 0 ) break prodLp;
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.