Examples of OSCBundle


Examples of com.illposed.osc.OSCBundle

   */
  private OSCBundle convertBundle() {
    // skip the "#bundle " stuff
    streamPosition = 8;
    Date timestamp = readTimeTag();
    OSCBundle bundle = new OSCBundle(timestamp);
    OSCByteArrayToJavaConverter myConverter
        = new OSCByteArrayToJavaConverter();
    while (streamPosition < bytesLength) {
      // recursively read through the stream and convert packets you find
      int packetLength = ((Integer) readInteger()).intValue();
      byte[] packetBytes = new byte[packetLength];
      for (int i = 0; i < packetLength; i++) {
        packetBytes[i] = bytes[streamPosition++];
      }
      OSCPacket packet = myConverter.convert(packetBytes, packetLength);
      bundle.addPacket(packet);
    }
    return bundle;
  }
View Full Code Here

Examples of com.illposed.osc.OSCBundle

    long time = newDate.getTime();
    Integer delayTime = Integer.valueOf(textBox4.getText());
    time = time + delayTime.longValue();
    newDate.setTime(time);

    OSCBundle bundle = new OSCBundle(packets, newDate);

    try {
      oscPort.send(bundle);
    } catch (Exception e) {
      showError("Couldn't send");
View Full Code Here

Examples of de.sciss.net.OSCBundle

      ct    = new Context( rCfg.numChannels, player.getInputBus() );
      chanOff  = server.getOptions().getNumOutputBusChannels();
     
      createDefs( rCfg.numChannels );

      final OSCBundle  bndl  = new OSCBundle( 0.0 );

      for( int ch = 0; ch < rCfg.numChannels; ch++ ) {
        bndl.addPacket( ct.synthsRoute[ ch ].newMsg( ct.grpRoot, new String[] {
          "i_aInBs",                  "i_aOtBs"       }, new float[] {
          rCfg.mapping[ ch ] + chanOff, ct.busInternal.getIndex() + ch }, kAddToHead ));
        nw.register( ct.synthsRoute[ ch ]);
//        bndl.addPacket( ct.synthsMeter[ ch ].newMsg( ct.grpRoot, new String[] {
//          "i_aInBus",             "i_kOutBus" }, new float[] {
View Full Code Here

Examples of de.sciss.net.OSCBundle

  {
    recLenTimer.stop();

    if( (server == null) || !server.isRunning() || (ct == null) ) return;
   
    final OSCBundle bndl = new OSCBundle();

    try {
      bndl.addPacket( ct.synthDiskOut.freeMsg() );
      bndl.addPacket( ct.bufDisk.closeMsg() );
      stopCommit  = commit;
      server.sendBundle( bndl );
      timeoutTimer.stop();
      timeoutTimer.setMessage( "Failed to stop recording synth" );
      timeoutTimer.setActions( new Action[] { actionStop, actionAbort, actionClose });
View Full Code Here

Examples of de.sciss.net.OSCBundle

  {
    raf    = new RandomAccessFile( f, mode );
    fch    = raf.getChannel();
    b    = ByteBuffer.allocate( OSCChannel.DEFAULTBUFSIZE );
    time  = 0.0;
    pending  = new OSCBundle( time );
  }
View Full Code Here

Examples of de.sciss.net.OSCBundle

 
  public void write( OSCPacket p )
  throws IOException
  {
    if( p instanceof OSCBundle ) {
      final OSCBundle bndl = (OSCBundle) p;
      if( bndl.getTimeTag() != pending.getTimeTag() ) {
        throw new IllegalArgumentException( "Bundles must have timetag corresponding to current time" );
      }
      flush();
      flush( bndl );
    } else if( p instanceof OSCMessage ) {
View Full Code Here

Examples of de.sciss.net.OSCBundle

  throws IOException
  {
    if( seconds < 0.0 ) throw new IllegalArgumentException( "Cannot step back in time" );
    flush();
    time   += seconds;
    pending  = new OSCBundle( time );
  }
View Full Code Here

Examples of de.sciss.net.OSCBundle

  throws IOException
  {
    if( time > seconds ) throw new IllegalArgumentException( "Cannot step back in time" );
    flush();
    time  = seconds;
    pending  = new OSCBundle( time );
  }
View Full Code Here

Examples of de.sciss.net.OSCBundle

          BasicWindowHandler.showErrorDialog( RecorderDialog.this, e1, getValue( NAME ).toString() );
          return;
        }
      }
     
      final OSCBundle    bndl  = new OSCBundle();
      final OSCMessage  msgWrite;
     
      try {
//        server.dumpOutgoingOSC( kDumpBoth );
        bndl.addPacket( ct.bufDisk.closeMsg() );
//        msgWrite = ct.bufDisk.writeMsg( ct.recFile.getAbsolutePath(), "aiff",
//                affp.getEncodingString(), 0, 0, true );
        msgWrite = ct.bufDisk.writeMsg( ct.recFile.getAbsolutePath(), "aiff",
                encodingString, 0, 0, true );
        bndl.addPacket( msgWrite );
        if( server.sendBundleSync( bndl, msgWrite.getName(), 4 )) {
          nw.register( ct.synthDiskOut );
         
//System.out.println( "HERE" );
//try { Thread.sleep( 3000 ); } catch( InterruptedException e1 ) { /* ... */ }
View Full Code Here

Examples of de.sciss.net.OSCBundle

    this.doc      = doc;

    final AudioTrail  at      = doc.getAudioTrail();
    final Runnable    runTrigger;
    final SynthDef[]  defs;
    OSCBundle      bndl;
   
    transport      = doc.getTransport();
    nw          = NodeWatcher.newFrom( server );
    numInputChannels  = at.getChannelNum();      // XXX sync?
    channelMaps      = at.getChannelMaps();
    sourceRate      = doc.timeline.getRate();    // XXX sync?
    serverRate      = server.getSampleRate();
   
    DISKBUF_SIZE    = (Math.max( 44100, (int) sourceRate ) + DISKBUF_PAD) << 1// buffer size in frames
    DISKBUF_SIZE_H    = DISKBUF_SIZE >> 1;
    DISKBUF_SIZE_HM    = DISKBUF_SIZE_H - DISKBUF_PAD;
   
    bndl        = new OSCBundle();
    grpRoot        = Group.basicNew( server );
    grpRoot.setName( "Root-" + doc.getName() );
    nw.register( grpRoot );
    bndl.addPacket( grpRoot.addToHeadMsg( server.getDefaultGroup() ));
    grpInput      = Group.basicNew( server );
    grpInput.setName( "Input" );
    nw.register( grpInput );
    bndl.addPacket( grpInput.addToTailMsg( grpRoot ));
    grpOutput      = Group.basicNew( server );
    grpOutput.setName( "Output" );
    nw.register( grpOutput );
    bndl.addPacket( grpOutput.addToTailMsg( grpRoot ));
    bndl.addPacket( grpOutput.runMsg( false ));
   
    server.sendBundle( bndl );
   
    busPhasor      = Bus.audio( server );

    runTrigger      = new Runnable() {
      public void run()
      {
        final OSCMessage    msg    = trigMsg;  // this way we synchronize the access
        final int        nodeID  = ((Number) msg.getArg( 0 )).intValue();
        final int        nextClock, fill, bufOff;
        final long        pos, start;
        final OSCBundle      bndl2;
        final int        even;
        final Span[]      bufSpans;
        int            numCh;

        try {
          clock    = ((Number) msg.getArg( 2 )).intValue();
//System.err.println( "clock = " + clock );
          nextClock  = clock + 1;
          even    = nextClock & 1; // == 0;
          bndl2    = new OSCBundle();

          if( (ct == null) || (ct.synthPhasor == null) || (nodeID != ct.synthPhasor.getNodeID()) ) return;
          if( trigNodeID == -1 ) return// transport not running anymore
            pos    = nextClock * DISKBUF_SIZE_HM - ((1 - even) * DISKBUF_PAD) + playOffset;
            start  = Math.max( 0, pos );
            fill  = (int) (start - pos);
            bufOff  = even * DISKBUF_SIZE_H;
            if( fill > 0 ) {
              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 );
for( int k = 0, m = bufOff + fill; k < bufSpans.length; k++ ) {
  System.out.println( "i = " + k + "; " + bufSpans[ k ] + " -> " + m );
    m += bufSpans[ k ].getLength();
  }
  System.out.println();
}
            if( !server.sync( bndl2, TIMEOUT )) {
              printTimeOutMsg( "bufUpdate" );
          }
        }
        catch( IOException e1 ) {
          printError( "Receive /tr", e1 );
        }
        catch( ClassCastException e2 ) {
          printError( "Receive /tr", e2 );
        }
      }
    };

    trigResp      = new OSCResponderNode( server, "/tr", new OSCListener() {
      public void messageReceived( OSCMessage msg, SocketAddress sender, long time )
      {
        final int  nodeID  = ((Number) msg.getArg( 0 )).intValue();
       
        if( nodeID == trigNodeID ) {
          trigMsg  = msg;
          EventQueue.invokeLater( runTrigger );
        }
      }
    });
   
    defs = createInputDefs( channelMaps );
    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" );
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.