Package de.sciss.io

Examples of de.sciss.io.Span


    final float[][]      outBuf      = new float[ this.getChannelNum() ][];
    final float[][]      thisBuf      = new float[ this.getChannelNum() ][];
    boolean          srcUsed      = false;
    boolean          thisUsed    = false;
    int            chunkLen;
    Span          chunkSpan;
    long          newSrcStart, newInsPos;
   
    for( int i = 0; i < trackMap.length; i++ ) {
      if( trackMap[ i ] >= 0 ) {
        if( srcBuf[ trackMap[ i ]] == null ) {
          srcBuf[ trackMap[ i ]] = new float[ bufLen ];
          srcUsed      = true;
        }
        outBuf[ i ]      = srcBuf[ trackMap[ i ]];
      } else {
        thisBuf[ i ]    = new float[ bufLen ];
        outBuf[ i ]      = thisBuf[ i ];
        thisUsed      = true;
      }
    }

    for( long framesWritten = 0; framesWritten < len; ) {
      chunkLen  = (int) Math.min( bufLen, len - framesWritten );
      if( srcUsed ) {
        newSrcStart  = srcStart + chunkLen;
        chunkSpan  = new Span( srcStart, newSrcStart );
        srcTrail.readFrames( srcBuf, 0, chunkSpan )// null channel bufs allowed!
        srcStart  = newSrcStart;
      }
      newInsPos  = insertPos + chunkLen;
      chunkSpan  = new Span( insertPos, newInsPos );
      if( thisUsed ) {
        this.readFrames( thisBuf, 0, chunkSpan );
      }
      writeStake.writeFrames( outBuf, 0, chunkSpan );
      framesWritten += chunkLen;
View Full Code Here


    boolean          srcUsed      = false;
    boolean          writeMix    = false;
    int            chunkLen, chunkLen2, deltaChunk;
    int            cpToMixStart  = 0;
    int            cpToMixStop    = bufLen;
    Span          chunkSpan, chunkSpan2;
   
    // for each chunk there are two scenarios (indicated by the value of writeMix):
    // 1. we are in a chunk that contains a crossfade.
    //    in this case, output is found in mixBuf by reading in mixBuf from this
    //    trail and applying fades, then mixing (adding) the source trail from mappedSrcBuf.
    //    it is possible that both fadeIn and fadeOut are contained in one chunk, hence
    //    the two separate if-blocks below in the main loop and the tracking of the "dry" portion
    //    using variables cpToMixStart and cpToMixStop. Note that we chose not the opposite
    //    way of mixing mixBuf to mappedSrcBuf because we might be duplicating source trail
    //    channels (e.g. paste mono track to stereo file)!
    // 2. we are in a chunk that does not contain fades.
    //    in this case, we simply write mappedSrcBuf as output. we have ensured that this
    //    works by filling unused channels with emptyBuf.
    //
    // to properly deal with channel duplication, we have created a separate buffer
    // srcFadeBuf that prevents the blend context from accidentally fading the
    // same channel twice

    for( int i = 0; i < trackMap.length; i++ ) {
      if( trackMap[ i ] >= 0 ) {
        if( srcBuf[ trackMap[ i ]] == null ) {
          srcBuf[ trackMap[ i ]] = new float[ bufLen ];
          srcUsed  = true;
          srcFadeBuf[ i ] = srcBuf[ trackMap[ i ]];
        }
        mappedSrcBuf[ i ] = srcBuf[ trackMap[ i ]];
      } else {
        if( empty == null ) empty = new float[ bufLen ];
        mappedSrcBuf[ i ] = empty;
      }
    }

    for( long framesWritten = 0, remaining = len; remaining > 0; ) {
      chunkLen  = (int) Math.min( bufLen, remaining );
      if( srcUsed ) {
//        newSrcStart  = srcStart + chunkLen;
        chunkSpan  = new Span( srcStart + framesWritten, srcStart + framesWritten + chunkLen );
//System.err.println( "A srcTrail.readFrames( srcBuf, 0, " + chunkSpan + " )" );
        srcTrail.readFrames( srcBuf, 0, chunkSpan )// null channel bufs allowed!
//        srcStart  = newSrcStart;

        if( framesWritten < preLen ) {  // fade source in
//System.err.println( "A bc.fadeIn : srcFadeBuf in [ 0 ... " + ((int) Math.min( chunkLen, preLen - framesWritten )) + " ], offset = "+framesWritten );
          bcPre.fadeIn( framesWritten, srcFadeBuf, 0, srcFadeBuf, 0, (int) Math.min( chunkLen, preLen - framesWritten ));
        }
        if( remaining - chunkLen < postLen ) {  // fade source out
          deltaChunk  = (int) Math.max( 0, remaining - postLen )// this is the amount of space before the actual fade begins!
          chunkLen2  = chunkLen - deltaChunk;
//System.err.println( "A bc.fadeOut : srcFadeBuf in [ " + deltaChunk + " ... " + chunkLen2 + " ], offset = "+(postLen - remaining + deltaChunk) );
          bcPost.fadeOut( postLen - remaining + deltaChunk, srcFadeBuf, deltaChunk, srcFadeBuf, deltaChunk, chunkLen2 );
        }
      }
//      newInsPos  = insertPos + chunkLen;
//      chunkSpan  = new Span( insertPos, newInsPos );
      chunkSpan  = new Span( insertPos + framesWritten, insertPos + framesWritten + chunkLen );

      if( framesWritten < preLen ) {  // fade this out
        chunkLen2  = (int) Math.min( chunkLen, preLen - framesWritten );
        deltaChunk  = chunkLen - chunkLen2;
        chunkSpan2  = deltaChunk > 0 ? chunkSpan.replaceStop( chunkSpan.stop - deltaChunk ) : chunkSpan;
//System.err.println( "B this.readFrames( mixBuf, 0, " + chunkSpan2 + " )" );
        this.readFrames( mixBuf, 0, chunkSpan2 );
//System.err.println( "B bc.fadeOut : mixBuf in [ 0 ... " + chunkLen2 + " ], offset = "+framesWritten );
        bcPre.fadeOut( framesWritten, mixBuf, 0, mixBuf, 0, chunkLen2 );
        for( int i = 0; i < mixBuf.length; i++ ) {
          if( mappedSrcBuf[ i ] != empty ) add( mixBuf[ i ], 0, mappedSrcBuf[ i ], 0, chunkLen2 );
        }
        cpToMixStart= chunkLen2;
        cpToMixStop  = chunkLen;
        writeMix  = true;
      }
     
//len - framesWritten != blendLen
//framesWritten != len - blendLen;
//fadeOutPos = origInsertPos - blendLen - (len - blendLen) = origInsertPos - len

      // check if after this chunk we have entered the fadein
      if( remaining - chunkLen < postLen ) {  // fade this in
        deltaChunk  = (int) Math.max( 0, remaining - postLen )// this is the amount of space before the actual fade begins!
        chunkLen2  = chunkLen - deltaChunk;
        chunkSpan2  = new Span( fadeOutOffset + framesWritten + deltaChunk, fadeOutOffset + framesWritten + chunkLen );
//System.err.println( "CCC . framesWritten = "+framesWritten+"; len = "+len+"; postLen = "+postLen+"; insertPos now "+insertPos+ "; remaining = "+remaining+"; deltaChunk = "+deltaChunk+"; chunkLen2 = "+chunkLen2 );       
//System.err.println( "C this.readFrames( mixBuf, " + deltaChunk + ", " + chunkSpan2 + " )" );
        this.readFrames( mixBuf, deltaChunk, chunkSpan2 );
//System.err.println( "C bc.fadeIn : mixBuf in [ " + deltaChunk + " ... " + chunkLen2 + " ], offset = "+(postLen - remaining + deltaChunk) );
        bcPost.fadeIn( postLen - remaining + deltaChunk, mixBuf, deltaChunk, mixBuf, deltaChunk, chunkLen2 );
View Full Code Here

  public void paramValueChanged( ParamField.Event e )
  {
    long  n    = (long) e.getTranslatedValue( ParamSpace.spcTimeSmps ).val;
    long  n2;
    Span  span;
 
    if( (e.getSource() == ggTimelineStart) || (e.getSource() == ggTimelineStop) ||
      (e.getSource() == ggTimelineLen) ) {

      span  = doc.timeline.getSelectionSpan();
     
      // ----- start was adjusted -----
      if( e.getSource() == ggTimelineStart ) {
        if( ggLockLen.isLocked() ) {
          n2  = n + span.getLength();
          if( n2 > doc.timeline.getLength() ) {
            n2  = doc.timeline.getLength();
            n  = n2 - span.getLength();
            ggTimelineStart.setValue( new Param( n, ParamSpace.spcTimeSmps.unit ));
          }
          span  = new Span( n, n2 );
          ggTimelineStop.setValue( new Param( n2, ParamSpace.spcTimeSmps.unit ));
        } else {
          n2 = span.getStop();
          if( n > n2 ) {
            n = n2;
            ggTimelineStart.setValue( new Param( n, ParamSpace.spcTimeSmps.unit ));
          }
          span  = new Span( n, n2 );
          ggTimelineLen.setValue( new Param( span.getLength(), ParamSpace.spcTimeSmps.unit ));
        }
      // ----- stop was adjusted -----
      } else if( e.getSource() == ggTimelineStop ) {
        if( ggLockLen.isLocked() ) {
          n2    = n - span.getLength();
          if( n2 < 0 ) {
            n2  = 0;
            n  = n2 + span.getLength();
            ggTimelineStop.setValue( new Param( n, ParamSpace.spcTimeSmps.unit ));
          }
          if( n > doc.timeline.getLength() ) {
            n  = doc.timeline.getLength();
            n2  = n - span.getLength();
            ggTimelineStop.setValue( new Param( n, ParamSpace.spcTimeSmps.unit ));
          }
          span  = new Span( n2, n );
          ggTimelineStart.setValue( new Param( n2, ParamSpace.spcTimeSmps.unit ));
        } else {
          n2    = span.getStart();
          if( n < n2 ) {
            n  = n2;
            ggTimelineStop.setValue( new Param( n, ParamSpace.spcTimeSmps.unit ));
          }
          if( n > doc.timeline.getLength() ) {
            n  = doc.timeline.getLength();
            ggTimelineStop.setValue( new Param( n, ParamSpace.spcTimeSmps.unit ));
          }
          span  = new Span( n2, n );
          ggTimelineLen.setValue( new Param( span.getLength(), ParamSpace.spcTimeSmps.unit ));
        }
      // ----- len was adjusted -----
      } else {
        if( ggLockStop.isLocked() ) {
          n2    = span.getStop() - n;
          if( n2 < 0 ) {
            n2  = 0;
            n  = span.getStop();
            ggTimelineLen.setValue( new Param( n, ParamSpace.spcTimeSmps.unit ));
          }
          span  = new Span( n2, n2 + n );
          ggTimelineStart.setValue( new Param( n2, ParamSpace.spcTimeSmps.unit ));
        } else {
          n2    = span.getStart() + n;
          if( n2 > doc.timeline.getLength() ) {
            n2  = doc.timeline.getLength();
            n  = n2 - span.getStart();
            ggTimelineLen.setValue( new Param( n, ParamSpace.spcTimeSmps.unit ));
          }
          span  = new Span( n2 - n, n2 );
          ggTimelineStop.setValue( new Param( n2, ParamSpace.spcTimeSmps.unit ));
        }
      }
      doc.timeline.editSelect( this, span );
    }
View Full Code Here

    final long        postLen      = bcPost == null ? 0L : bcPost.getLen();
    final float[][]      mixBuf      = new float[ this.getChannelNum() ][ bufLen ];
    final float[][]      srcFadeBuf    = new float[ this.getChannelNum() ][];
    boolean          srcUsed      = false;
    int            chunkLen;
    Span          chunkSpan, chunkSpan2;
    long          newSrcStart, newInsPos;
   
    // src trail is read in mapped buffer mappedSrcBuf. this trail is read into buffer mixBuf.
    // src trail is faded according to srcFadeBuf (which avoid duplicate fading of re-used
    // channels). non-null channels in mappedSrcBuf are mixed (added) to mixBuf, and mixBuf
    // is written out.

    for( int i = 0; i < trackMap.length; i++ ) {
      if( trackMap[ i ] >= 0 ) {
        if( srcBuf[ trackMap[ i ]] == null ) {
          srcBuf[ trackMap[ i ]] = new float[ bufLen ];
          srcUsed      = true;
          srcFadeBuf[ i ] = srcBuf[ trackMap[ i ]];
        }
        mappedSrcBuf[ i = srcBuf[ trackMap[ i ]];
      }
    }

    for( long framesWritten = 0; framesWritten < len; ) {
      chunkLen  = (int) Math.min( bufLen, len - framesWritten );
      newInsPos  = insertPos + chunkLen;
      chunkSpan  = new Span( insertPos, newInsPos );
      this.readFrames( mixBuf, 0, chunkSpan );
      if( srcUsed ) {
        newSrcStart  = srcStart + chunkLen;
        chunkSpan2  = new Span( srcStart, newSrcStart );
        srcTrail.readFrames( srcBuf, 0, chunkSpan2 )// null channel bufs allowed!
        srcStart  = newSrcStart;

        if( framesWritten < preLen ) {  // fade source in
          bcPre.fadeIn( framesWritten, srcFadeBuf, 0, srcFadeBuf, 0, (int) Math.min( chunkLen, preLen - framesWritten ));
View Full Code Here

//    boolean          thisFadeUsed  = false;
//    boolean          thisDryUsed    = false;
    int            chunkLen, chunkLen2, deltaChunk;
    int            clrMixFadeStart = 0;
    int            clrMixFadeStop  = bufLen;
    Span          chunkSpan; // , chunkSpan2;
    long          newSrcStart, newInsPos, fadeOff;
    boolean          xFadeBegin, xFadeEnd, xFade;
   
    // for each chunk there are two scenarios (indicated by the value of xFade):
    // 1. we are in a chunk that contains a crossfade.
    //    in this case, output is found in mixBuf by reading in mixBuf from this
    //    trail and applying fades to the "wet" parts of this trail (thisFadeBuf),
    //    then mixing (adding) the source trail from mappedSrcBuf.
    // 2. we are in a chunk that does not contain fades.
    //    in this case, we only read those channels from this trail that are "dry"
    //    (not overwritten) as specified in thisDryBuf. we then write a composite
    //    buffer compositeBuf which contains either references to channels from the source
    //    (mappedSrcBuf) or from this trail (thisDryBuf).
    //
    // to properly deal with channel duplication, we have created a separate buffer
    // srcFadeBuf that prevents the blend context from accidentally fading the
    // same channel twice

    for( int i = 0; i < trackMap.length; i++ ) {
      if( trackMap[ i ] >= 0 ) {
        if( srcBuf[ trackMap[ i ]] == null ) {
          srcBuf[ trackMap[ i ]] = new float[ bufLen ];
          srcUsed  = true;
          srcFadeBuf[ i ] = srcBuf[ trackMap[ i ]];
        }
        mappedSrcBuf[ i = srcBuf[ trackMap[ i ]];
        compositeBuf[ i = mappedSrcBuf[ i ];
        thisFadeBuf[ i = mixBuf[ i ];
//        thisFadeUsed    = true;
      } else {
        thisDryBuf[ i ]    = mixBuf[ i ];
//        thisDryUsed      = true;
        compositeBuf[ i = mixBuf[ i ];
      }
    }

    for( long framesWritten = 0; framesWritten < len; ) {
      chunkLen  = (int) Math.min( bufLen, len - framesWritten );
      xFadeBegin  = framesWritten < preLen;
      xFadeEnd  = len - (framesWritten + chunkLen) < postLen;
      xFade    = xFadeBegin || xFadeEnd;
     
      if( srcUsed ) {
        newSrcStart  = srcStart + chunkLen;
        chunkSpan  = new Span( srcStart, newSrcStart );
        srcTrail.readFrames( srcBuf, 0, chunkSpan )// null channel bufs allowed!
        srcStart  = newSrcStart;

        if( xFadeBegin ) {  // fade source in
//System.err.print( "xFadeBegin. off = "+framesWritten+"; srcFadeBuf = [ " );
//for( int kk = 0; kk < srcFadeBuf.length; kk++ ) {
//  if( kk > 0 ) System.err.print( ", " );
//  System.err.print( srcFadeBuf[ kk ] == null ? "null" : ("float[ " + srcFadeBuf[ kk ].length + " ]") );
//}
//System.err.println( " ]; len = " + ((int) Math.min( chunkLen, blendLen - framesWritten )));
          bcPre.fadeIn( framesWritten, srcFadeBuf, 0, srcFadeBuf, 0, (int) Math.min( chunkLen, preLen - framesWritten ));
        }
        if( xFadeEnd ) {  // fade source out
//System.err.print( "xFadeEnd. off = "+(framesWritten - (len - blendLen))+"; srcFadeBuf = [ " );
//for( int kk = 0; kk < srcFadeBuf.length; kk++ ) {
//  if( kk > 0 ) System.err.print( ", " );
//  System.err.print( srcFadeBuf[ kk ] == null ? "null" : ("float[ " + srcFadeBuf[ kk ].length + " ]") );
//}
//System.err.println( " ]; len = " + ((int) Math.min( chunkLen, len - framesWritten )));
          fadeOff    = framesWritten - (len - postLen);
          if( fadeOff < 0 ) {
            deltaChunk  = (int) -fadeOff;
            fadeOff    = 0;
          } else {
            deltaChunk  = 0;
          }
          chunkLen2  = (int) Math.min( chunkLen, len - framesWritten ) - deltaChunk;
          bcPost.fadeOut( fadeOff, srcFadeBuf, deltaChunk, srcFadeBuf, deltaChunk, chunkLen2 );
        }
      }
      newInsPos  = insertPos + chunkLen;
      chunkSpan  = new Span( insertPos, newInsPos );

      if( xFade ) {
        this.readFrames( mixBuf, 0, chunkSpan );
        if( xFadeBegin ) {  // fade this out
          chunkLen2    = (int) Math.min( chunkLen, preLen - framesWritten );
View Full Code Here

    final double    progRatio    = 1.0 / (1.0 + ((1.0 - perDecProgRatio) / perDecProgRatio) * numDepDec);
    final double    progWeight    = progRatio / blendLen;

    final long      left      = bc.getLeftLen();
    final long      right      = bc.getRightLen();
    final Span      fadeInSpan    = new Span( clearSpan.stop - left, clearSpan.stop + right );
    final Span      fadeOutSpan    = new Span( clearSpan.start - left, clearSpan.start + right );
    final int      bufLen      = (int) Math.min( blendLen, BUFSIZE );
    final Span      writeSpan    = fadeOutSpan; // new Span( clearSpan.start, clearSpan.start + blendLen );
    final int      numCh      = this.getChannelNum();
    final float[][]    bufA      = new float[ numCh ][ bufLen ];
    final float[][]    bufB      = new float[ numCh ][ bufLen ];
   
//System.err.println( "fadeInSpan = " + fadeInSpan + "; fadeOutSpan = " + fadeOutSpan );

    AudioStake      writeStake  = null;
//    float[]        temp, temp2;
    int          chunkLen;
    long        n;
    Span        chunkSpan;
    boolean        success  = false;
   
//    final long time1 = System.currentTimeMillis();
   
    try {
      flushProgression();
      writeStake    = alloc( writeSpan );
     
      for( long framesWritten = 0; framesWritten < blendLen; ) {
        chunkLen  = (int) Math.min( bufLen, blendLen - framesWritten );
        n      = fadeOutSpan.start + framesWritten;
        chunkSpan  = new Span( n, n + chunkLen );
        this.readFrames( bufA, 0, chunkSpan );
        n      = fadeInSpan.start + framesWritten;
        chunkSpan  = new Span( n, n + chunkLen );
        this.readFrames( bufB, 0, chunkSpan );
        bc.blend( framesWritten, bufA, 0, bufB, 0, bufA, 0, chunkLen );
        n      = writeSpan.start + framesWritten;
        chunkSpan  = new Span( n, n + chunkLen );
        writeStake.writeFrames( bufA, 0, chunkSpan );
        framesWritten += chunkLen;
       
        setProgression( framesWritten, progWeight );
      }
View Full Code Here

//      final float[][]    mixBuf      = new float[ numCh ][];
      final float[][]    readWriteBufF  = new float[ numCh ][];    // reading and writing during fade
      final float[][]    fadeBuf;                  // channels which are faded
      final float[][]    readBufS;                  // reading during middle part
      final float[][]    writeBufS;                  // writing during middle part
      final Span      silentSpan    = new Span( clearSpan.start + blendLen, clearSpan.stop - blendLen );
      final long      silentLen    = silentSpan.getLength();
      final int      bufLen      = (int) Math.min( clearSpan.getLength(), BUFSIZE );
      final boolean    useSilentStake  = sync && (silentLen >= MINSILENTSIZE);
      final AudioStake  writeStake1, writeStake2, writeStake3;
      final double    progWeight;
      float[]        empty    = null;
      float[]        temp;
      int          chunkLen;
      long        n;
      long        totalFramesWritten  = 0;
      Span        chunkSpan;

      flushProgression();

      // buffer regarding fade in / out
      if( hasBlend ) {
        fadeBuf  = new float[ numCh ][];
        for( int i = 0; i < trackMap.length; i++ ) {
          readWriteBufF[ i = new float[ bufLen ];
          if( trackMap[ i ]) fadeBuf[ i ] = readWriteBufF[ i ];
        }
      } else {
        fadeBuf = null;
      }

      // buffer regarding middle part
      if( !useSilentStake ) {
        readBufS  = new float[ numCh ][];
        writeBufS  = new float[ numCh ][];
        for( int i = 0; i < trackMap.length; i++ ) {
          if( trackMap[ i ]) {  // need to silence
            if( empty == null ) empty = new float[ bufLen ];
            writeBufS[ i ] = empty;
          }
          if( !trackMap[ i ]) {  // need to copy (bypass)
            if( readWriteBufF[ i ] != null ) {  // can reuse
              readBufS[ i = readWriteBufF[ i ]
            } else {
              readBufS[ i = new float[ bufLen ];
            }
            writeBufS[ i ] = readBufS[ i ];
          }
        }
      } else {
        readBufS  = null;
        writeBufS  = null;
      }

      // ---- define stakes ----
      if( useSilentStake ) {    // ok, let's put a silent stake in dem middle
        if( hasBlend ) {
          writeStake1 = alloc( new Span( clearSpan.start, silentSpan.start ));
          collStakes.add( writeStake1 );
        } else {
          writeStake1  = null;
        }
        writeStake2  = allocSilent( silentSpan );
        collStakes.add( writeStake2 );
        if( hasBlend ) {
          writeStake3  = alloc( new Span( silentSpan.stop, clearSpan.stop ));
          collStakes.add( writeStake3 );
        } else {
          writeStake3  = null;
        }
       
        final double progRatio2    = 1.0 / (1.0 + numDepDec)// inf:1 for silentLen
        final double w        = (double) blendLen2 / (blendLen2 + silentLen); // weight of progRatio versus progRatio2
        progWeight          = (progRatio*w + progRatio2*(1.0-w)) / blendLen2;
     
      } else {
        writeStake2  = alloc( clearSpan );
        writeStake1  = writeStake2;
        writeStake3  = writeStake2;
        collStakes.add( writeStake2 );
        progWeight  = progRatio / (blendLen2 + silentLen);
//        progWeight  = 9.0 / ((blendLen2 + silentLen) * (numDepDec + 9));
      }

      // ---- fade out part ----
      for( long framesWritten = 0; framesWritten < blendLen; ) {
        chunkLen  = (int) Math.min( bufLen, blendLen - framesWritten );
        n      = clearSpan.start + framesWritten;
        chunkSpan  = new Span( n, n + chunkLen );
        this.readFrames( readWriteBufF, 0, chunkSpan )// d.h. alle kanaele lesen
        bc.fadeOut( framesWritten, fadeBuf, 0, fadeBuf, 0, chunkLen );    // only fade selected tracks
        writeStake1.writeFrames( readWriteBufF, 0, chunkSpan );
        framesWritten += chunkLen;
        totalFramesWritten += chunkLen;
        setProgression( totalFramesWritten, progWeight );
      }
     
      // ---- middle part ----
      if( !useSilentStake ) {
        // make sure writeBufF is cleared for unselected tracks now, since if hasBlend == true, it was used before
        if( hasBlend ) {
          for( int i = 0; i < numCh; i++ ) {
            temp = writeBufS[ i ];
            if( temp != empty ) {
              for( int j = 0; j < bufLen; j++ ) {
                temp[ j ] = 0f;
              }
            }
          }
        }
       
        for( long framesWritten = 0; framesWritten < silentLen; ) {
          chunkLen  = (int) Math.min( bufLen, silentLen - framesWritten );
          n      = silentSpan.start + framesWritten;
          chunkSpan  = new Span( n, n + chunkLen );
          if( !sync ) {  // not all channels are empty
            this.readFrames( readBufS, 0, chunkSpan );
          }
          writeStake2.writeFrames( writeBufS, 0, chunkSpan );
          framesWritten += chunkLen;
          totalFramesWritten += chunkLen;
          setProgression( totalFramesWritten, progWeight );
        }
      }

      // ---- fade in part ----
      for( long framesWritten = 0; framesWritten < blendLen; ) {
        chunkLen  = (int) Math.min( bufLen, blendLen - framesWritten );
        n      = silentSpan.stop + framesWritten;
        chunkSpan  = new Span( n, n + chunkLen );
        this.readFrames( readWriteBufF, 0, chunkSpan )// d.h. alle kanaele lesen
        bc.fadeIn( framesWritten, fadeBuf, 0, fadeBuf, 0, chunkLen );    // only fade selected tracks
        writeStake3.writeFrames( readWriteBufF, 0, chunkSpan );
        framesWritten += chunkLen;
        totalFramesWritten += chunkLen;
View Full Code Here

//    int        len    = (int) readSpan.getLength();
    int        dataStop= (int) readSpan.getLength() + dataOffset;

    AudioStake  stake;
    int      chunkLen;
    Span    subSpan;
   
    while( (dataOffset < dataStop) && (idx < num) ) {
      stake    = (AudioStake) stakesByStart.get( idx );
      subSpan    = new Span( Math.max( stake.getSpan().start, readSpan.start ),
                  Math.min( stake.getSpan().stop, readSpan.stop ));
      chunkLen  = stake.readFrames( data, dataOffset, subSpan );
      dataOffset += chunkLen;
//      len       -= chunkLen;
      idx++;
View Full Code Here

//  }

  public void flatten( InterleavedStreamFile f, Span span, int[] channelMap )
    throws IOException
  {
    final Span      fileSpan  = new Span( f.getFramePosition(), span.getLength() );
    final AudioStake  stake    = new InterleavedAudioStake( span, f, fileSpan );
   
    try {
      flatten( stake, span, channelMap );
    }
View Full Code Here

      return;
    }
 
    final Span[]    fileSpans  = new Span[ fs.length ];
    for( int i = 0; i < fileSpans.length; i++ ) {
      fileSpans[ i ]        = new Span( fs[ i ].getFramePosition(), span.getLength() );
    }
    final AudioStake  stake    = new MultiMappedAudioStake( span, fs, fileSpans );
   
    try {
      flatten( stake, span, channelMap );
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.