Package de.sciss.io

Examples of de.sciss.io.Span


  throws IOException
  {
    final AudioFileDescr  afd      = af.getDescr();
    final int[][]      channelMaps = new int[ 1 ][ afd.channels ];
    final AudioTrail    at;
    final Span        span    = new Span( 0, afd.length );

    for( int i = 0; i < afd.channels; i++ ) {
      channelMaps[ 0 ][ i ] = i;
    }
View Full Code Here


   
    final long      length;
    final double    rate;
    AudioFileDescr    afd;
    final int[][]    channelMaps;
    final Span      span;
    final AudioTrail  at;
    final Span[]    fileSpans  = new Span[ afs.length ];
   
    afd      = afs[ 0 ].getDescr();
    length    = afd.length;
    rate    = afd.rate;
    span    = new Span( 0, length );
    channelMaps  = new int[ afs.length ][];
    for( int i = 0; i < afs.length; i++ ) {
      afd    = afs[ i ].getDescr();
      if( (afd.length != length) || (afd.rate != rate) ) {
        throw new IllegalArgumentException( "Invalid mixing of lengths and rates" );
View Full Code Here

  throws IOException
  {
    if( audioFiles.length != 1 ) throw new IllegalStateException();
 
    final AudioFileDescr  afd      = af.getDescr();
    final Span        span    = new Span( 0, afd.length );

    if( afd.channels != channelMaps[ 0 ].length ) throw new IllegalStateException();

//    clear( null );
    clearIgnoreDependants();
View Full Code Here

    if( audioFiles.length != afs.length ) throw new IllegalStateException();
   
    final long      length;
    final double    rate;
    AudioFileDescr    afd;
    final Span      span;
    final Span[]    fileSpans  = new Span[ afs.length ];
   
    afd      = afs[ 0 ].getDescr();
    length    = afd.length;
    rate    = afd.rate;
    span    = new Span( 0, length );
    for( int i = 0; i < afs.length; i++ ) {
      afd    = afs[ i ].getDescr();
      if( afd.channels != channelMaps[ i ].length ) throw new IllegalStateException();
      if( (afd.length != length) || (afd.rate != rate) ) {
        throw new IllegalArgumentException( "Invalid mixing of lengths and rates" );
View Full Code Here

    synchronized( tempF ) {
      for( int i = 0; i < tempF.length; i++ ) {
        fileStart    = tempF[ i ].getFrameNum();
        fileStop    = fileStart + span.getLength();
        tempF[ i ].setFrameNum( fileStop );
        fileSpans[ i = new Span( fileStart, fileStop );
      }
    }
   
    if( singleFile ) {
      return new InterleavedAudioStake( span, tempF[ 0 ], fileSpans[ 0 ]);
View Full Code Here

    final List    coll  = editGetCollByStart( null );
    final int    num    = coll.size();
    AudioStake    stake;
    int        chunkLen;
    Span      subSpan, readSpan;
//    int        len    = (int) readSpan.getLength();
    int        len    = 0;
    int        idx;
   
    for( int i = 0; i < readSpans.length; i++ ) {
      readSpan  = readSpans[ i ];
      idx      = indexOf( readSpan.start, true );
//System.err.println( "idx = "+idx );
      if( idx < 0 ) idx = Math.max( 0, -(idx + 2) );
      len       += (int) readSpan.getLength();
     
      while( (len > 0) && (idx < num) ) {
//System.err.println( "len = "+len+"; idx = "+idx+"; num = "+num );
        stake    = (AudioStake) coll.get( idx );
        subSpan    = new Span( Math.max( stake.getSpan().start, readSpan.start ),
                    Math.min( stake.getSpan().stop, readSpan.stop ));
        chunkLen  = (int) subSpan.getLength();
        if( chunkLen > 0 ) {
          stake.addBufferReadMessages( bndl, subSpan, bufs, bufOff );
          bufOff     += chunkLen;
          len       -= chunkLen;
        }
View Full Code Here

    final long        len      = copySpan.getLength();
    final int        bufLen    = (int) Math.min( len, BUFSIZE );
    final double      progWeight  = 1.0 / len;
   
    // throws IOException
    writeStake  = alloc( new Span( insertPos, insertPos + len ));
   
    try {
      switch( mode ) {
      case MODE_INSERT:
        if( hasBlend ) {
View Full Code Here

    final float[][]      srcBuf      = new float[ srcTrail == null ? 0 : srcTrail.getChannelNum() ][];
    final float[][]      mappedSrcBuf  = new float[ this.getChannelNum() ][];
    float[]          empty      = null;
    boolean          srcUsed      = 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;
        }
        mappedSrcBuf[ i ] = srcBuf[ trackMap[ i ]];
      } else {
        if( empty == null ) empty = new float[ bufLen ];
        mappedSrcBuf[ i ] = empty;
      }
    }

    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 );
      writeStake.writeFrames( mappedSrcBuf, 0, chunkSpan );
      framesWritten += chunkLen;
      insertPos  = newInsPos;
     
      setProgression( framesWritten, progWeight );
View Full Code Here

  // attempts shared on DOOR_TIME
  private void updateTimeline()
  {
    if( doc != null ) {

      final Span  span  = doc.timeline.getSelectionSpan();
      final double rate  = doc.timeline.getRate();

      timeTrans.setLengthAndRate( doc.timeline.getLength(), rate );
      ggTimelineStart.setValue( new Param( span.getStart(), ParamSpace.spcTimeSmps.unit ));
      ggTimelineStop.setValue( new Param( span.getStop(), ParamSpace.spcTimeSmps.unit ));
      ggTimelineLen.setValue( new Param( span.getLength(), ParamSpace.spcTimeSmps.unit ));
      if( !ggTimelineStart.isEnabled() ) ggTimelineStart.setEnabled( true );
      if( !ggTimelineStop.isEnabled() )  ggTimelineStop.setEnabled( true );
      if( !ggTimelineLen.isEnabled() )  ggTimelineLen.setEnabled( true );
     
    } else {
View Full Code Here

    final float[][]      srcBuf      = new float[ srcTrail == null ? 0 : srcTrail.getChannelNum() ][];
    final float[][]      outBuf      = new float[ this.getChannelNum() ][ bufLen ];
    final float[][]      mappedSrcBuf  = new float[ this.getChannelNum() ][];
    boolean          srcUsed      = 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;
        }
        mappedSrcBuf[ i ] = srcBuf[ trackMap[ i ]];
      }
    }

    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 );
      this.readFrames( outBuf, 0, chunkSpan );
      if( srcUsed ) {
        for( int i = 0; i < mappedSrcBuf.length; i++ ) {
          if( mappedSrcBuf[ i ] != null ) add( outBuf[ i ], 0, mappedSrcBuf[ i ], 0, chunkLen );
        }
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.