Examples of OSCBundle


Examples of de.sciss.net.OSCBundle

 
    if( onOff != activeOutput ) {
      activeOutput = onOff;
      if( transport.isRunning() ) return;
     
      final OSCBundle bndl = new OSCBundle();
      bndl.addPacket( grpOutput.runMsg( activeOutput ));
      if( activeOutput ) {
        syncOutput.activate( bndl );
      } else {
        syncOutput.deactivate( bndl );
      }
View Full Code Here

Examples of de.sciss.net.OSCBundle

       
        ct = new Context( channelMaps, numInputChannels, oCfg.numChannels );

        final float      orient  = -oCfg.startAngle/360 * oCfg.numChannels;
        final SynthDef[]  defs;
        OSCBundle      bndl;

        defs = createOutputDefs( oCfg.numChannels );
        if( defs != null ) {
          bndl  = new OSCBundle();
          for( int i = 0; i < defs.length; i++ ) {
            bndl.addPacket( defs[ i ].recvMsg() );
          }
          if( !server.sync( bndl, TIMEOUT )) {
            printTimeOutMsg( "defs" );
          }
        }
       
        bndl  = new OSCBundle();
        for( int i = 0; i < ct.numFiles; i++ ) {
          bndl.addPacket( ct.bufsDisk[ i ].allocMsg() );
        }

        for( int ch = 0; ch < ct.numInChans; ch++ ) {
//          bndl.addPacket( ct.synthsPan[ ch ].newMsg( grpOutput, new String[] {
//            "i_aInBs",             "i_aOtBs",         "volume", "orient" }, new float[] {
//            ct.busInternal.getIndex() + ch, ct.busPan.getIndex(), volume,   orient  }, kAddToTail ));
          bndl.addPacket( ct.synthsPan[ ch ].newMsg( grpOutput, new String[] {
            "i_aInBs",             "i_aOtBs",         "orient" }, new float[] {
            ct.busInternal.getIndex() + ch, ct.busPan.getIndex(), orient  }, kAddToTail ));
          nw.register( ct.synthsPan[ ch ]);
        }
        for( int ch = 0; ch < oCfg.numChannels; ch++ ) {
//System.err.println( "routing ch " +(ch+1)+" from " + (ct.busPan.getIndex() + ch) + " to " + oCfg.mapping[ ch ]);
          if( oCfg.mapping[ ch ] < server.getOptions().getNumOutputBusChannels() ) {
            bndl.addPacket( ct.synthsRoute[ ch ].newMsg( grpOutput, new String[] {
              "i_aInBs",           "i_aOtBs"       }, new float[] {
              ct.busPan.getIndex() + ch, oCfg.mapping[ ch ]}, kAddToTail ));
            nw.register( ct.synthsRoute[ ch ]);
          }
        }
View Full Code Here

Examples of de.sciss.net.OSCBundle

    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 );
View Full Code Here

Examples of de.sciss.net.OSCBundle

      if( !server.isRunning() || (ct == null) ) return;
   
