Package de.sciss.io

Examples of de.sciss.io.Span


//      System.out.println( "decimator.decimatePCM( inBuf, outBuf, fftBuf, 0, " + len + ", " + (1 << decim) + " )" );
      decimator.decimatePCM( inBuf, outBuf, 0, len, 1 << decim );
//      System.out.println( "doing" );
      das.continueWrite( 0, outBuf, 0, len );
      if( cacheAS != null ) {
        cacheAS.writeFrames( outBuf, 0, new Span( cacheOff, cacheOff + len ));
      }
    }

    subsampleWrite2( outBuf, das, len );
  }
View Full Code Here


    if( prNormalize ) {  // needs to scan twice, hence random access
      source.context.setOption( RenderContext.KEY_PREFBLOCKSIZE, new Integer( BLOCKSIZE ));
      source.context.setOption( RenderContext.KEY_RANDOMACCESS, this );
      // request first block
      prRenderLength  = prTotalSpan.getLength();
      prNextSpan    = new Span( prTotalSpan.start, Math.min( prTotalSpan.start + BLOCKSIZE, prTotalSpan.stop ));
      prPeakKnown  = false;
      prMaxAmp    = 0.0f;
      prProgWeight  = 1.0f / (3 * Math.max( 1, prRenderLength ));
      return true;
    } else {
View Full Code Here

      prFramesWritten += source.audioBlockBufLen;

      prHost.setProgression( prFramesWritten * prProgWeight );

      // request next block
      prNextSpan = new Span( prNextSpan.stop, Math.min( prTotalSpan.stop, prNextSpan.stop + BLOCKSIZE ));
      if( prFramesWritten >= prRenderLength ) {
        assert prNextSpan.isEmpty();
        prPeakKnown  = true;
        if( prMaxAmp > 0.0f ) {
          prGain /= prMaxAmp;
        }
        // start second pass
        prNextSpan  = new Span( prTotalSpan.start, Math.min( prTotalSpan.start + BLOCKSIZE, prTotalSpan.stop ));
        return prConsumer.consumerBegin( source );
      } else {
        return true;
      }
    } else {
      for( int ch = 0; ch < source.numAudioChannels; ch++ ) {
        if( !source.audioTrackMap[ ch ]) continue;
        for( int i = source.audioBlockBufOff, j = i + source.audioBlockBufLen; i < j; i++ ) {
          source.audioBlockBuf[ ch ][ i ] *= prGain;
        }
      }
      if( prNormalize ) {
        // request next block
        prNextSpan = new Span( prNextSpan.stop, Math.min( prTotalSpan.stop, prNextSpan.stop + BLOCKSIZE ));
      }
      return prConsumer.consumerRender( source );
    }
  }
View Full Code Here

  {
    if( !Thread.holdsLock( fileSync ) ) throw new IllegalMonitorStateException();

    final long floorStart = span.start & MAXMASK;
    final long ceilStop = (span.stop + MAXCEILADD) & MAXMASK;
    final Span extSpan = (floorStart == span.start) && (ceilStop == span.stop) ? span : new Span( floorStart,
    ceilStop );
    final Span[] fileSpans = new Span[ SUBNUM ];
    final Span[] biasedSpans = new Span[ SUBNUM ];
    long fileStart;
    long fileStop;

    if( tempF == null ) {
      tempF = createTempFiles(); // XXX sync
    }
    synchronized( tempF ) {
      for( int i = 0; i < SUBNUM; i++ ) {
        fileStart = tempF[ i ].getFrameNum();
        fileStop = fileStart + (extSpan.getLength() >> decimHelps[ i ].shift);
        tempF[ i ].setFrameNum( fileStop );
        fileSpans[ i ] = new Span( fileStart, fileStop );
        biasedSpans[ i ] = extSpan;
      }
    }
    return new DecimatedStake( extSpan, tempF, fileSpans, biasedSpans, decimHelps );
  }
