Examples of Span


Examples of de.sciss.io.Span

    len >>= decim;
    if( inBuf != null ) {
      decimator.decimatePCM( inBuf, outBuf, 0, len, 1 << decim );
      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

Examples of de.sciss.io.Span

              for( int j = 0; j < ct.bufsDisk.length; j++ ) {
                numCh = ct.bufsDisk[ j ].getNumChannels();
                bndl2.addPacket( ct.bufsDisk[ j ].fillMsg( bufOff * numCh, fill * numCh, 0.0f ));
              }
            }
            bufSpans = transport.foldSpans( new Span( start, pos + DISKBUF_SIZE_H ), MIN_LOOP_LEN );
            doc.getAudioTrail().addBufferReadMessages( bndl2, bufSpans, ct.bufsDisk, bufOff + fill );

            lastBufSpans[ even ] = bufSpans;
if( DEBUG_FOLD ) {
  System.out.println( "------C "+ nextClock + ", " + even + ", " + playOffset + ", " + pos );
View Full Code Here

Examples of de.sciss.io.Span

  {
    final SynthDef[]    defs;
    final Buffer[]      bufsDisk;
    final Synth[]      synthsBufRd;
    final Bus        busInternal, busPh;
    final Span        span        = doc.timeline.getSelectionSpan();
    final AudioTrail    at          = doc.getAudioTrail();
    final long        nrtPlayOffset    = span.start;
    final Span[]      bufSpans      = new Span[ 1 ];
    final Group        nrtGrpRoot, nrtGrpInput;
    final Synth        synthPhasor;
    final float        realRate;
    final float        interpolation;
    final double      nrtServerRate;
    final float        rate        = 1.0f;
    Server          nrtServer      = null;
    NRTFile          f          = null;
    int            argIdx        = 1;
    int            audioBusOffset, bufferOffset; //, controlBusOffset;
    OSCBundle        bndl;
    double          time        = 0.0;
    boolean          even;
    int            nrtClock;
    long          pos          = nrtPlayOffset;
   
    if( ct == null ) {
//      rom.replyFailed( rom, new IOException( "No routing context" ));
      try {
        rom.replyFailed( 1 );
      }
      catch( IOException e11 ) {
        OSCRoot.failed( rom, e11 );
      }
    }
 
    try {
      f        = NRTFile.openAsWrite( new File( rom.msg.getArg( argIdx ).toString() ));
      argIdx++;
      audioBusOffset  = ((Number) rom.msg.getArg( argIdx )).intValue();
      argIdx++;
//      controlBusOffset= ((Number) rom.msg.getArg( argIdx )).intValue();
      argIdx++;
      bufferOffset  = ((Number) rom.msg.getArg( argIdx )).intValue();
      argIdx++;
      nrtServerRate    = ((Number) rom.msg.getArg( argIdx )).doubleValue();
     
      nrtServer      = new Server( "nrt" );
     
      f.write( SuperColliderClient.getInstance().loadDefsMsg() );
     
      defs      = createInputDefs( ct.chanMaps ); // ct.numInputChannels
      if( defs != null ) {
        for( int i = 0; i < defs.length; i++ ) {
          f.write( defs[ i ].recvMsg() );
        }
      }

//      sourceRate      = doc.timeline.getRate();
//      serverRate      = server.getSampleRate();
      srcFactor      = sourceRate / nrtServerRate;
      realRate      = (float) (rate * srcFactor);
      interpolation    = realRate == 1.0f ? 1f : 3f;
   
      nrtGrpRoot        = Group.basicNew( nrtServer );
      f.write( nrtGrpRoot.addToHeadMsg( nrtServer.getDefaultGroup() ));
      nrtGrpInput      = Group.basicNew( nrtServer );
      f.write( nrtGrpInput.addToTailMsg( nrtGrpRoot ));

      synthsBufRd        = new Synth[ ct.numFiles ];
      busInternal        = new Bus( nrtServer, kAudioRate, audioBusOffset, ct.numInChans );
      audioBusOffset       += busInternal.getNumChannels();
      busPh        = new Bus( nrtServer, kAudioRate, audioBusOffset );
      audioBusOffset       += busPh.getNumChannels();
      bufsDisk        = new Buffer[ ct.numFiles ];
      for( int i = 0; i < ct.numFiles; i++ ) {
        bufsDisk[ i ]    = new Buffer( nrtServer, DISKBUF_SIZE, ct.chanMaps[ i ].length, bufferOffset++ );
        f.write( bufsDisk[ i ].allocMsg() );
      }

      for( int i = 0; i < ct.numFiles; i++ ) {
        synthsBufRd[ i = Synth.basicNew( "eisk-input" + ct.chanMaps[ i ].length, nrtServer );
      }
      synthPhasor  = Synth.basicNew( "eisk-phasor", nrtServer );

      for( nrtClock = 0, even = true;; nrtClock++, even = !even ) {
        if( even ) {
          pos = nrtClock * DISKBUF_SIZE_HM - DISKBUF_PAD + nrtPlayOffset;
        } else {
          pos = nrtClock * DISKBUF_SIZE_HM + nrtPlayOffset;
        }
        if( pos >= span.stop ) break;
        f.setTime( time );
//System.err.println( "clock = "+clock+"; pos = "+pos+"; time = "+time );
        bndl        = new OSCBundle( time );
//        if( pos >= DISKBUF_PAD ) {
        if( pos < 0 ) {
          for( int i = 0; i < bufsDisk.length; i++ ) {
            bndl.addPacket( bufsDisk[ i ].fillMsg( 0, DISKBUF_PAD * bufsDisk[ i ].getNumChannels(), 0.0f ));
          }
          pos += DISKBUF_PAD;
        }
//          bufSpans[ 0 ] = new Span( pos - DISKBUF_PAD, pos - DISKBUF_PAD + DISKBUF_SIZE_H );
        bufSpans[ 0 ] = new Span( pos, pos + DISKBUF_SIZE_H );
        at.addBufferReadMessages( bndl, bufSpans, bufsDisk, even ? 0 : DISKBUF_SIZE_H );
        f.write( bndl );
       
        if( nrtClock == 0 ) {
          for( int i = 0, off = 0; i < ct.numFiles; i++ ) {
            f.write( synthsBufRd[ i ].newMsg( nrtGrpInput, new String[] {
              "i_aInBf",                 "i_aOtBs",                    "i_aPhBs",            "i_intrp" }, new float[] {
              bufsDisk[ i ].getBufNum(), busInternal.getIndex() + off, busPh.getIndex(), interpolation }
            ));
            off += ct.chanMaps[ i ].length;
          }

          if( ct.numFiles > 0 ) {
            f.write( synthPhasor.newMsg( nrtGrpInput, new String[] {
              "i_aInBf",           "rate",   "i_aPhBs"          }, new float[] {
              bufsDisk[ 0 ].getBufNum(), realRate, busPh.getIndex() }));
          }
         
        } else {
          time = (nrtClock * DISKBUF_SIZE_HM / sourceRate) + 0.1// a bit beyond that spot to avoid rounding errors
        }
      }
     
      time = span.getLength() / sourceRate;
//System.err.println( "time = "+time );
      f.setTime( time );
      f.write( nrtGrpRoot.freeMsg() );
      for( int i = 0; i < bufsDisk.length; i++ ) {
        f.write( bufsDisk[ i ].freeMsg() );
View Full Code Here

Examples of de.sciss.io.Span

//        pos   = (clock + even) * DISKBUF_SIZE_HM - ((1 - even) * DISKBUF_PAD) + playOffset;
        pos    = nextClock * DISKBUF_SIZE_HM - ((1 - even) * DISKBUF_PAD) + playOffset;
        start  = Math.max( 0, pos );
        fill  = (int) (start - pos);
        bufOff  = even * DISKBUF_SIZE_H;
        bufSpans = t.foldSpans( new Span( start, pos + DISKBUF_SIZE_H ), MIN_LOOP_LEN );
checkSpans:    if( bufSpans.length == lastBufSpans[ even ].length ) {
          for( int j = 0; j < bufSpans.length; j++ ) {
            if( !bufSpans[ j ].equals( lastBufSpans[ even ][ j ])) break checkSpans;
          }
          continue;
View Full Code Here

Examples of de.sciss.io.Span

        if( fill > 0 ) {
          for( int i = 0; i < ct.bufsDisk.length; i++ ) {
            bndl.addPacket( ct.bufsDisk[ i ].fillMsg( 0, fill * ct.bufsDisk[ i ].getNumChannels(), 0.0f ));
          }
        }
        bufSpans = t.foldSpans( new Span( start, pos - DISKBUF_PAD + DISKBUF_SIZE ), MIN_LOOP_LEN );
        doc.getAudioTrail().addBufferReadMessages( bndl, bufSpans, ct.bufsDisk, fill );

if( DEBUG_FOLD ) {
  System.out.println( "------P "+ clock + ", X, " + playOffset + ", " + pos );
  for( int k = 0, m = fill; k < bufSpans.length; k++ ) {
View Full Code Here

Examples of de.sciss.io.Span

  public void clear( Object source )
  {
    getMap().clearValues( source );
    setRate( source, 1000 );
    setPosition( source, 0 );
    setSelectionSpan( source, new Span() );
    setVisibleSpan( source, new Span() );
    setLength( source, 0 );
  }
View Full Code Here

Examples of de.sciss.io.Span

   @see  TimelineEvent#SCROLLED
   */
     public void setVisibleSpan( Object source, Span span )
  {
     if( !java.awt.EventQueue.isDispatchThread() ) throw new IllegalMonitorStateException();
        this.visibleSpan = new Span( span );
    if( source != null ) dispatchScroll( source );
  }
View Full Code Here

Examples of de.sciss.io.Span

   @see  TimelineEvent#SELECTED
   */
    public void setSelectionSpan( Object source, Span span )
  {
    if( !java.awt.EventQueue.isDispatchThread() ) throw new IllegalMonitorStateException();
        this.selectionSpan = new Span( span );
        if( source != null ) dispatchSelection( source );
  }
View Full Code Here

Examples of de.sciss.io.Span

    if( keySet.contains( MAP_KEY_LENGTH )) {
      val    = e.getManager().getValue( MAP_KEY_LENGTH );
      if( val != null ) {
        length  = ((Number) val).longValue();
        dChange  = true;
        if( visibleSpan.isEmpty() && length > 0 ) setVisibleSpan( this, new Span( 0, length ));
      }
    }
    if( keySet.contains( MAP_KEY_POSITION )) {
      val    = e.getManager().getValue( MAP_KEY_POSITION );
      if( val != null ) {
View Full Code Here

Examples of de.sciss.io.Span

    try  {
      start  = Math.max( 0, Math.min( getLength(), ((Number) rom.msg.getArg( argIdx )).longValue() ));
      argIdx++;
      stop  = Math.max( start, Math.min( getLength(), ((Number) rom.msg.getArg( argIdx )).longValue() ));
      editSelect( this, new Span( start, stop ));
    }
    catch( IndexOutOfBoundsException e1 ) {
      OSCRoot.failedArgCount( rom );
    }
    catch( ClassCastException e1 ) {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.