//      playOffset  = -1;
      try {
        trigResp.remove();
        final OSCBundle bndl = new OSCBundle();
        bndl.addPacket( grpInput.freeAllMsg() );
        if( !activeOutput ) {
          bndl.addPacket( grpOutput.runMsg( false ));
          syncOutput.deactivate( bndl );
        }
        if( !activeInput ) {
          syncInput.deactivate( bndl );
        }
View Full Code Here

Examples of de.sciss.net.OSCBundle

 
  // irgendwie noch nicht so 100% fertig, manchmal scheinen buffer updates
  // nicht korrekt (aktuell spielende buffer haelfte -> anschliessend alles ok)
  public void transportReadjust( Transport t, long readjusted, double rate )
  {
    final OSCBundle  bndl;
    Span[]      bufSpans;
    long      pos, start;
    int        even, nextClock, fill, bufOff, numCh;

//    pos = nextClock * DISKBUF_SIZE_HM - ((1 - even) * DISKBUF_PAD) + playOffset;
   
    playOffset = readjusted;
    // now refresh dem buffers to make sure they reflect the new loop!
      bndl    = new OSCBundle();
      for( int i = 0; i < 2; i++ ) {
        nextClock = clock + i;
        even  = nextClock & 1;
//        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;
        }
        if( fill > 0 ) {
          for( int j = 0; j < ct.bufsDisk.length; j++ ) {
            numCh = ct.bufsDisk[ j ].getNumChannels();
            bndl.addPacket( ct.bufsDisk[ j ].fillMsg( bufOff * numCh, fill * numCh, 0.0f ));
          }
        }
        doc.getAudioTrail().addBufferReadMessages( bndl, bufSpans, ct.bufsDisk, bufOff + fill );
     
if( DEBUG_FOLD ) {
  System.out.println( "------A " + nextClock + ", " + even + ", " + playOffset + ", " + pos );
  for( int k = 0, m = bufOff + fill; k < bufSpans.length; k++ ) {
    System.out.println( "i = " + k + "; " + bufSpans[ k ] + " -> " + m );
    m += bufSpans[ k ].getLength();
  }
}
        lastBufSpans[ even ] = bufSpans;
      }
      if( bndl.getPacketCount() > 0 ) {
//System.out.println();
        try {
          if( !server.sync( bndl, TIMEOUT )) {
            printTimeOutMsg( "readjust" );
          }
View Full Code Here

Examples of de.sciss.net.OSCBundle

    final float      realRate;
    final float      interpolation;
    final Span[]    bufSpans;
    final long      start;
    final int      fill;
    OSCBundle      bndl;

    realRate      = (float) (rate * srcFactor);
    interpolation    = realRate == 1.0f ? 1f : 3f;

//    synchronized( sync ) {
      if( !server.isRunning() ) return;
      if( ct == null ) {  // as of oct '05 may be null if lockmanager timeout in setOutputConfig occurs
//        if( !doc.bird.attemptShared( Session.DOOR_TRACKS, 250 )) {
//System.err.println( "OH NO!" );
//          return;
//        }
//        try {
        System.out.println( "transportPlay : rebuildSynths" );
          rebuildSynths();
          if( ct == null ) return;
//        }
//        finally {
//          doc.bird.releaseShared( Session.DOOR_TRACKS );
//        }
      }
     
//      if( !doc.bird.attemptShared( Session.DOOR_MTE, 500 )) return;
      try {
        bndl  = new OSCBundle();
        start  = Math.max( 0, pos - DISKBUF_PAD );
        fill  = (int) (start + DISKBUF_PAD - pos);
        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++ ) {
    System.out.println( "i = " + k + "; " + bufSpans[ k ] + " -> " + m );
    m += bufSpans[ k ].getLength();
  }
  System.out.println();
}
        lastBufSpans[ 0 ] = emptySpans;
        lastBufSpans[ 1 ] = emptySpans;
        if( !server.sync( bndl, TIMEOUT )) {
          printTimeOutMsg( "play" );
          return;
        }
      }
      catch( IOException e1 ) {
        printError( "transportPlay", e1 );
      }
//      finally {
//        doc.bird.releaseShared( Session.DOOR_MTE );
//      }
     
      bndl    = new OSCBundle();
      bndl.addPacket( grpInput.freeAllMsg() );
      ct.newInputSynths()// re-create synthsBufRd and synthPhasor
      for( int i = 0, off = 0; i < ct.numFiles; i++ ) {
        bndl.addPacket( ct.synthsBufRd[ i ].newMsg( grpInput, new String[] {
          "i_aInBf",                    "i_aOtBs",                       "i_aPhBs",            "i_intrp" }, new float[] {
          ct.bufsDisk[ i ].getBufNum(), ct.busInternal.getIndex() + off, busPhasor.getIndex(), interpolation }
        ));
        nw.register( ct.synthsBufRd[ i ]);
        off += ct.chanMaps[ i ].length;
      }
      if( ct.numFiles > 0 ) {
        bndl.addPacket( ct.synthPhasor.newMsg( grpInput, new String[] {
          "i_aInBf",            "rate",   "i_aPhBs"          }, new float[] {
          ct.bufsDisk[ 0 ].getBufNum(), realRate, busPhasor.getIndex() }));
        nw.register( ct.synthPhasor );
      }
      bndl.addPacket( grpOutput.runMsg( true ));

      playOffset  = pos;
      clock    = 0;
      try {
        trigResp.add();
View Full Code Here

Examples of de.sciss.net.OSCBundle

   
  public void sessionObjectMapChanged( SessionCollection.Event e )
  {
//    synchronized( sync ) {
      if( server.isRunning() && (ct != null) ) {
        OSCBundle bndl = null;
       
        if( e.setContains( AudioTrack.MAP_KEY_PANAZIMUTH ) ||
          e.setContains( AudioTrack.MAP_KEY_PANSPREAD )) {
         
          bndl = new OSCBundle();
          addChannelPanMessages( bndl );

        } else if( e.setContains( SessionObject.MAP_KEY_FLAGS )) {
          bndl = new OSCBundle();
          addChannelMuteMessages( bndl );
        }
        if( (bndl != null) && (bndl.getPacketCount() > 0) ) {
          try {
            server.sendBundle( bndl );
          }
          catch( IOException e1 ) {
            printError( "Set Channel Status", e1 );
View Full Code Here

Examples of de.sciss.net.OSCBundle

     
      busInternal.free();
      busPan.free();
//      busMeter.free();
     
      final OSCBundle bndl = new OSCBundle();
      for( int i = 0; i < bufsDisk.length; i++ ) bndl.addPacket( bufsDisk[ i ].freeMsg() );
      if( bufsAllocated ) {
        bufsAllocated = false;
        if( (bndl.getPacketCount() > 0) && server.isRunning() && !server.sync( bndl, TIMEOUT )) {
          printTimeOutMsg( "dispose" );
        }
      }
    }
View Full Code Here

Examples of de.sciss.net.OSCBundle

    if( mc == null ) return;
    if( mc.task != task ) {
      mc.task  = task;
      if( mc.server == server ) {
        final boolean weCreated = bndl == null;
        if( weCreated ) bndl = new OSCBundle();
        for( int j = 0; j < mc.synths.length; j++ ) {
          if( mc.synths[ j ] != null ) {
            bndl.addPacket( mc.synths[ j ].runMsg( task ));
          }
        }
View Full Code Here

Examples of de.sciss.net.OSCBundle

  }
 
  public void removeListener( PeakMeterView view )
  {
    final Client  mc;
    final OSCBundle    bndl;
   
    if( !EventQueue.isDispatchThread() ) throw new IllegalMonitorStateException();

    mc = (Client) mapClients.remove( view );
    if( mc == null ) return;
    collAllClients.remove( mc );
    if( collActiveClients.remove( mc )) {
      bndl = new OSCBundle();
      for( int i = 0; i < mc.synths.length; i++ ) {
        if( mc.synths[ i ] != null ) {
          bndl.addPacket( mc.synths[ i ].freeMsg() );
          mc.synths[ i ] = null;
        }
      }
      if( bndl.getPacketCount() > 0 ) {
        try {
          if( server.isRunning() ) server.sendBundle( bndl );
          resortClients();
        }
        catch( IOException 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.