View Full Code Here

  {
    if( !Thread.holdsLock( fileSync )) throw new IllegalMonitorStateException();

    final long floorStart  = span.start & MAXMASK;
    final long ceilStop    = (span.stop + MAXCEILADD) & MAXMASK;
    final Span extSpan    = (floorStart == span.start) && (ceilStop == span.stop) ?
                  span : new Span( floorStart, ceilStop );
    final Span[] fileSpans  = new Span[ SUBNUM ];
    final Span[] biasedSpans = new Span[ SUBNUM ];
    long fileStart;
    long fileStop;

    if( tempFAsync == null ) {
      // XXX THIS IS THE PLACE TO OPEN WAVEFORM CACHE FILE
      tempFAsync = createTempFiles();
    }
    synchronized( tempFAsync ) {
      for( int i = 0; i < SUBNUM; i++ ) {
        fileStart    = tempFAsync[ i ].getFrameNum();
        fileStop    = fileStart + (extSpan.getLength() >> decimHelps[ i ].shift);
        tempFAsync[ i ].setFrameNum( fileStop );
        fileSpans[ i = new Span( fileStart, fileStop );
        biasedSpans[ i ] = extSpan;
      }
    }
    return new DecimatedStake( extSpan, tempFAsync, fileSpans, biasedSpans, decimHelps );
  }
View Full Code Here

   *
   *  @synchronization  To be called in the event thread.
   */
    public void play( double scale )
    {
    playSpan( new Span( doc.timeline.getPosition(), doc.timeline.getLength() ), scale )// XXX sync?
    }
View Full Code Here

    final long loopMinStop  = loopStart + loopLen;
    final long foldStart  = (unfolded.start < loopMinStop) ? unfolded.start : ((unfolded.start - loopStart) % loopLen) + loopStart;
    final long attemptStop  = foldStart + unfolded.getLength();
   
    // no splitting up required
    if( attemptStop <= loopMinStop ) return new Span[] { new Span( foldStart, attemptStop )};
   
    // pseudo-code:
    // numSpans        = (attemptStop - loopMinStop + loopLen-1) / loopLen + 1
    final int numSpans    = (int) ((attemptStop - loopStart - 1) / loopLen) + 1;
    final long foldStop    = ((attemptStop - loopStart) % loopLen) + loopStart;
    final Span[] folded    = new Span[ numSpans ];
    folded[ 0 ]        = new Span( foldStart, loopMinStop );
    for( int i = 1, j = numSpans - 1; i <= j; i++ ) {
      folded[ i ]      = new Span( loopStart, i < j ? loopMinStop : foldStop );
    }
    return folded;
  }
View Full Code Here

    prGain      = (float) ut.translate( Param.fromPrefs( prefs, KEY_GAIN, paraDefGain ), spcAmp ).val;

    if( prNormalize ) {
      prMaxAmp  = 0.0f;
      source.context.setOption( RenderContext.KEY_RANDOMACCESS, this );
      prNextSpan  = new Span( prTotalSpan.start, Math.min( prTotalSpan.start + prOutBufSize,
                  prTotalSpan.stop ));
//System.err.println( "initial span "+prNextSpan.start + " ... " +prNextSpan.stop );
      prTempFile  = createTempFile( source.numAudioChannels, source.context.getSourceRate() );
      prProgWeight= 1.0f / Math.max( 1, prRenderLength ) * prWinSize / (prWinSize + 1);
      return true;
View Full Code Here

        }
      }
     
      prTempFile.writeFrames( source.audioBlockBuf, source.audioBlockBufOff, source.audioBlockBufLen );
     
      prNextSpan = new Span( prNextSpan.stop, Math.min( prTotalSpan.stop,
                   prNextSpan.stop + prOutBufSize ));
//System.err.println( "next span "+prNextSpan.start + " ... " +prNextSpan.stop );

      prHost.setProgression( prFramesWritten * prProgWeight );

View Full Code Here

 
    while( prFramesWritten < prRenderLength ) {
      transLen      = (int) Math.min( prOutBufSize, prRenderLength - prFramesWritten );
      source.audioBlockBufOff  = 0;
      source.audioBlockBufLen  = transLen;
      source.blockSpan  = new Span( writeOffset, writeOffset + transLen );

      prTempFile.readFrames( source.audioBlockBuf, source.audioBlockBufOff, source.audioBlockBufLen );
     
//      float test = 0f;
//      for( int i = 0; i < source.audioBlockBufLen; i++ ) {
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.