git-svn-id: http://subversion.jackaudio.org/jack/jack2/trunk/jackmp@4356 0c269be4-1314-0410-8aa9-9f06e86f4224tags/1.9.8
@@ -143,35 +143,34 @@ namespace Jack | |||
fCapturePortList = new jack_port_t*[fAudioAdapter->GetInputs()]; | |||
fPlaybackPortList = new jack_port_t*[fAudioAdapter->GetOutputs()]; | |||
for (int i = 0; i < fAudioAdapter->GetInputs(); i++) | |||
{ | |||
for (int i = 0; i < fAudioAdapter->GetInputs(); i++) { | |||
sprintf(name, "capture_%d", i + 1); | |||
if ((fCapturePortList[i] = jack_port_register(fJackClient, name, JACK_DEFAULT_AUDIO_TYPE, JackPortIsOutput, 0)) == NULL) | |||
goto fail; | |||
} | |||
for (int i = 0; i < fAudioAdapter->GetOutputs(); i++) | |||
{ | |||
for (int i = 0; i < fAudioAdapter->GetOutputs(); i++) { | |||
sprintf(name, "playback_%d", i + 1); | |||
if ((fPlaybackPortList[i] = jack_port_register(fJackClient, name, JACK_DEFAULT_AUDIO_TYPE, JackPortIsInput, 0 )) == NULL) | |||
if ((fPlaybackPortList[i] = jack_port_register(fJackClient, name, JACK_DEFAULT_AUDIO_TYPE, JackPortIsInput, 0)) == NULL) | |||
goto fail; | |||
} | |||
//callbacks and activation | |||
if ( jack_set_process_callback ( fJackClient, Process, this ) < 0 ) | |||
if (jack_set_process_callback(fJackClient, Process, this) < 0) | |||
goto fail; | |||
if ( jack_set_buffer_size_callback ( fJackClient, BufferSize, this ) < 0 ) | |||
if (jack_set_buffer_size_callback(fJackClient, BufferSize, this) < 0) | |||
goto fail; | |||
if ( jack_set_sample_rate_callback ( fJackClient, SampleRate, this ) < 0 ) | |||
if (jack_set_sample_rate_callback(fJackClient, SampleRate, this) < 0) | |||
goto fail; | |||
if ( jack_activate ( fJackClient ) < 0 ) | |||
if (jack_activate(fJackClient) < 0) | |||
goto fail; | |||
if (fAutoConnect) | |||
ConnectPorts(); | |||
// Ring buffer are now allocated.. | |||
// Ring buffers are now allocated.. | |||
return fAudioAdapter->Open(); | |||
return 0; | |||
fail: | |||
FreePorts(); | |||
@@ -116,10 +116,10 @@ namespace Jack | |||
fSocket.SetPort(port); | |||
fSocket.SetAddress(fMulticastIP, port); | |||
// If not set, takes deafault | |||
// If not set, takes default | |||
fParams.fSendAudioChannels = (send_audio == -1) ? 2 : send_audio; | |||
// If not set, takes deafault | |||
// If not set, takes default | |||
fParams.fReturnAudioChannels = (return_audio == -1) ? 2 : return_audio; | |||
//set the audio adapter interface channel values | |||
@@ -135,14 +135,13 @@ namespace Jack | |||
{ | |||
jack_log("JackNetAdapter::~JackNetAdapter"); | |||
int port_index; | |||
if (fSoftCaptureBuffer) { | |||
for (port_index = 0; port_index < fCaptureChannels; port_index++) | |||
for (int port_index = 0; port_index < fCaptureChannels; port_index++) | |||
delete[] fSoftCaptureBuffer[port_index]; | |||
delete[] fSoftCaptureBuffer; | |||
} | |||
if (fSoftPlaybackBuffer) { | |||
for (port_index = 0; port_index < fPlaybackChannels; port_index++) | |||
for (int port_index = 0; port_index < fPlaybackChannels; port_index++) | |||
delete[] fSoftPlaybackBuffer[port_index]; | |||
delete[] fSoftPlaybackBuffer; | |||
} | |||
@@ -151,8 +150,6 @@ namespace Jack | |||
//open/close-------------------------------------------------------------------------- | |||
int JackNetAdapter::Open() | |||
{ | |||
jack_log("JackNetAdapter::Open"); | |||
jack_info("NetAdapter started in %s mode %s Master's transport sync.", | |||
(fParams.fSlaveSyncMode) ? "sync" : "async", (fParams.fTransportSync) ? "with" : "without"); | |||
@@ -212,8 +209,6 @@ namespace Jack | |||
{ | |||
jack_log("JackNetAdapter::Init"); | |||
int port_index; | |||
//init network connection | |||
if (!JackNetSlaveInterface::Init()) { | |||
jack_error("JackNetSlaveInterface::Init() error..."); | |||
@@ -229,8 +224,7 @@ namespace Jack | |||
//set buffers | |||
if (fCaptureChannels > 0) { | |||
fSoftCaptureBuffer = new sample_t*[fCaptureChannels]; | |||
for (port_index = 0; port_index < fCaptureChannels; port_index++) | |||
{ | |||
for (int port_index = 0; port_index < fCaptureChannels; port_index++) { | |||
fSoftCaptureBuffer[port_index] = new sample_t[fParams.fPeriodSize]; | |||
fNetAudioCaptureBuffer->SetBuffer(port_index, fSoftCaptureBuffer[port_index]); | |||
} | |||
@@ -238,8 +232,7 @@ namespace Jack | |||
if (fPlaybackChannels > 0) { | |||
fSoftPlaybackBuffer = new sample_t*[fPlaybackChannels]; | |||
for (port_index = 0; port_index < fPlaybackChannels; port_index++) | |||
{ | |||
for (int port_index = 0; port_index < fPlaybackChannels; port_index++) { | |||
fSoftPlaybackBuffer[port_index] = new sample_t[fParams.fPeriodSize]; | |||
fNetAudioPlaybackBuffer->SetBuffer(port_index, fSoftPlaybackBuffer[port_index]); | |||
} | |||
@@ -273,7 +266,7 @@ namespace Jack | |||
return false; | |||
} catch (JackNetException& e) { | |||
e.PrintMessage(); | |||
jack_info("NetAdapter is restarted."); | |||
jack_info("NetAdapter is restarted"); | |||
Reset(); | |||
fThread.DropSelfRealTime(); | |||
fThread.SetStatus(JackThread::kIniting); | |||
@@ -98,13 +98,13 @@ namespace Jack | |||
float audio_size = (fNetAudioCaptureBuffer) | |||
? fNetAudioCaptureBuffer->GetCycleSize() | |||
: (fNetAudioPlaybackBuffer) ? fNetAudioPlaybackBuffer->GetCycleSize() : 0; | |||
jack_log ("audio_size %f", audio_size); | |||
jack_log("audio_size %f", audio_size); | |||
//midi | |||
float midi_size = (fNetMidiCaptureBuffer) | |||
? fNetMidiCaptureBuffer->GetCycleSize() | |||
: (fNetMidiPlaybackBuffer) ? fNetMidiPlaybackBuffer->GetCycleSize() : 0; | |||
jack_log ("midi_size %f", midi_size); | |||
jack_log("midi_size %f", midi_size); | |||
//bufsize = sync + audio + midi | |||
int bufsize = MAX_LATENCY * (fParams.fMtu + (int)audio_size + (int) midi_size); | |||
@@ -837,7 +837,7 @@ namespace Jack | |||
} | |||
//set the new buffer sizes | |||
if ( SetNetBufferSize() == SOCKET_ERROR ) { | |||
if (SetNetBufferSize() == SOCKET_ERROR) { | |||
jack_error ( "Can't set net buffer sizes : %s", StrError ( NET_ERROR_CODE ) ); | |||
goto error; | |||
} | |||
@@ -812,7 +812,7 @@ extern "C" | |||
#if HAVE_CELT | |||
value.ui = 0U; | |||
jack_driver_descriptor_add_parameter(desc, &filler, "celt", 'c', JackDriverParamUInt, &value, NULL, "sets celt encoding and number of kbits per channel", NULL); | |||
jack_driver_descriptor_add_parameter(desc, &filler, "celt", 'c', JackDriverParamUInt, &value, NULL, "Set CELT encoding and number of kbits per channel", NULL); | |||
#endif | |||
value.ui = 0U; | |||
jack_driver_descriptor_add_parameter(desc, &filler, "bit-depth", 'b', JackDriverParamUInt, &value, NULL, "Sample bit-depth (0 for float, 8 for 8bit and 16 for 16bit)", NULL); | |||
@@ -821,19 +821,19 @@ extern "C" | |||
jack_driver_descriptor_add_parameter(desc, &filler, "transport-sync", 't', JackDriverParamBool, &value, NULL, "Whether to slave the transport to the master transport", NULL); | |||
value.ui = true; | |||
jack_driver_descriptor_add_parameter(desc, &filler, "autoconf", 'a', JackDriverParamBool, &value, NULL, "Whether to use Autoconfig, or just start.", NULL); | |||
jack_driver_descriptor_add_parameter(desc, &filler, "autoconf", 'a', JackDriverParamBool, &value, NULL, "Whether to use Autoconfig, or just start", NULL); | |||
value.ui = 1U; | |||
jack_driver_descriptor_add_parameter(desc, &filler, "redundancy", 'R', JackDriverParamUInt, &value, NULL, "Send packets N times", NULL); | |||
value.ui = false; | |||
jack_driver_descriptor_add_parameter(desc, &filler, "native-endian", 'e', JackDriverParamBool, &value, NULL, "Dont convert samples to network byte order.", NULL); | |||
jack_driver_descriptor_add_parameter(desc, &filler, "native-endian", 'e', JackDriverParamBool, &value, NULL, "Dont convert samples to network byte order", NULL); | |||
value.i = 0; | |||
jack_driver_descriptor_add_parameter(desc, &filler, "jitterval", 'J', JackDriverParamInt, &value, NULL, "attempted jitterbuffer microseconds on master", NULL); | |||
jack_driver_descriptor_add_parameter(desc, &filler, "jitterval", 'J', JackDriverParamInt, &value, NULL, "Attempted jitterbuffer microseconds on master", NULL); | |||
value.i = false; | |||
jack_driver_descriptor_add_parameter(desc, &filler, "always-deadline", 'D', JackDriverParamBool, &value, NULL, "always use deadline", NULL); | |||
jack_driver_descriptor_add_parameter(desc, &filler, "always-deadline", 'D', JackDriverParamBool, &value, NULL, "Always use deadline", NULL); | |||
return desc; | |||
} | |||
@@ -35,7 +35,7 @@ bool JackRestartThreadedDriver::Execute() | |||
return false; | |||
} catch (JackNetException& e) { | |||
e.PrintMessage(); | |||
jack_log("Driver is restarted"); | |||
jack_info("Driver is restarted"); | |||
fThread.DropSelfRealTime(); | |||
// Thread in kIniting status again... | |||
fThread.SetStatus(JackThread::kIniting); | |||