Logo Search packages:      
Sourcecode: jacktrip version File versions  Download package

int JackAudioInterface::processCallback ( jack_nframes_t  nframes ) [private]

JACK process callback.

This is the function to be called to process audio. This function is of the type JackProcessCallback, which is defined as:
typedef int(* JackProcessCallback)(jack_nframes_t nframes, void *arg)
See http://jackaudio.org/files/docs/html/types_8h.html#4923142208a8e7dacf00ca7a10681d2b for more details

Todo:
Implement for more than one process plugin, now it just works propertely with one. do it chaining outputs to inputs in the buffers. May need a tempo buffer

Definition at line 448 of file JackAudioInterface.cpp.

References computeNetworkProcessFromNetwork(), computeNetworkProcessToNetwork(), mInBuffer, mInPorts, mInProcessBuffer, mNumInChans, mNumOutChans, mOutBuffer, mOutPorts, mOutProcessBuffer, and mProcessPlugins.

Referenced by wrapperProcessCallback().

{
  // Get input and output buffers from JACK
  //-------------------------------------------------------------------
  for (int i = 0; i < mNumInChans; i++) {
    // Input Ports are READ ONLY
    mInBuffer[i] = (sample_t*) jack_port_get_buffer(mInPorts[i], nframes);
  }
  for (int i = 0; i < mNumOutChans; i++) {
    // Output Ports are WRITABLE
    mOutBuffer[i] = (sample_t*) jack_port_get_buffer(mOutPorts[i], nframes);
  }
  //-------------------------------------------------------------------
  // TEST: Loopback
  // To test, uncomment and send audio to client input. The same audio
  // should come out as output in the first channel
  //memcpy (mOutBuffer[0], mInBuffer[0], sizeof(sample_t) * nframes);
  //memcpy (mOutBuffer[1], mInBuffer[1], sizeof(sample_t) * nframes);
  //-------------------------------------------------------------------

  // Allocate the Process Callback
  //-------------------------------------------------------------------
  // 1) First, process incoming packets
  // ----------------------------------
  computeNetworkProcessFromNetwork();


  // 2) Dynamically allocate ProcessPlugin processes
  // -----------------------------------------------
  // The processing will be done in order of allocation

  ///\todo Implement for more than one process plugin, now it just works propertely with one.
  /// do it chaining outputs to inputs in the buffers. May need a tempo buffer
  for (int i = 0; i < mNumInChans; i++) {
    std::memset(mInProcessBuffer[i], 0, sizeof(sample_t) * nframes);
    std::memcpy(mInProcessBuffer[i], mOutBuffer[i], sizeof(sample_t) * nframes);
  }
  for (int i = 0; i < mNumOutChans; i++) {
    std::memset(mOutProcessBuffer[i], 0, sizeof(sample_t) * nframes);
  }

  for (int i = 0; i < mProcessPlugins.size(); i++) {
    //mProcessPlugins[i]->compute(nframes, mOutBuffer.data(), mInBuffer.data());
    mProcessPlugins[i]->compute(nframes, mInProcessBuffer.data(), mOutProcessBuffer.data());
  }


  // 3) Finally, send packets to peer
  // --------------------------------
  computeNetworkProcessToNetwork();

  
  ///************PROTORYPE FOR CELT**************************
  ///********************************************************
  /*
  CELTMode* mode;
  int* error;
  mode = celt_mode_create(48000, 2, 64, error);
  */
  //celt_mode_create(48000, 2, 64, NULL);
  //unsigned char* compressed;
  //CELTEncoder* celtEncoder;
  //celt_encode_float(celtEncoder, mInBuffer, NULL, compressed, );
  
  ///********************************************************
  ///********************************************************



  return 0;
}

Here is the call graph for this function:

Here is the caller graph for this function:


Generated by  Doxygen 1.6.0   Back to index