@@ -141,7 +141,7 @@ int JackAudioDriver::Attach() | |||||
for (i = 0; i < fCaptureChannels; i++) { | for (i = 0; i < fCaptureChannels; i++) { | ||||
snprintf(alias, sizeof(alias) - 1, "%s:%s:out%d", fAliasName, fCaptureDriverName, i + 1); | snprintf(alias, sizeof(alias) - 1, "%s:%s:out%d", fAliasName, fCaptureDriverName, i + 1); | ||||
snprintf(name, sizeof(name) - 1, "%s:capture_%d", fClientControl.fName, i + 1); | snprintf(name, sizeof(name) - 1, "%s:capture_%d", fClientControl.fName, i + 1); | ||||
if ((port_index = fGraphManager->AllocatePort(fClientControl.fRefNum, name, JACK_DEFAULT_AUDIO_TYPE, CaptureDriverFlags, fEngineControl->fBufferSize)) == NO_PORT) { | |||||
if (fEngine->PortRegister(fClientControl.fRefNum, name, JACK_DEFAULT_AUDIO_TYPE, CaptureDriverFlags, fEngineControl->fBufferSize, &port_index) < 0) { | |||||
jack_error("driver: cannot register port for %s", name); | jack_error("driver: cannot register port for %s", name); | ||||
return -1; | return -1; | ||||
} | } | ||||
@@ -149,13 +149,12 @@ int JackAudioDriver::Attach() | |||||
port->SetAlias(alias); | port->SetAlias(alias); | ||||
fCapturePortList[i] = port_index; | fCapturePortList[i] = port_index; | ||||
jack_log("JackAudioDriver::Attach fCapturePortList[i] port_index = %ld", port_index); | jack_log("JackAudioDriver::Attach fCapturePortList[i] port_index = %ld", port_index); | ||||
fEngine->NotifyPortRegistration(port_index, true); | |||||
} | } | ||||
for (i = 0; i < fPlaybackChannels; i++) { | for (i = 0; i < fPlaybackChannels; i++) { | ||||
snprintf(alias, sizeof(alias) - 1, "%s:%s:in%d", fAliasName, fPlaybackDriverName, i + 1); | snprintf(alias, sizeof(alias) - 1, "%s:%s:in%d", fAliasName, fPlaybackDriverName, i + 1); | ||||
snprintf(name, sizeof(name) - 1, "%s:playback_%d", fClientControl.fName, i + 1); | snprintf(name, sizeof(name) - 1, "%s:playback_%d", fClientControl.fName, i + 1); | ||||
if ((port_index = fGraphManager->AllocatePort(fClientControl.fRefNum, name, JACK_DEFAULT_AUDIO_TYPE, PlaybackDriverFlags, fEngineControl->fBufferSize)) == NO_PORT) { | |||||
if (fEngine->PortRegister(fClientControl.fRefNum, name, JACK_DEFAULT_AUDIO_TYPE, PlaybackDriverFlags, fEngineControl->fBufferSize, &port_index) < 0) { | |||||
jack_error("driver: cannot register port for %s", name); | jack_error("driver: cannot register port for %s", name); | ||||
return -1; | return -1; | ||||
} | } | ||||
@@ -163,18 +162,16 @@ int JackAudioDriver::Attach() | |||||
port->SetAlias(alias); | port->SetAlias(alias); | ||||
fPlaybackPortList[i] = port_index; | fPlaybackPortList[i] = port_index; | ||||
jack_log("JackAudioDriver::Attach fPlaybackPortList[i] port_index = %ld", port_index); | jack_log("JackAudioDriver::Attach fPlaybackPortList[i] port_index = %ld", port_index); | ||||
fEngine->NotifyPortRegistration(port_index, true); | |||||
// Monitor ports | // Monitor ports | ||||
if (fWithMonitorPorts) { | if (fWithMonitorPorts) { | ||||
jack_log("Create monitor port"); | jack_log("Create monitor port"); | ||||
snprintf(name, sizeof(name) - 1, "%s:monitor_%u", fClientControl.fName, i + 1); | snprintf(name, sizeof(name) - 1, "%s:monitor_%u", fClientControl.fName, i + 1); | ||||
if ((port_index = fGraphManager->AllocatePort(fClientControl.fRefNum, name, JACK_DEFAULT_AUDIO_TYPE, JackPortIsOutput, fEngineControl->fBufferSize)) == NO_PORT) { | |||||
if (fEngine->PortRegister(fClientControl.fRefNum, name, JACK_DEFAULT_AUDIO_TYPE, JackPortIsOutput, fEngineControl->fBufferSize, &port_index) < 0) { | |||||
jack_error("Cannot register monitor port for %s", name); | jack_error("Cannot register monitor port for %s", name); | ||||
return -1; | return -1; | ||||
} else { | } else { | ||||
fMonitorPortList[i] = port_index; | fMonitorPortList[i] = port_index; | ||||
fEngine->NotifyPortRegistration(port_index, true); | |||||
} | } | ||||
} | } | ||||
} | } | ||||
@@ -189,16 +186,13 @@ int JackAudioDriver::Detach() | |||||
jack_log("JackAudioDriver::Detach"); | jack_log("JackAudioDriver::Detach"); | ||||
for (i = 0; i < fCaptureChannels; i++) { | for (i = 0; i < fCaptureChannels; i++) { | ||||
fGraphManager->ReleasePort(fClientControl.fRefNum, fCapturePortList[i]); | |||||
fEngine->NotifyPortRegistration(fCapturePortList[i], false); | |||||
fEngine->PortUnRegister(fClientControl.fRefNum, fCapturePortList[i]); | |||||
} | } | ||||
for (i = 0; i < fPlaybackChannels; i++) { | for (i = 0; i < fPlaybackChannels; i++) { | ||||
fGraphManager->ReleasePort(fClientControl.fRefNum, fPlaybackPortList[i]); | |||||
fEngine->NotifyPortRegistration(fPlaybackPortList[i], false); | |||||
fEngine->PortUnRegister(fClientControl.fRefNum, fPlaybackPortList[i]); | |||||
if (fWithMonitorPorts) { | if (fWithMonitorPorts) { | ||||
fGraphManager->ReleasePort(fClientControl.fRefNum, fMonitorPortList[i]); | |||||
fEngine->NotifyPortRegistration(fMonitorPortList[i], false); | |||||
fEngine->PortUnRegister(fClientControl.fRefNum, fMonitorPortList[i]); | |||||
} | } | ||||
} | } | ||||
@@ -804,7 +804,7 @@ int JackEngine::PortRegister(int refnum, const char* name, const char *type, uns | |||||
return -1; | return -1; | ||||
} | } | ||||
*port_index = fGraphManager->AllocatePort(refnum, name, type, (JackPortFlags)flags, fEngineControl->fBufferSize); | |||||
*port_index = fGraphManager->AllocatePort(refnum, name, type, (JackPortFlags)flags, buffer_size); | |||||
if (*port_index != NO_PORT) { | if (*port_index != NO_PORT) { | ||||
if (client->GetClientControl()->fActive) | if (client->GetClientControl()->fActive) | ||||
NotifyPortRegistation(*port_index, true); | NotifyPortRegistation(*port_index, true); | ||||
@@ -261,13 +261,7 @@ class SERVER_EXPORT JackLockedEngine | |||||
fEngine.NotifyGraphReorder(); | fEngine.NotifyGraphReorder(); | ||||
CATCH_EXCEPTION | CATCH_EXCEPTION | ||||
} | } | ||||
void NotifyPortRegistration(jack_port_id_t port_index, bool onoff) | |||||
{ | |||||
TRY_CALL | |||||
JackLock lock(&fEngine); | |||||
fEngine.NotifyPortRegistation(port_index, onoff); | |||||
CATCH_EXCEPTION | |||||
} | |||||
void NotifyBufferSize(jack_nframes_t buffer_size) | void NotifyBufferSize(jack_nframes_t buffer_size) | ||||
{ | { | ||||
TRY_CALL | TRY_CALL | ||||
@@ -67,7 +67,7 @@ int JackMidiDriver::Attach() | |||||
for (i = 0; i < fCaptureChannels; i++) { | for (i = 0; i < fCaptureChannels; i++) { | ||||
snprintf(alias, sizeof(alias) - 1, "%s:%s:out%d", fAliasName, fCaptureDriverName, i + 1); | snprintf(alias, sizeof(alias) - 1, "%s:%s:out%d", fAliasName, fCaptureDriverName, i + 1); | ||||
snprintf(name, sizeof(name) - 1, "%s:capture_%d", fClientControl.fName, i + 1); | snprintf(name, sizeof(name) - 1, "%s:capture_%d", fClientControl.fName, i + 1); | ||||
if ((port_index = fGraphManager->AllocatePort(fClientControl.fRefNum, name, JACK_DEFAULT_MIDI_TYPE, CaptureDriverFlags, fEngineControl->fBufferSize)) == NO_PORT) { | |||||
if (fEngine->PortRegister(fClientControl.fRefNum, name, JACK_DEFAULT_MIDI_TYPE, CaptureDriverFlags, fEngineControl->fBufferSize, &port_index) < 0) { | |||||
jack_error("driver: cannot register port for %s", name); | jack_error("driver: cannot register port for %s", name); | ||||
return -1; | return -1; | ||||
} | } | ||||
@@ -75,13 +75,12 @@ int JackMidiDriver::Attach() | |||||
port->SetAlias(alias); | port->SetAlias(alias); | ||||
fCapturePortList[i] = port_index; | fCapturePortList[i] = port_index; | ||||
jack_log("JackMidiDriver::Attach fCapturePortList[i] port_index = %ld", port_index); | jack_log("JackMidiDriver::Attach fCapturePortList[i] port_index = %ld", port_index); | ||||
fEngine->NotifyPortRegistration(port_index, true); | |||||
} | } | ||||
for (i = 0; i < fPlaybackChannels; i++) { | for (i = 0; i < fPlaybackChannels; i++) { | ||||
snprintf(alias, sizeof(alias) - 1, "%s:%s:in%d", fAliasName, fPlaybackDriverName, i + 1); | snprintf(alias, sizeof(alias) - 1, "%s:%s:in%d", fAliasName, fPlaybackDriverName, i + 1); | ||||
snprintf(name, sizeof(name) - 1, "%s:playback_%d", fClientControl.fName, i + 1); | snprintf(name, sizeof(name) - 1, "%s:playback_%d", fClientControl.fName, i + 1); | ||||
if ((port_index = fGraphManager->AllocatePort(fClientControl.fRefNum, name, JACK_DEFAULT_MIDI_TYPE, PlaybackDriverFlags, fEngineControl->fBufferSize)) == NO_PORT) { | |||||
if (fEngine->PortRegister(fClientControl.fRefNum, name, JACK_DEFAULT_MIDI_TYPE, PlaybackDriverFlags, fEngineControl->fBufferSize, &port_index) < 0) { | |||||
jack_error("driver: cannot register port for %s", name); | jack_error("driver: cannot register port for %s", name); | ||||
return -1; | return -1; | ||||
} | } | ||||
@@ -89,7 +88,6 @@ int JackMidiDriver::Attach() | |||||
port->SetAlias(alias); | port->SetAlias(alias); | ||||
fPlaybackPortList[i] = port_index; | fPlaybackPortList[i] = port_index; | ||||
jack_log("JackMidiDriver::Attach fPlaybackPortList[i] port_index = %ld", port_index); | jack_log("JackMidiDriver::Attach fPlaybackPortList[i] port_index = %ld", port_index); | ||||
fEngine->NotifyPortRegistration(port_index, true); | |||||
} | } | ||||
UpdateLatencies(); | UpdateLatencies(); | ||||
@@ -102,13 +100,11 @@ int JackMidiDriver::Detach() | |||||
jack_log("JackMidiDriver::Detach"); | jack_log("JackMidiDriver::Detach"); | ||||
for (i = 0; i < fCaptureChannels; i++) { | for (i = 0; i < fCaptureChannels; i++) { | ||||
fGraphManager->ReleasePort(fClientControl.fRefNum, fCapturePortList[i]); | |||||
fEngine->NotifyPortRegistration(fCapturePortList[i], false); | |||||
fEngine->PortUnRegister(fClientControl.fRefNum, fCapturePortList[i]); | |||||
} | } | ||||
for (i = 0; i < fPlaybackChannels; i++) { | for (i = 0; i < fPlaybackChannels; i++) { | ||||
fGraphManager->ReleasePort(fClientControl.fRefNum, fPlaybackPortList[i]); | |||||
fEngine->NotifyPortRegistration(fPlaybackPortList[i], false); | |||||
fEngine->PortUnRegister(fClientControl.fRefNum, fPlaybackPortList[i]); | |||||
} | } | ||||
return 0; | return 0; | ||||
@@ -19,9 +19,9 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | |||||
#include "JackNetDriver.h" | #include "JackNetDriver.h" | ||||
#include "JackEngineControl.h" | #include "JackEngineControl.h" | ||||
#include "JackLockedEngine.h" | |||||
#include "JackGraphManager.h" | #include "JackGraphManager.h" | ||||
#include "JackWaitThreadedDriver.h" | #include "JackWaitThreadedDriver.h" | ||||
#include "JackLockedEngine.h" | |||||
using namespace std; | using namespace std; | ||||
@@ -268,7 +268,7 @@ namespace Jack | |||||
jack_log("JackNetDriver::AllocPorts fBufferSize = %ld fSampleRate = %ld", fEngineControl->fBufferSize, fEngineControl->fSampleRate); | jack_log("JackNetDriver::AllocPorts fBufferSize = %ld fSampleRate = %ld", fEngineControl->fBufferSize, fEngineControl->fSampleRate); | ||||
JackPort* port; | JackPort* port; | ||||
jack_port_id_t port_id; | |||||
jack_port_id_t port_index; | |||||
char name[JACK_CLIENT_NAME_SIZE + JACK_PORT_NAME_SIZE]; | char name[JACK_CLIENT_NAME_SIZE + JACK_PORT_NAME_SIZE]; | ||||
char alias[JACK_CLIENT_NAME_SIZE + JACK_PORT_NAME_SIZE]; | char alias[JACK_CLIENT_NAME_SIZE + JACK_PORT_NAME_SIZE]; | ||||
unsigned long port_flags; | unsigned long port_flags; | ||||
@@ -282,33 +282,32 @@ namespace Jack | |||||
{ | { | ||||
snprintf(alias, sizeof(alias) - 1, "%s:%s:out%d", fAliasName, fCaptureDriverName, audio_port_index + 1); | snprintf(alias, sizeof(alias) - 1, "%s:%s:out%d", fAliasName, fCaptureDriverName, audio_port_index + 1); | ||||
snprintf(name, sizeof(name) - 1, "%s:capture_%d", fClientControl.fName, audio_port_index + 1); | snprintf(name, sizeof(name) - 1, "%s:capture_%d", fClientControl.fName, audio_port_index + 1); | ||||
if ((port_id = fGraphManager->AllocatePort(fClientControl.fRefNum, name, JACK_DEFAULT_AUDIO_TYPE, | |||||
static_cast<JackPortFlags>(port_flags), fEngineControl->fBufferSize)) == NO_PORT) | |||||
if (fEngine->PortRegister(fClientControl.fRefNum, name, JACK_DEFAULT_AUDIO_TYPE, | |||||
static_cast<JackPortFlags>(port_flags), fEngineControl->fBufferSize, &port_index) < 0) | |||||
{ | { | ||||
jack_error("driver: cannot register port for %s", name); | jack_error("driver: cannot register port for %s", name); | ||||
return -1; | return -1; | ||||
} | } | ||||
port = fGraphManager->GetPort(port_id); | |||||
port = fGraphManager->GetPort(port_index); | |||||
port->SetAlias(alias); | port->SetAlias(alias); | ||||
//port latency | //port latency | ||||
range.min = range.max = fEngineControl->fBufferSize; | range.min = range.max = fEngineControl->fBufferSize; | ||||
port->SetLatencyRange(JackCaptureLatency, &range); | port->SetLatencyRange(JackCaptureLatency, &range); | ||||
fCapturePortList[audio_port_index] = port_id; | |||||
jack_log("JackNetDriver::AllocPorts() fCapturePortList[%d] audio_port_index = %ld fPortLatency = %ld", audio_port_index, port_id, port->GetLatency()); | |||||
fEngine->NotifyPortRegistration(port_id, true); | |||||
fCapturePortList[audio_port_index] = port_index; | |||||
jack_log("JackNetDriver::AllocPorts() fCapturePortList[%d] audio_port_index = %ld fPortLatency = %ld", audio_port_index, port_index, port->GetLatency()); | |||||
} | } | ||||
port_flags = JackPortIsInput | JackPortIsPhysical | JackPortIsTerminal; | port_flags = JackPortIsInput | JackPortIsPhysical | JackPortIsTerminal; | ||||
for (audio_port_index = 0; audio_port_index < fPlaybackChannels; audio_port_index++) | for (audio_port_index = 0; audio_port_index < fPlaybackChannels; audio_port_index++) | ||||
{ | { | ||||
snprintf(alias, sizeof(alias) - 1, "%s:%s:in%d", fAliasName, fPlaybackDriverName, audio_port_index + 1); | snprintf(alias, sizeof(alias) - 1, "%s:%s:in%d", fAliasName, fPlaybackDriverName, audio_port_index + 1); | ||||
snprintf(name, sizeof(name) - 1, "%s:playback_%d",fClientControl.fName, audio_port_index + 1); | snprintf(name, sizeof(name) - 1, "%s:playback_%d",fClientControl.fName, audio_port_index + 1); | ||||
if ((port_id = fGraphManager->AllocatePort(fClientControl.fRefNum, name, JACK_DEFAULT_AUDIO_TYPE, | |||||
static_cast<JackPortFlags>(port_flags), fEngineControl->fBufferSize)) == NO_PORT) | |||||
if (fEngine->PortRegister(fClientControl.fRefNum, name, JACK_DEFAULT_AUDIO_TYPE, | |||||
static_cast<JackPortFlags>(port_flags), fEngineControl->fBufferSize, &port_index) < 0) | |||||
{ | { | ||||
jack_error("driver: cannot register port for %s", name); | jack_error("driver: cannot register port for %s", name); | ||||
return -1; | return -1; | ||||
} | } | ||||
port = fGraphManager->GetPort(port_id); | |||||
port = fGraphManager->GetPort(port_index); | |||||
port->SetAlias(alias); | port->SetAlias(alias); | ||||
//port latency | //port latency | ||||
switch (fParams.fNetworkMode) | switch (fParams.fNetworkMode) | ||||
@@ -324,9 +323,8 @@ namespace Jack | |||||
break; | break; | ||||
} | } | ||||
port->SetLatencyRange(JackPlaybackLatency, &range); | port->SetLatencyRange(JackPlaybackLatency, &range); | ||||
fPlaybackPortList[audio_port_index] = port_id; | |||||
jack_log("JackNetDriver::AllocPorts() fPlaybackPortList[%d] audio_port_index = %ld fPortLatency = %ld", audio_port_index, port_id, port->GetLatency()); | |||||
fEngine->NotifyPortRegistration(port_id, true); | |||||
fPlaybackPortList[audio_port_index] = port_index; | |||||
jack_log("JackNetDriver::AllocPorts() fPlaybackPortList[%d] audio_port_index = %ld fPortLatency = %ld", audio_port_index, port_index, port->GetLatency()); | |||||
} | } | ||||
//midi | //midi | ||||
port_flags = JackPortIsOutput | JackPortIsPhysical | JackPortIsTerminal; | port_flags = JackPortIsOutput | JackPortIsPhysical | JackPortIsTerminal; | ||||
@@ -334,19 +332,18 @@ namespace Jack | |||||
{ | { | ||||
snprintf(alias, sizeof(alias) - 1, "%s:%s:out%d", fAliasName, fCaptureDriverName, midi_port_index + 1); | snprintf(alias, sizeof(alias) - 1, "%s:%s:out%d", fAliasName, fCaptureDriverName, midi_port_index + 1); | ||||
snprintf(name, sizeof (name) - 1, "%s:midi_capture_%d", fClientControl.fName, midi_port_index + 1); | snprintf(name, sizeof (name) - 1, "%s:midi_capture_%d", fClientControl.fName, midi_port_index + 1); | ||||
if ((port_id = fGraphManager->AllocatePort(fClientControl.fRefNum, name, JACK_DEFAULT_MIDI_TYPE, | |||||
static_cast<JackPortFlags>(port_flags), fEngineControl->fBufferSize)) == NO_PORT) | |||||
if (fEngine->PortRegister(fClientControl.fRefNum, name, JACK_DEFAULT_MIDI_TYPE, | |||||
static_cast<JackPortFlags>(port_flags), fEngineControl->fBufferSize, &port_index) < 0) | |||||
{ | { | ||||
jack_error("driver: cannot register port for %s", name); | jack_error("driver: cannot register port for %s", name); | ||||
return -1; | return -1; | ||||
} | } | ||||
port = fGraphManager->GetPort(port_id); | |||||
port = fGraphManager->GetPort(port_index); | |||||
//port latency | //port latency | ||||
range.min = range.max = fEngineControl->fBufferSize; | range.min = range.max = fEngineControl->fBufferSize; | ||||
port->SetLatencyRange(JackCaptureLatency, &range); | port->SetLatencyRange(JackCaptureLatency, &range); | ||||
fMidiCapturePortList[midi_port_index] = port_id; | |||||
jack_log("JackNetDriver::AllocPorts() fMidiCapturePortList[%d] midi_port_index = %ld fPortLatency = %ld", midi_port_index, port_id, port->GetLatency()); | |||||
fEngine->NotifyPortRegistration(port_id, true); | |||||
fMidiCapturePortList[midi_port_index] = port_index; | |||||
jack_log("JackNetDriver::AllocPorts() fMidiCapturePortList[%d] midi_port_index = %ld fPortLatency = %ld", midi_port_index, port_index, port->GetLatency()); | |||||
} | } | ||||
port_flags = JackPortIsInput | JackPortIsPhysical | JackPortIsTerminal; | port_flags = JackPortIsInput | JackPortIsPhysical | JackPortIsTerminal; | ||||
@@ -354,13 +351,13 @@ namespace Jack | |||||
{ | { | ||||
snprintf(alias, sizeof(alias) - 1, "%s:%s:in%d", fAliasName, fPlaybackDriverName, midi_port_index + 1); | snprintf(alias, sizeof(alias) - 1, "%s:%s:in%d", fAliasName, fPlaybackDriverName, midi_port_index + 1); | ||||
snprintf(name, sizeof(name) - 1, "%s:midi_playback_%d", fClientControl.fName, midi_port_index + 1); | snprintf(name, sizeof(name) - 1, "%s:midi_playback_%d", fClientControl.fName, midi_port_index + 1); | ||||
if ((port_id = fGraphManager->AllocatePort(fClientControl.fRefNum, name, JACK_DEFAULT_MIDI_TYPE, | |||||
static_cast<JackPortFlags>(port_flags), fEngineControl->fBufferSize)) == NO_PORT) | |||||
if (fEngine->PortRegister(fClientControl.fRefNum, name, JACK_DEFAULT_MIDI_TYPE, | |||||
static_cast<JackPortFlags>(port_flags), fEngineControl->fBufferSize, &port_index) < 0) | |||||
{ | { | ||||
jack_error("driver: cannot register port for %s", name); | jack_error("driver: cannot register port for %s", name); | ||||
return -1; | return -1; | ||||
} | } | ||||
port = fGraphManager->GetPort(port_id); | |||||
port = fGraphManager->GetPort(port_index); | |||||
//port latency | //port latency | ||||
switch (fParams.fNetworkMode) | switch (fParams.fNetworkMode) | ||||
{ | { | ||||
@@ -375,9 +372,8 @@ namespace Jack | |||||
break; | break; | ||||
} | } | ||||
port->SetLatencyRange(JackPlaybackLatency, &range); | port->SetLatencyRange(JackPlaybackLatency, &range); | ||||
fMidiPlaybackPortList[midi_port_index] = port_id; | |||||
jack_log("JackNetDriver::AllocPorts() fMidiPlaybackPortList[%d] midi_port_index = %ld fPortLatency = %ld", midi_port_index, port_id, port->GetLatency()); | |||||
fEngine->NotifyPortRegistration(port_id, true); | |||||
fMidiPlaybackPortList[midi_port_index] = port_index; | |||||
jack_log("JackNetDriver::AllocPorts() fMidiPlaybackPortList[%d] midi_port_index = %ld fPortLatency = %ld", midi_port_index, port_index, port->GetLatency()); | |||||
} | } | ||||
return 0; | return 0; | ||||
@@ -389,16 +385,14 @@ namespace Jack | |||||
for (int audio_port_index = 0; audio_port_index < fCaptureChannels; audio_port_index++) { | for (int audio_port_index = 0; audio_port_index < fCaptureChannels; audio_port_index++) { | ||||
if (fCapturePortList[audio_port_index] > 0) { | if (fCapturePortList[audio_port_index] > 0) { | ||||
fGraphManager->ReleasePort(fClientControl.fRefNum, fCapturePortList[audio_port_index]); | |||||
fEngine->NotifyPortRegistration(fCapturePortList[audio_port_index], false); | |||||
fEngine->PortUnRegister(fClientControl.fRefNum, fCapturePortList[audio_port_index]); | |||||
fCapturePortList[audio_port_index] = 0; | fCapturePortList[audio_port_index] = 0; | ||||
} | } | ||||
} | } | ||||
for (int audio_port_index = 0; audio_port_index < fPlaybackChannels; audio_port_index++) { | for (int audio_port_index = 0; audio_port_index < fPlaybackChannels; audio_port_index++) { | ||||
if (fPlaybackPortList[audio_port_index] > 0) { | if (fPlaybackPortList[audio_port_index] > 0) { | ||||
fGraphManager->ReleasePort(fClientControl.fRefNum, fPlaybackPortList[audio_port_index]); | |||||
fEngine->NotifyPortRegistration(fPlaybackPortList[audio_port_index], false); | |||||
fEngine->PortUnRegister(fClientControl.fRefNum, fPlaybackPortList[audio_port_index]); | |||||
fPlaybackPortList[audio_port_index] = 0; | fPlaybackPortList[audio_port_index] = 0; | ||||
} | } | ||||
} | } | ||||
@@ -406,15 +400,13 @@ namespace Jack | |||||
for (int midi_port_index = 0; midi_port_index < fParams.fSendMidiChannels; midi_port_index++) { | for (int midi_port_index = 0; midi_port_index < fParams.fSendMidiChannels; midi_port_index++) { | ||||
if (fMidiCapturePortList && fMidiCapturePortList[midi_port_index] > 0) { | if (fMidiCapturePortList && fMidiCapturePortList[midi_port_index] > 0) { | ||||
fGraphManager->ReleasePort(fClientControl.fRefNum, fMidiCapturePortList[midi_port_index]); | fGraphManager->ReleasePort(fClientControl.fRefNum, fMidiCapturePortList[midi_port_index]); | ||||
fEngine->NotifyPortRegistration(fMidiCapturePortList[midi_port_index], false); | |||||
fMidiCapturePortList[midi_port_index] = 0; | fMidiCapturePortList[midi_port_index] = 0; | ||||
} | } | ||||
} | } | ||||
for (int midi_port_index = 0; midi_port_index < fParams.fReturnMidiChannels; midi_port_index++) { | for (int midi_port_index = 0; midi_port_index < fParams.fReturnMidiChannels; midi_port_index++) { | ||||
if (fMidiPlaybackPortList && fMidiPlaybackPortList[midi_port_index] > 0) { | if (fMidiPlaybackPortList && fMidiPlaybackPortList[midi_port_index] > 0) { | ||||
fGraphManager->ReleasePort(fClientControl.fRefNum, fMidiPlaybackPortList[midi_port_index]); | |||||
fEngine->NotifyPortRegistration(fMidiPlaybackPortList[midi_port_index], false); | |||||
fEngine->PortUnRegister(fClientControl.fRefNum, fMidiPlaybackPortList[midi_port_index]); | |||||
fMidiPlaybackPortList[midi_port_index] = 0; | fMidiPlaybackPortList[midi_port_index] = 0; | ||||
} | } | ||||
} | } | ||||
@@ -136,7 +136,7 @@ int JackNetOneDriver::Detach() | |||||
int JackNetOneDriver::AllocPorts() | int JackNetOneDriver::AllocPorts() | ||||
{ | { | ||||
jack_port_id_t port_id; | |||||
jack_port_id_t port_index; | |||||
char buf[64]; | char buf[64]; | ||||
unsigned int chn; | unsigned int chn; | ||||
@@ -146,16 +146,16 @@ int JackNetOneDriver::AllocPorts() | |||||
for (chn = 0; chn < netj.capture_channels_audio; chn++) { | for (chn = 0; chn < netj.capture_channels_audio; chn++) { | ||||
snprintf (buf, sizeof(buf) - 1, "system:capture_%u", chn + 1); | snprintf (buf, sizeof(buf) - 1, "system:capture_%u", chn + 1); | ||||
if ( ( port_id = fGraphManager->AllocatePort ( fClientControl.fRefNum, buf, JACK_DEFAULT_AUDIO_TYPE, | |||||
CaptureDriverFlags, fEngineControl->fBufferSize ) ) == NO_PORT ) { | |||||
if (fEngine->PortRegister(fClientControl.fRefNum, buf, JACK_DEFAULT_AUDIO_TYPE, | |||||
CaptureDriverFlags, fEngineControl->fBufferSize, &port_index) < 0) { | |||||
jack_error ( "driver: cannot register port for %s", buf ); | jack_error ( "driver: cannot register port for %s", buf ); | ||||
return -1; | return -1; | ||||
} | } | ||||
//port = fGraphManager->GetPort ( port_id ); | |||||
//port = fGraphManager->GetPort ( port_index ); | |||||
netj.capture_ports = jack_slist_append (netj.capture_ports, (void *)(intptr_t)port_id); | |||||
netj.capture_ports = jack_slist_append (netj.capture_ports, (void *)(intptr_t)port_index); | |||||
if( netj.bitdepth == CELT_MODE ) { | |||||
if (netj.bitdepth == CELT_MODE) { | |||||
#if HAVE_CELT | #if HAVE_CELT | ||||
#if HAVE_CELT_API_0_11 | #if HAVE_CELT_API_0_11 | ||||
celt_int32 lookahead; | celt_int32 lookahead; | ||||
@@ -178,34 +178,33 @@ int JackNetOneDriver::AllocPorts() | |||||
netj.capture_srcs = jack_slist_append(netj.capture_srcs, (void *)src_new(SRC_LINEAR, 1, NULL)); | netj.capture_srcs = jack_slist_append(netj.capture_srcs, (void *)src_new(SRC_LINEAR, 1, NULL)); | ||||
#endif | #endif | ||||
} | } | ||||
fEngine->NotifyPortRegistration(port_id, true); | |||||
} | } | ||||
for (chn = netj.capture_channels_audio; chn < netj.capture_channels; chn++) { | for (chn = netj.capture_channels_audio; chn < netj.capture_channels; chn++) { | ||||
snprintf (buf, sizeof(buf) - 1, "system:capture_%u", chn + 1); | snprintf (buf, sizeof(buf) - 1, "system:capture_%u", chn + 1); | ||||
if ( ( port_id = fGraphManager->AllocatePort ( fClientControl.fRefNum, buf, JACK_DEFAULT_MIDI_TYPE, | |||||
CaptureDriverFlags, fEngineControl->fBufferSize ) ) == NO_PORT ) { | |||||
if (fEngine->PortRegister(fClientControl.fRefNum, buf, JACK_DEFAULT_MIDI_TYPE, | |||||
CaptureDriverFlags, fEngineControl->fBufferSize, &port_index) < 0) { | |||||
jack_error ( "driver: cannot register port for %s", buf ); | jack_error ( "driver: cannot register port for %s", buf ); | ||||
return -1; | return -1; | ||||
} | } | ||||
//port = fGraphManager->GetPort ( port_id ); | |||||
//port = fGraphManager->GetPort ( port_index ); | |||||
netj.capture_ports = | netj.capture_ports = | ||||
jack_slist_append (netj.capture_ports, (void *)(intptr_t)port_id); | |||||
fEngine->NotifyPortRegistration(port_id, true); | |||||
jack_slist_append (netj.capture_ports, (void *)(intptr_t)port_index); | |||||
} | } | ||||
for (chn = 0; chn < netj.playback_channels_audio; chn++) { | for (chn = 0; chn < netj.playback_channels_audio; chn++) { | ||||
snprintf (buf, sizeof(buf) - 1, "system:playback_%u", chn + 1); | snprintf (buf, sizeof(buf) - 1, "system:playback_%u", chn + 1); | ||||
if ( ( port_id = fGraphManager->AllocatePort ( fClientControl.fRefNum, buf, JACK_DEFAULT_AUDIO_TYPE, | |||||
PlaybackDriverFlags, fEngineControl->fBufferSize ) ) == NO_PORT ) { | |||||
if (fEngine->PortRegister(fClientControl.fRefNum, buf, JACK_DEFAULT_AUDIO_TYPE, | |||||
PlaybackDriverFlags, fEngineControl->fBufferSize, &port_index) < 0) { | |||||
jack_error ( "driver: cannot register port for %s", buf ); | jack_error ( "driver: cannot register port for %s", buf ); | ||||
return -1; | return -1; | ||||
} | } | ||||
//port = fGraphManager->GetPort ( port_id ); | |||||
//port = fGraphManager->GetPort ( port_index ); | |||||
netj.playback_ports = jack_slist_append (netj.playback_ports, (void *)(intptr_t)port_id); | |||||
netj.playback_ports = jack_slist_append (netj.playback_ports, (void *)(intptr_t)port_index); | |||||
if( netj.bitdepth == CELT_MODE ) { | if( netj.bitdepth == CELT_MODE ) { | ||||
#if HAVE_CELT | #if HAVE_CELT | ||||
#if HAVE_CELT_API_0_11 | #if HAVE_CELT_API_0_11 | ||||
@@ -224,21 +223,19 @@ int JackNetOneDriver::AllocPorts() | |||||
netj.playback_srcs = jack_slist_append(netj.playback_srcs, (void *)src_new(SRC_LINEAR, 1, NULL)); | netj.playback_srcs = jack_slist_append(netj.playback_srcs, (void *)src_new(SRC_LINEAR, 1, NULL)); | ||||
#endif | #endif | ||||
} | } | ||||
fEngine->NotifyPortRegistration(port_id, true); | |||||
} | } | ||||
for (chn = netj.playback_channels_audio; chn < netj.playback_channels; chn++) { | for (chn = netj.playback_channels_audio; chn < netj.playback_channels; chn++) { | ||||
snprintf (buf, sizeof(buf) - 1, "system:playback_%u", chn + 1); | snprintf (buf, sizeof(buf) - 1, "system:playback_%u", chn + 1); | ||||
if ( ( port_id = fGraphManager->AllocatePort ( fClientControl.fRefNum, buf, JACK_DEFAULT_MIDI_TYPE, | |||||
PlaybackDriverFlags, fEngineControl->fBufferSize ) ) == NO_PORT ) { | |||||
if (fEngine->PortRegister(fClientControl.fRefNum, buf, JACK_DEFAULT_MIDI_TYPE, | |||||
PlaybackDriverFlags, fEngineControl->fBufferSize, &port_index) < 0) { | |||||
jack_error ( "driver: cannot register port for %s", buf ); | jack_error ( "driver: cannot register port for %s", buf ); | ||||
return -1; | return -1; | ||||
} | } | ||||
//port = fGraphManager->GetPort ( port_id ); | |||||
//port = fGraphManager->GetPort ( port_index ); | |||||
netj.playback_ports = | netj.playback_ports = | ||||
jack_slist_append (netj.playback_ports, (void *)(intptr_t)port_id); | |||||
fEngine->NotifyPortRegistration(port_id, true); | |||||
jack_slist_append (netj.playback_ports, (void *)(intptr_t)port_index); | |||||
} | } | ||||
return 0; | return 0; | ||||
} | } | ||||
@@ -440,22 +437,20 @@ JackNetOneDriver::FreePorts () | |||||
while( node != NULL ) { | while( node != NULL ) { | ||||
JSList *this_node = node; | JSList *this_node = node; | ||||
jack_port_id_t port_id = (jack_port_id_t)(intptr_t) node->data; | |||||
jack_port_id_t port_index = (jack_port_id_t)(intptr_t) node->data; | |||||
node = jack_slist_remove_link( node, this_node ); | node = jack_slist_remove_link( node, this_node ); | ||||
jack_slist_free_1( this_node ); | jack_slist_free_1( this_node ); | ||||
fGraphManager->ReleasePort( fClientControl.fRefNum, port_id ); | |||||
fEngine->NotifyPortRegistration(port_id, false); | |||||
fEngine->PortUnRegister(fClientControl.fRefNum, port_index); | |||||
} | } | ||||
netj.capture_ports = NULL; | netj.capture_ports = NULL; | ||||
node = netj.playback_ports; | node = netj.playback_ports; | ||||
while( node != NULL ) { | while( node != NULL ) { | ||||
JSList *this_node = node; | JSList *this_node = node; | ||||
jack_port_id_t port_id = (jack_port_id_t)(intptr_t) node->data; | |||||
jack_port_id_t port_index = (jack_port_id_t)(intptr_t) node->data; | |||||
node = jack_slist_remove_link( node, this_node ); | node = jack_slist_remove_link( node, this_node ); | ||||
jack_slist_free_1( this_node ); | jack_slist_free_1( this_node ); | ||||
fGraphManager->ReleasePort( fClientControl.fRefNum, port_id ); | |||||
fEngine->NotifyPortRegistration(port_id, false); | |||||
fEngine->PortUnRegister(fClientControl.fRefNum, port_index); | |||||
} | } | ||||
netj.playback_ports = NULL; | netj.playback_ports = NULL; | ||||
@@ -529,11 +524,11 @@ JackNetOneDriver::render_payload_to_jack_ports_float ( void *packet_payload, jac | |||||
#if HAVE_SAMPLERATE | #if HAVE_SAMPLERATE | ||||
SRC_DATA src; | SRC_DATA src; | ||||
#endif | #endif | ||||
jack_port_id_t port_id = (jack_port_id_t)(intptr_t) node->data; | |||||
JackPort *port = fGraphManager->GetPort( port_id ); | |||||
jack_port_id_t port_index = (jack_port_id_t)(intptr_t) node->data; | |||||
JackPort *port = fGraphManager->GetPort( port_index ); | |||||
jack_default_audio_sample_t* buf = | jack_default_audio_sample_t* buf = | ||||
(jack_default_audio_sample_t*)fGraphManager->GetBuffer(port_id, fEngineControl->fBufferSize); | |||||
(jack_default_audio_sample_t*)fGraphManager->GetBuffer(port_index, fEngineControl->fBufferSize); | |||||
const char *porttype = port->GetType(); | const char *porttype = port->GetType(); | ||||
@@ -601,11 +596,11 @@ JackNetOneDriver::render_jack_ports_to_payload_float (JSList *playback_ports, JS | |||||
#endif | #endif | ||||
unsigned int i; | unsigned int i; | ||||
int_float_t val; | int_float_t val; | ||||
jack_port_id_t port_id = (jack_port_id_t)(intptr_t) node->data; | |||||
JackPort *port = fGraphManager->GetPort( port_id ); | |||||
jack_port_id_t port_index = (jack_port_id_t)(intptr_t) node->data; | |||||
JackPort *port = fGraphManager->GetPort( port_index ); | |||||
jack_default_audio_sample_t* buf = | jack_default_audio_sample_t* buf = | ||||
(jack_default_audio_sample_t*)fGraphManager->GetBuffer(port_id, fEngineControl->fBufferSize); | |||||
(jack_default_audio_sample_t*)fGraphManager->GetBuffer(port_index, fEngineControl->fBufferSize); | |||||
const char *porttype = port->GetType(); | const char *porttype = port->GetType(); | ||||
@@ -668,11 +663,11 @@ JackNetOneDriver::render_payload_to_jack_ports_celt (void *packet_payload, jack_ | |||||
unsigned char *packet_bufX = (unsigned char *)packet_payload; | unsigned char *packet_bufX = (unsigned char *)packet_payload; | ||||
while (node != NULL) { | while (node != NULL) { | ||||
jack_port_id_t port_id = (jack_port_id_t) (intptr_t)node->data; | |||||
JackPort *port = fGraphManager->GetPort( port_id ); | |||||
jack_port_id_t port_index = (jack_port_id_t) (intptr_t)node->data; | |||||
JackPort *port = fGraphManager->GetPort( port_index ); | |||||
jack_default_audio_sample_t* buf = | jack_default_audio_sample_t* buf = | ||||
(jack_default_audio_sample_t*)fGraphManager->GetBuffer(port_id, fEngineControl->fBufferSize); | |||||
(jack_default_audio_sample_t*)fGraphManager->GetBuffer(port_index, fEngineControl->fBufferSize); | |||||
const char *portname = port->GetType(); | const char *portname = port->GetType(); | ||||
@@ -717,11 +712,11 @@ JackNetOneDriver::render_jack_ports_to_payload_celt (JSList *playback_ports, JSL | |||||
unsigned char *packet_bufX = (unsigned char *)packet_payload; | unsigned char *packet_bufX = (unsigned char *)packet_payload; | ||||
while (node != NULL) { | while (node != NULL) { | ||||
jack_port_id_t port_id = (jack_port_id_t) (intptr_t) node->data; | |||||
JackPort *port = fGraphManager->GetPort( port_id ); | |||||
jack_port_id_t port_index = (jack_port_id_t) (intptr_t) node->data; | |||||
JackPort *port = fGraphManager->GetPort( port_index ); | |||||
jack_default_audio_sample_t* buf = | jack_default_audio_sample_t* buf = | ||||
(jack_default_audio_sample_t*)fGraphManager->GetBuffer(port_id, fEngineControl->fBufferSize); | |||||
(jack_default_audio_sample_t*)fGraphManager->GetBuffer(port_index, fEngineControl->fBufferSize); | |||||
const char *portname = port->GetType(); | const char *portname = port->GetType(); | ||||
@@ -116,7 +116,7 @@ int JackAlsaDriver::Attach() | |||||
for (int i = 0; i < fCaptureChannels; i++) { | for (int i = 0; i < fCaptureChannels; i++) { | ||||
snprintf(alias, sizeof(alias) - 1, "%s:%s:out%d", fAliasName, fCaptureDriverName, i + 1); | snprintf(alias, sizeof(alias) - 1, "%s:%s:out%d", fAliasName, fCaptureDriverName, i + 1); | ||||
snprintf(name, sizeof(name) - 1, "%s:capture_%d", fClientControl.fName, i + 1); | snprintf(name, sizeof(name) - 1, "%s:capture_%d", fClientControl.fName, i + 1); | ||||
if ((port_index = fGraphManager->AllocatePort(fClientControl.fRefNum, name, JACK_DEFAULT_AUDIO_TYPE, (JackPortFlags)port_flags, fEngineControl->fBufferSize)) == NO_PORT) { | |||||
if if (fEngine->PortRegister(fClientControl.fRefNum, name, JACK_DEFAULT_AUDIO_TYPE, (JackPortFlags)port_flags, fEngineControl->fBufferSize, &port_index) < 0) { | |||||
jack_error("driver: cannot register port for %s", name); | jack_error("driver: cannot register port for %s", name); | ||||
return -1; | return -1; | ||||
} | } | ||||
@@ -124,7 +124,6 @@ int JackAlsaDriver::Attach() | |||||
port->SetAlias(alias); | port->SetAlias(alias); | ||||
fCapturePortList[i] = port_index; | fCapturePortList[i] = port_index; | ||||
jack_log("JackAlsaDriver::Attach fCapturePortList[i] %ld ", port_index); | jack_log("JackAlsaDriver::Attach fCapturePortList[i] %ld ", port_index); | ||||
fEngine->NotifyPortRegistration(port_index, true); | |||||
} | } | ||||
port_flags = (unsigned long)PlaybackDriverFlags; | port_flags = (unsigned long)PlaybackDriverFlags; | ||||
@@ -132,7 +131,7 @@ int JackAlsaDriver::Attach() | |||||
for (int i = 0; i < fPlaybackChannels; i++) { | for (int i = 0; i < fPlaybackChannels; i++) { | ||||
snprintf(alias, sizeof(alias) - 1, "%s:%s:in%d", fAliasName, fPlaybackDriverName, i + 1); | snprintf(alias, sizeof(alias) - 1, "%s:%s:in%d", fAliasName, fPlaybackDriverName, i + 1); | ||||
snprintf(name, sizeof(name) - 1, "%s:playback_%d", fClientControl.fName, i + 1); | snprintf(name, sizeof(name) - 1, "%s:playback_%d", fClientControl.fName, i + 1); | ||||
if ((port_index = fGraphManager->AllocatePort(fClientControl.fRefNum, name, JACK_DEFAULT_AUDIO_TYPE, (JackPortFlags)port_flags, fEngineControl->fBufferSize)) == NO_PORT) { | |||||
if (fEngine->PortRegister(fClientControl.fRefNum, name, JACK_DEFAULT_AUDIO_TYPE, (JackPortFlags)port_flags, fEngineControl->fBufferSize, &port_index) < 0) { | |||||
jack_error("driver: cannot register port for %s", name); | jack_error("driver: cannot register port for %s", name); | ||||
return -1; | return -1; | ||||
} | } | ||||
@@ -140,17 +139,15 @@ int JackAlsaDriver::Attach() | |||||
port->SetAlias(alias); | port->SetAlias(alias); | ||||
fPlaybackPortList[i] = port_index; | fPlaybackPortList[i] = port_index; | ||||
jack_log("JackAlsaDriver::Attach fPlaybackPortList[i] %ld ", port_index); | jack_log("JackAlsaDriver::Attach fPlaybackPortList[i] %ld ", port_index); | ||||
fEngine->NotifyPortRegistration(port_index, true); | |||||
// Monitor ports | // Monitor ports | ||||
if (fWithMonitorPorts) { | if (fWithMonitorPorts) { | ||||
jack_log("Create monitor port"); | jack_log("Create monitor port"); | ||||
snprintf(name, sizeof(name) - 1, "%s:monitor_%d", fClientControl.fName, i + 1); | snprintf(name, sizeof(name) - 1, "%s:monitor_%d", fClientControl.fName, i + 1); | ||||
if ((port_index = fGraphManager->AllocatePort(fClientControl.fRefNum, name, JACK_DEFAULT_AUDIO_TYPE, MonitorDriverFlags, fEngineControl->fBufferSize)) == NO_PORT) { | |||||
jack_error ("ALSA: cannot register monitor port for %s", name); | |||||
if (fEngine->PortRegister(fClientControl.fRefNum, name, JACK_DEFAULT_AUDIO_TYPE, MonitorDriverFlags, fEngineControl->fBufferSize, &port_index) < 0) { | |||||
jack_error("ALSA: cannot register monitor port for %s", name); | |||||
} else { | } else { | ||||
fMonitorPortList[i] = port_index; | fMonitorPortList[i] = port_index; | ||||
fEngine->NotifyPortRegistration(port_index, true); | |||||
} | } | ||||
} | } | ||||
} | } | ||||
@@ -68,9 +68,9 @@ JackALSARawMidiDriver::Attach() | |||||
for (int i = 0; i < fCaptureChannels; i++) { | for (int i = 0; i < fCaptureChannels; i++) { | ||||
JackALSARawMidiInputPort *input_port = input_ports[i]; | JackALSARawMidiInputPort *input_port = input_ports[i]; | ||||
name = input_port->GetName(); | name = input_port->GetName(); | ||||
index = fGraphManager->AllocatePort(fClientControl.fRefNum, name, | |||||
JACK_DEFAULT_MIDI_TYPE, | |||||
CaptureDriverFlags, buffer_size); | |||||
fEngine->PortRegister(fClientControl.fRefNum, name, | |||||
JACK_DEFAULT_MIDI_TYPE, | |||||
CaptureDriverFlags, buffer_size, &index); | |||||
if (index == NO_PORT) { | if (index == NO_PORT) { | ||||
jack_error("JackALSARawMidiDriver::Attach - cannot register input " | jack_error("JackALSARawMidiDriver::Attach - cannot register input " | ||||
"port with name '%s'.", name); | "port with name '%s'.", name); | ||||
@@ -85,8 +85,6 @@ JackALSARawMidiDriver::Attach() | |||||
jack_info("JackALSARawMidiDriver::Attach - input port registered " | jack_info("JackALSARawMidiDriver::Attach - input port registered " | ||||
"(name='%s', alias='%s').", name, alias); | "(name='%s', alias='%s').", name, alias); | ||||
fEngine->NotifyPortRegistration(index, true); | |||||
} | } | ||||
if (! fEngineControl->fSyncMode) { | if (! fEngineControl->fSyncMode) { | ||||
latency += buffer_size; | latency += buffer_size; | ||||
@@ -96,9 +94,9 @@ JackALSARawMidiDriver::Attach() | |||||
for (int i = 0; i < fPlaybackChannels; i++) { | for (int i = 0; i < fPlaybackChannels; i++) { | ||||
JackALSARawMidiOutputPort *output_port = output_ports[i]; | JackALSARawMidiOutputPort *output_port = output_ports[i]; | ||||
name = output_port->GetName(); | name = output_port->GetName(); | ||||
index = fGraphManager->AllocatePort(fClientControl.fRefNum, name, | |||||
JACK_DEFAULT_MIDI_TYPE, | |||||
PlaybackDriverFlags, buffer_size); | |||||
fEngine->PortRegister(fClientControl.fRefNum, name, | |||||
JACK_DEFAULT_MIDI_TYPE, | |||||
PlaybackDriverFlags, buffer_size, &index); | |||||
if (index == NO_PORT) { | if (index == NO_PORT) { | ||||
jack_error("JackALSARawMidiDriver::Attach - cannot register " | jack_error("JackALSARawMidiDriver::Attach - cannot register " | ||||
"output port with name '%s'.", name); | "output port with name '%s'.", name); | ||||
@@ -113,8 +111,6 @@ JackALSARawMidiDriver::Attach() | |||||
jack_info("JackALSARawMidiDriver::Attach - output port registered " | jack_info("JackALSARawMidiDriver::Attach - output port registered " | ||||
"(name='%s', alias='%s').", name, alias); | "(name='%s', alias='%s').", name, alias); | ||||
fEngine->NotifyPortRegistration(index, true); | |||||
} | } | ||||
return 0; | return 0; | ||||
} | } | ||||
@@ -158,7 +154,7 @@ JackALSARawMidiDriver::Execute() | |||||
// called. This means that the amount of time that passes between | // called. This means that the amount of time that passes between | ||||
// 'GetMicroSeconds()' and 'ppoll()' is time that will be lost | // 'GetMicroSeconds()' and 'ppoll()' is time that will be lost | ||||
// while waiting for 'poll() to timeout. | // while waiting for 'poll() to timeout. | ||||
// | |||||
// | |||||
// I tried to replace the timeout with a 'timerfd' with absolute | // I tried to replace the timeout with a 'timerfd' with absolute | ||||
// times, but, strangely, it actually slowed things down, and made | // times, but, strangely, it actually slowed things down, and made | ||||
// the code a lot more complicated. | // the code a lot more complicated. | ||||
@@ -420,10 +420,10 @@ int JackFFADODriver::Attach() | |||||
if (driver->capture_channels[chn].stream_type == ffado_stream_type_audio) { | if (driver->capture_channels[chn].stream_type == ffado_stream_type_audio) { | ||||
snprintf(buf, sizeof(buf) - 1, "firewire_pcm:%s_in", portname); | snprintf(buf, sizeof(buf) - 1, "firewire_pcm:%s_in", portname); | ||||
printMessage ("Registering audio capture port %s", buf); | printMessage ("Registering audio capture port %s", buf); | ||||
if ((port_index = fGraphManager->AllocatePort(fClientControl.fRefNum, buf, | |||||
if (fEngine->PortRegister(fClientControl.fRefNum, buf, | |||||
JACK_DEFAULT_AUDIO_TYPE, | JACK_DEFAULT_AUDIO_TYPE, | ||||
CaptureDriverFlags, | CaptureDriverFlags, | ||||
fEngineControl->fBufferSize)) == NO_PORT) { | |||||
fEngineControl->fBufferSize, &port_index) < 0) { | |||||
jack_error("driver: cannot register port for %s", buf); | jack_error("driver: cannot register port for %s", buf); | ||||
return -1; | return -1; | ||||
} | } | ||||
@@ -444,15 +444,13 @@ int JackFFADODriver::Attach() | |||||
jack_log("JackFFADODriver::Attach fCapturePortList[i] %ld ", port_index); | jack_log("JackFFADODriver::Attach fCapturePortList[i] %ld ", port_index); | ||||
fCaptureChannels++; | fCaptureChannels++; | ||||
fEngine->NotifyPortRegistration(port_index, true); | |||||
} else if (driver->capture_channels[chn].stream_type == ffado_stream_type_midi) { | } else if (driver->capture_channels[chn].stream_type == ffado_stream_type_midi) { | ||||
snprintf(buf, sizeof(buf) - 1, "firewire_pcm:%s_in", portname); | snprintf(buf, sizeof(buf) - 1, "firewire_pcm:%s_in", portname); | ||||
printMessage ("Registering midi capture port %s", buf); | printMessage ("Registering midi capture port %s", buf); | ||||
if ((port_index = fGraphManager->AllocatePort(fClientControl.fRefNum, buf, | |||||
if (fEngine->PortRegister(fClientControl.fRefNum, buf, | |||||
JACK_DEFAULT_MIDI_TYPE, | JACK_DEFAULT_MIDI_TYPE, | ||||
CaptureDriverFlags, | CaptureDriverFlags, | ||||
fEngineControl->fBufferSize)) == NO_PORT) { | |||||
fEngineControl->fBufferSize, &port_index) < 0) { | |||||
jack_error("driver: cannot register port for %s", buf); | jack_error("driver: cannot register port for %s", buf); | ||||
return -1; | return -1; | ||||
} | } | ||||
@@ -476,8 +474,6 @@ int JackFFADODriver::Attach() | |||||
jack_log("JackFFADODriver::Attach fCapturePortList[i] %ld ", port_index); | jack_log("JackFFADODriver::Attach fCapturePortList[i] %ld ", port_index); | ||||
fCaptureChannels++; | fCaptureChannels++; | ||||
fEngine->NotifyPortRegistration(port_index, true); | |||||
} else { | } else { | ||||
printMessage ("Don't register capture port %s", portname); | printMessage ("Don't register capture port %s", portname); | ||||
} | } | ||||
@@ -731,10 +731,10 @@ int JackFreebobDriver::Attach() | |||||
} else { | } else { | ||||
printMessage ("Registering capture port %s", buf); | printMessage ("Registering capture port %s", buf); | ||||
if ((port_index = fGraphManager->AllocatePort(fClientControl.fRefNum, buf, | |||||
if (fEngine->PortRegister(fClientControl.fRefNum, buf, | |||||
JACK_DEFAULT_AUDIO_TYPE, | JACK_DEFAULT_AUDIO_TYPE, | ||||
CaptureDriverFlags, | CaptureDriverFlags, | ||||
fEngineControl->fBufferSize)) == NO_PORT) { | |||||
fEngineControl->fBufferSize, &port_index) < 0) { | |||||
jack_error("driver: cannot register port for %s", buf); | jack_error("driver: cannot register port for %s", buf); | ||||
return -1; | return -1; | ||||
} | } | ||||
@@ -744,8 +744,6 @@ int JackFreebobDriver::Attach() | |||||
fCapturePortList[i] = port_index; | fCapturePortList[i] = port_index; | ||||
jack_log("JackFreebobDriver::Attach fCapturePortList[i] %ld ", port_index); | jack_log("JackFreebobDriver::Attach fCapturePortList[i] %ld ", port_index); | ||||
driver->capture_nchannels_audio++; | driver->capture_nchannels_audio++; | ||||
fEngine->NotifyPortRegistration(port_index, true); | |||||
} | } | ||||
} | } | ||||
@@ -762,10 +760,10 @@ int JackFreebobDriver::Attach() | |||||
printMessage ("Don't register playback port %s", buf); | printMessage ("Don't register playback port %s", buf); | ||||
} else { | } else { | ||||
printMessage ("Registering playback port %s", buf); | printMessage ("Registering playback port %s", buf); | ||||
if ((port_index = fGraphManager->AllocatePort(fClientControl.fRefNum, buf, | |||||
if (fEngine->PortRegister(fClientControl.fRefNum, buf, | |||||
JACK_DEFAULT_AUDIO_TYPE, | JACK_DEFAULT_AUDIO_TYPE, | ||||
PlaybackDriverFlags, | PlaybackDriverFlags, | ||||
fEngineControl->fBufferSize)) == NO_PORT) { | |||||
fEngineControl->fBufferSize, &port_index) < 0) { | |||||
jack_error("driver: cannot register port for %s", buf); | jack_error("driver: cannot register port for %s", buf); | ||||
return -1; | return -1; | ||||
} | } | ||||
@@ -776,8 +774,6 @@ int JackFreebobDriver::Attach() | |||||
fPlaybackPortList[i] = port_index; | fPlaybackPortList[i] = port_index; | ||||
jack_log("JackFreebobDriver::Attach fPlaybackPortList[i] %ld ", port_index); | jack_log("JackFreebobDriver::Attach fPlaybackPortList[i] %ld ", port_index); | ||||
driver->playback_nchannels_audio++; | driver->playback_nchannels_audio++; | ||||
fEngine->NotifyPortRegistration(port_index, true); | |||||
} | } | ||||
} | } | ||||
@@ -1643,7 +1643,7 @@ int JackCoreAudioDriver::Attach() | |||||
snprintf(name, sizeof(name) - 1, "%s:capture_%d", fClientControl.fName, i + 1); | snprintf(name, sizeof(name) - 1, "%s:capture_%d", fClientControl.fName, i + 1); | ||||
if ((port_index = fGraphManager->AllocatePort(fClientControl.fRefNum, name, JACK_DEFAULT_AUDIO_TYPE, CaptureDriverFlags, fEngineControl->fBufferSize)) == NO_PORT) { | |||||
if (fEngine->PortRegister(fClientControl.fRefNum, name, JACK_DEFAULT_AUDIO_TYPE, CaptureDriverFlags, fEngineControl->fBufferSize, &port_index) < 0) { | |||||
jack_error("Cannot register port for %s", name); | jack_error("Cannot register port for %s", name); | ||||
return -1; | return -1; | ||||
} | } | ||||
@@ -1651,7 +1651,6 @@ int JackCoreAudioDriver::Attach() | |||||
port = fGraphManager->GetPort(port_index); | port = fGraphManager->GetPort(port_index); | ||||
port->SetAlias(alias); | port->SetAlias(alias); | ||||
fCapturePortList[i] = port_index; | fCapturePortList[i] = port_index; | ||||
fEngine->NotifyPortRegistration(port_index, true); | |||||
} | } | ||||
for (int i = 0; i < fPlaybackChannels; i++) { | for (int i = 0; i < fPlaybackChannels; i++) { | ||||
@@ -1670,7 +1669,7 @@ int JackCoreAudioDriver::Attach() | |||||
snprintf(name, sizeof(name) - 1, "%s:playback_%d", fClientControl.fName, i + 1); | snprintf(name, sizeof(name) - 1, "%s:playback_%d", fClientControl.fName, i + 1); | ||||
if ((port_index = fGraphManager->AllocatePort(fClientControl.fRefNum, name, JACK_DEFAULT_AUDIO_TYPE, PlaybackDriverFlags, fEngineControl->fBufferSize)) == NO_PORT) { | |||||
if (fEngine->PortRegister(fClientControl.fRefNum, name, JACK_DEFAULT_AUDIO_TYPE, PlaybackDriverFlags, fEngineControl->fBufferSize, &port_index) < 0) { | |||||
jack_error("Cannot register port for %s", name); | jack_error("Cannot register port for %s", name); | ||||
return -1; | return -1; | ||||
} | } | ||||
@@ -1678,18 +1677,16 @@ int JackCoreAudioDriver::Attach() | |||||
port = fGraphManager->GetPort(port_index); | port = fGraphManager->GetPort(port_index); | ||||
port->SetAlias(alias); | port->SetAlias(alias); | ||||
fPlaybackPortList[i] = port_index; | fPlaybackPortList[i] = port_index; | ||||
fEngine->NotifyPortRegistration(port_index, true); | |||||
// Monitor ports | // Monitor ports | ||||
if (fWithMonitorPorts) { | if (fWithMonitorPorts) { | ||||
jack_log("Create monitor port"); | jack_log("Create monitor port"); | ||||
snprintf(name, sizeof(name) - 1, "%s:monitor_%u", fClientControl.fName, i + 1); | snprintf(name, sizeof(name) - 1, "%s:monitor_%u", fClientControl.fName, i + 1); | ||||
if ((port_index = fGraphManager->AllocatePort(fClientControl.fRefNum, name, JACK_DEFAULT_AUDIO_TYPE, MonitorDriverFlags, fEngineControl->fBufferSize)) == NO_PORT) { | |||||
if (fEngine->PortRegister(fClientControl.fRefNum, name, JACK_DEFAULT_AUDIO_TYPE, MonitorDriverFlags, fEngineControl->fBufferSize, &port_index) < 0) { | |||||
jack_error("Cannot register monitor port for %s", name); | jack_error("Cannot register monitor port for %s", name); | ||||
return -1; | return -1; | ||||
} else { | } else { | ||||
fMonitorPortList[i] = port_index; | fMonitorPortList[i] = port_index; | ||||
fEngine->NotifyPortRegistration(port_index, true); | |||||
} | } | ||||
} | } | ||||
} | } | ||||
@@ -94,9 +94,9 @@ JackCoreMidiDriver::Attach() | |||||
for (int i = 0; i < num_physical_inputs; i++) { | for (int i = 0; i < num_physical_inputs; i++) { | ||||
port_obj = physical_input_ports[i]; | port_obj = physical_input_ports[i]; | ||||
name = port_obj->GetName(); | name = port_obj->GetName(); | ||||
index = fGraphManager->AllocatePort(fClientControl.fRefNum, name, | |||||
JACK_DEFAULT_MIDI_TYPE, | |||||
CaptureDriverFlags, buffer_size); | |||||
fEngine->PortRegister(fClientControl.fRefNum, name, | |||||
JACK_DEFAULT_MIDI_TYPE, | |||||
CaptureDriverFlags, buffer_size, &index); | |||||
if (index == NO_PORT) { | if (index == NO_PORT) { | ||||
jack_error("JackCoreMidiDriver::Attach - cannot register physical " | jack_error("JackCoreMidiDriver::Attach - cannot register physical " | ||||
"input port with name '%s'.", name); | "input port with name '%s'.", name); | ||||
@@ -107,16 +107,15 @@ JackCoreMidiDriver::Attach() | |||||
port->SetAlias(port_obj->GetAlias()); | port->SetAlias(port_obj->GetAlias()); | ||||
port->SetLatencyRange(JackCaptureLatency, &latency_range); | port->SetLatencyRange(JackCaptureLatency, &latency_range); | ||||
fCapturePortList[i] = index; | fCapturePortList[i] = index; | ||||
fEngine->NotifyPortRegistration(index, true); | |||||
} | } | ||||
// Virtual inputs | // Virtual inputs | ||||
for (int i = 0; i < num_virtual_inputs; i++) { | for (int i = 0; i < num_virtual_inputs; i++) { | ||||
port_obj = virtual_input_ports[i]; | port_obj = virtual_input_ports[i]; | ||||
name = port_obj->GetName(); | name = port_obj->GetName(); | ||||
index = fGraphManager->AllocatePort(fClientControl.fRefNum, name, | |||||
JACK_DEFAULT_MIDI_TYPE, | |||||
CaptureDriverFlags, buffer_size); | |||||
fEngine->PortRegister(fClientControl.fRefNum, name, | |||||
JACK_DEFAULT_MIDI_TYPE, | |||||
CaptureDriverFlags, buffer_size, &index); | |||||
if (index == NO_PORT) { | if (index == NO_PORT) { | ||||
jack_error("JackCoreMidiDriver::Attach - cannot register virtual " | jack_error("JackCoreMidiDriver::Attach - cannot register virtual " | ||||
"input port with name '%s'.", name); | "input port with name '%s'.", name); | ||||
@@ -127,7 +126,6 @@ JackCoreMidiDriver::Attach() | |||||
port->SetAlias(port_obj->GetAlias()); | port->SetAlias(port_obj->GetAlias()); | ||||
port->SetLatencyRange(JackCaptureLatency, &latency_range); | port->SetLatencyRange(JackCaptureLatency, &latency_range); | ||||
fCapturePortList[num_physical_inputs + i] = index; | fCapturePortList[num_physical_inputs + i] = index; | ||||
fEngine->NotifyPortRegistration(index, true); | |||||
} | } | ||||
if (! fEngineControl->fSyncMode) { | if (! fEngineControl->fSyncMode) { | ||||
@@ -140,9 +138,9 @@ JackCoreMidiDriver::Attach() | |||||
for (int i = 0; i < num_physical_outputs; i++) { | for (int i = 0; i < num_physical_outputs; i++) { | ||||
port_obj = physical_output_ports[i]; | port_obj = physical_output_ports[i]; | ||||
name = port_obj->GetName(); | name = port_obj->GetName(); | ||||
index = fGraphManager->AllocatePort(fClientControl.fRefNum, name, | |||||
JACK_DEFAULT_MIDI_TYPE, | |||||
PlaybackDriverFlags, buffer_size); | |||||
fEngine->PortRegister(fClientControl.fRefNum, name, | |||||
JACK_DEFAULT_MIDI_TYPE, | |||||
PlaybackDriverFlags, buffer_size, &index); | |||||
if (index == NO_PORT) { | if (index == NO_PORT) { | ||||
jack_error("JackCoreMidiDriver::Attach - cannot register physical " | jack_error("JackCoreMidiDriver::Attach - cannot register physical " | ||||
"output port with name '%s'.", name); | "output port with name '%s'.", name); | ||||
@@ -153,16 +151,15 @@ JackCoreMidiDriver::Attach() | |||||
port->SetAlias(port_obj->GetAlias()); | port->SetAlias(port_obj->GetAlias()); | ||||
port->SetLatencyRange(JackPlaybackLatency, &latency_range); | port->SetLatencyRange(JackPlaybackLatency, &latency_range); | ||||
fPlaybackPortList[i] = index; | fPlaybackPortList[i] = index; | ||||
fEngine->NotifyPortRegistration(index, true); | |||||
} | } | ||||
// Virtual outputs | // Virtual outputs | ||||
for (int i = 0; i < num_virtual_outputs; i++) { | for (int i = 0; i < num_virtual_outputs; i++) { | ||||
port_obj = virtual_output_ports[i]; | port_obj = virtual_output_ports[i]; | ||||
name = port_obj->GetName(); | name = port_obj->GetName(); | ||||
index = fGraphManager->AllocatePort(fClientControl.fRefNum, name, | |||||
JACK_DEFAULT_MIDI_TYPE, | |||||
PlaybackDriverFlags, buffer_size); | |||||
fEngine->PortRegister(fClientControl.fRefNum, name, | |||||
JACK_DEFAULT_MIDI_TYPE, | |||||
PlaybackDriverFlags, buffer_size, &index); | |||||
if (index == NO_PORT) { | if (index == NO_PORT) { | ||||
jack_error("JackCoreMidiDriver::Attach - cannot register virtual " | jack_error("JackCoreMidiDriver::Attach - cannot register virtual " | ||||
"output port with name '%s'.", name); | "output port with name '%s'.", name); | ||||
@@ -173,7 +170,6 @@ JackCoreMidiDriver::Attach() | |||||
port->SetAlias(port_obj->GetAlias()); | port->SetAlias(port_obj->GetAlias()); | ||||
port->SetLatencyRange(JackPlaybackLatency, &latency_range); | port->SetLatencyRange(JackPlaybackLatency, &latency_range); | ||||
fPlaybackPortList[num_physical_outputs + i] = index; | fPlaybackPortList[num_physical_outputs + i] = index; | ||||
fEngine->NotifyPortRegistration(index, true); | |||||
} | } | ||||
return 0; | return 0; | ||||