Commit 55557d1f authored by Nedko Arnaudov's avatar Nedko Arnaudov
Browse files

Port registration notifications on SwitchMaster

parent 0d40e82f
......@@ -149,6 +149,7 @@ int JackAudioDriver::Attach()
port->SetAlias(alias);
fCapturePortList[i] = port_index;
jack_log("JackAudioDriver::Attach fCapturePortList[i] port_index = %ld", port_index);
fEngine->NotifyPortRegistration(port_index, true);
}
for (i = 0; i < fPlaybackChannels; i++) {
......@@ -162,6 +163,7 @@ int JackAudioDriver::Attach()
port->SetAlias(alias);
fPlaybackPortList[i] = port_index;
jack_log("JackAudioDriver::Attach fPlaybackPortList[i] port_index = %ld", port_index);
fEngine->NotifyPortRegistration(port_index, true);
// Monitor ports
if (fWithMonitorPorts) {
......@@ -172,6 +174,7 @@ int JackAudioDriver::Attach()
return -1;
} else {
fMonitorPortList[i] = port_index;
fEngine->NotifyPortRegistration(port_index, true);
}
}
}
......@@ -187,12 +190,16 @@ int JackAudioDriver::Detach()
for (i = 0; i < fCaptureChannels; i++) {
fGraphManager->ReleasePort(fClientControl.fRefNum, fCapturePortList[i]);
fEngine->NotifyPortRegistration(fCapturePortList[i], false);
}
for (i = 0; i < fPlaybackChannels; i++) {
fGraphManager->ReleasePort(fClientControl.fRefNum, fPlaybackPortList[i]);
if (fWithMonitorPorts)
fEngine->NotifyPortRegistration(fPlaybackPortList[i], false);
if (fWithMonitorPorts) {
fGraphManager->ReleasePort(fClientControl.fRefNum, fMonitorPortList[i]);
fEngine->NotifyPortRegistration(fMonitorPortList[i], false);
}
}
return 0;
......
......@@ -261,6 +261,13 @@ class SERVER_EXPORT JackLockedEngine
fEngine.NotifyGraphReorder();
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)
{
TRY_CALL
......
......@@ -75,6 +75,7 @@ int JackMidiDriver::Attach()
port->SetAlias(alias);
fCapturePortList[i] = port_index;
jack_log("JackMidiDriver::Attach fCapturePortList[i] port_index = %ld", port_index);
fEngine->NotifyPortRegistration(port_index, true);
}
for (i = 0; i < fPlaybackChannels; i++) {
......@@ -88,6 +89,7 @@ int JackMidiDriver::Attach()
port->SetAlias(alias);
fPlaybackPortList[i] = port_index;
jack_log("JackMidiDriver::Attach fPlaybackPortList[i] port_index = %ld", port_index);
fEngine->NotifyPortRegistration(port_index, true);
}
UpdateLatencies();
......@@ -101,10 +103,12 @@ int JackMidiDriver::Detach()
for (i = 0; i < fCaptureChannels; i++) {
fGraphManager->ReleasePort(fClientControl.fRefNum, fCapturePortList[i]);
fEngine->NotifyPortRegistration(fCapturePortList[i], false);
}
for (i = 0; i < fPlaybackChannels; i++) {
fGraphManager->ReleasePort(fClientControl.fRefNum, fPlaybackPortList[i]);
fEngine->NotifyPortRegistration(fPlaybackPortList[i], false);
}
return 0;
......
......@@ -21,7 +21,7 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#include "JackEngineControl.h"
#include "JackGraphManager.h"
#include "JackWaitThreadedDriver.h"
#include "JackLockedEngine.h"
using namespace std;
......@@ -295,6 +295,7 @@ namespace Jack
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);
}
port_flags = JackPortIsInput | JackPortIsPhysical | JackPortIsTerminal;
for (audio_port_index = 0; audio_port_index < fPlaybackChannels; audio_port_index++)
......@@ -325,6 +326,7 @@ namespace Jack
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);
}
//midi
port_flags = JackPortIsOutput | JackPortIsPhysical | JackPortIsTerminal;
......@@ -344,6 +346,7 @@ namespace Jack
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);
}
port_flags = JackPortIsInput | JackPortIsPhysical | JackPortIsTerminal;
......@@ -374,6 +377,7 @@ namespace Jack
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);
}
return 0;
......@@ -386,6 +390,7 @@ namespace Jack
for (int audio_port_index = 0; audio_port_index < fCaptureChannels; audio_port_index++) {
if (fCapturePortList[audio_port_index] > 0) {
fGraphManager->ReleasePort(fClientControl.fRefNum, fCapturePortList[audio_port_index]);
fEngine->NotifyPortRegistration(fCapturePortList[audio_port_index], false);
fCapturePortList[audio_port_index] = 0;
}
}
......@@ -393,6 +398,7 @@ namespace Jack
for (int audio_port_index = 0; audio_port_index < fPlaybackChannels; audio_port_index++) {
if (fPlaybackPortList[audio_port_index] > 0) {
fGraphManager->ReleasePort(fClientControl.fRefNum, fPlaybackPortList[audio_port_index]);
fEngine->NotifyPortRegistration(fPlaybackPortList[audio_port_index], false);
fPlaybackPortList[audio_port_index] = 0;
}
}
......@@ -400,6 +406,7 @@ namespace Jack
for (int midi_port_index = 0; midi_port_index < fParams.fSendMidiChannels; midi_port_index++) {
if (fMidiCapturePortList && fMidiCapturePortList[midi_port_index] > 0) {
fGraphManager->ReleasePort(fClientControl.fRefNum, fMidiCapturePortList[midi_port_index]);
fEngine->NotifyPortRegistration(fMidiCapturePortList[midi_port_index], false);
fMidiCapturePortList[midi_port_index] = 0;
}
}
......@@ -407,6 +414,7 @@ namespace Jack
for (int midi_port_index = 0; midi_port_index < fParams.fReturnMidiChannels; midi_port_index++) {
if (fMidiPlaybackPortList && fMidiPlaybackPortList[midi_port_index] > 0) {
fGraphManager->ReleasePort(fClientControl.fRefNum, fMidiPlaybackPortList[midi_port_index]);
fEngine->NotifyPortRegistration(fMidiPlaybackPortList[midi_port_index], false);
fMidiPlaybackPortList[midi_port_index] = 0;
}
}
......
......@@ -23,6 +23,7 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#include "JackNetOneDriver.h"
#include "JackEngineControl.h"
#include "JackLockedEngine.h"
#include "JackGraphManager.h"
#include "JackWaitThreadedDriver.h"
#include "JackTools.h"
......@@ -177,6 +178,7 @@ int JackNetOneDriver::AllocPorts()
netj.capture_srcs = jack_slist_append(netj.capture_srcs, (void *)src_new(SRC_LINEAR, 1, NULL));
#endif
}
fEngine->NotifyPortRegistration(port_id, true);
}
for (chn = netj.capture_channels_audio; chn < netj.capture_channels; chn++) {
snprintf (buf, sizeof(buf) - 1, "system:capture_%u", chn + 1);
......@@ -190,6 +192,7 @@ int JackNetOneDriver::AllocPorts()
netj.capture_ports =
jack_slist_append (netj.capture_ports, (void *)(intptr_t)port_id);
fEngine->NotifyPortRegistration(port_id, true);
}
for (chn = 0; chn < netj.playback_channels_audio; chn++) {
......@@ -221,6 +224,7 @@ int JackNetOneDriver::AllocPorts()
netj.playback_srcs = jack_slist_append(netj.playback_srcs, (void *)src_new(SRC_LINEAR, 1, NULL));
#endif
}
fEngine->NotifyPortRegistration(port_id, true);
}
for (chn = netj.playback_channels_audio; chn < netj.playback_channels; chn++) {
snprintf (buf, sizeof(buf) - 1, "system:playback_%u", chn + 1);
......@@ -234,6 +238,7 @@ int JackNetOneDriver::AllocPorts()
netj.playback_ports =
jack_slist_append (netj.playback_ports, (void *)(intptr_t)port_id);
fEngine->NotifyPortRegistration(port_id, true);
}
return 0;
}
......@@ -439,6 +444,7 @@ JackNetOneDriver::FreePorts ()
node = jack_slist_remove_link( node, this_node );
jack_slist_free_1( this_node );
fGraphManager->ReleasePort( fClientControl.fRefNum, port_id );
fEngine->NotifyPortRegistration(port_id, false);
}
netj.capture_ports = NULL;
......@@ -449,6 +455,7 @@ JackNetOneDriver::FreePorts ()
node = jack_slist_remove_link( node, this_node );
jack_slist_free_1( this_node );
fGraphManager->ReleasePort( fClientControl.fRefNum, port_id );
fEngine->NotifyPortRegistration(port_id, false);
}
netj.playback_ports = NULL;
......
......@@ -124,6 +124,7 @@ int JackAlsaDriver::Attach()
port->SetAlias(alias);
fCapturePortList[i] = port_index;
jack_log("JackAlsaDriver::Attach fCapturePortList[i] %ld ", port_index);
fEngine->NotifyPortRegistration(port_index, true);
}
port_flags = (unsigned long)PlaybackDriverFlags;
......@@ -139,6 +140,7 @@ int JackAlsaDriver::Attach()
port->SetAlias(alias);
fPlaybackPortList[i] = port_index;
jack_log("JackAlsaDriver::Attach fPlaybackPortList[i] %ld ", port_index);
fEngine->NotifyPortRegistration(port_index, true);
// Monitor ports
if (fWithMonitorPorts) {
......@@ -148,6 +150,7 @@ int JackAlsaDriver::Attach()
jack_error ("ALSA: cannot register monitor port for %s", name);
} else {
fMonitorPortList[i] = port_index;
fEngine->NotifyPortRegistration(port_index, true);
}
}
}
......
......@@ -86,6 +86,7 @@ JackALSARawMidiDriver::Attach()
jack_info("JackALSARawMidiDriver::Attach - input port registered "
"(name='%s', alias='%s').", name, alias);
fEngine->NotifyPortRegistration(index, true);
}
if (! fEngineControl->fSyncMode) {
latency += buffer_size;
......@@ -113,6 +114,7 @@ JackALSARawMidiDriver::Attach()
jack_info("JackALSARawMidiDriver::Attach - output port registered "
"(name='%s', alias='%s').", name, alias);
fEngine->NotifyPortRegistration(index, true);
}
return 0;
}
......
......@@ -43,6 +43,7 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#include "JackPort.h"
#include "JackGraphManager.h"
#include "JackCompilerDeps.h"
#include "JackLockedEngine.h"
namespace Jack
{
......@@ -443,6 +444,8 @@ int JackFFADODriver::Attach()
jack_log("JackFFADODriver::Attach fCapturePortList[i] %ld ", port_index);
fCaptureChannels++;
fEngine->NotifyPortRegistration(port_index, true);
} else if (driver->capture_channels[chn].stream_type == ffado_stream_type_midi) {
snprintf(buf, sizeof(buf) - 1, "firewire_pcm:%s_in", portname);
printMessage ("Registering midi capture port %s", buf);
......@@ -472,6 +475,9 @@ int JackFFADODriver::Attach()
fCapturePortList[chn] = port_index;
jack_log("JackFFADODriver::Attach fCapturePortList[i] %ld ", port_index);
fCaptureChannels++;
fEngine->NotifyPortRegistration(port_index, true);
} else {
printMessage ("Don't register capture port %s", portname);
}
......@@ -520,6 +526,9 @@ int JackFFADODriver::Attach()
fPlaybackPortList[chn] = port_index;
jack_log("JackFFADODriver::Attach fPlaybackPortList[i] %ld ", port_index);
fPlaybackChannels++;
fEngine->NotifyPortRegistration(port_index, true);
} else if (driver->playback_channels[chn].stream_type == ffado_stream_type_midi) {
snprintf(buf, sizeof(buf) - 1, "firewire_pcm:%s_out", portname);
printMessage ("Registering midi playback port %s", buf);
......@@ -553,6 +562,9 @@ int JackFFADODriver::Attach()
fPlaybackPortList[chn] = port_index;
jack_log("JackFFADODriver::Attach fPlaybackPortList[i] %ld ", port_index);
fPlaybackChannels++;
fEngine->NotifyPortRegistration(port_index, true);
} else {
printMessage ("Don't register playback port %s", portname);
}
......
......@@ -39,6 +39,7 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#include "JackClientControl.h"
#include "JackPort.h"
#include "JackGraphManager.h"
#include "JackLockedEngine.h"
namespace Jack
{
......@@ -743,6 +744,8 @@ int JackFreebobDriver::Attach()
fCapturePortList[i] = port_index;
jack_log("JackFreebobDriver::Attach fCapturePortList[i] %ld ", port_index);
driver->capture_nchannels_audio++;
fEngine->NotifyPortRegistration(port_index, true);
}
}
......@@ -773,6 +776,8 @@ int JackFreebobDriver::Attach()
fPlaybackPortList[i] = port_index;
jack_log("JackFreebobDriver::Attach fPlaybackPortList[i] %ld ", port_index);
driver->playback_nchannels_audio++;
fEngine->NotifyPortRegistration(port_index, true);
}
}
......
......@@ -27,6 +27,7 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#include "JackGlobals.h"
#include "JackTools.h"
#include "JackCompilerDeps.h"
#include "JackLockedEngine.h"
#include <iostream>
#include <CoreServices/CoreServices.h>
......@@ -1650,6 +1651,7 @@ int JackCoreAudioDriver::Attach()
port = fGraphManager->GetPort(port_index);
port->SetAlias(alias);
fCapturePortList[i] = port_index;
fEngine->NotifyPortRegistration(port_index, true);
}
for (int i = 0; i < fPlaybackChannels; i++) {
......@@ -1676,6 +1678,7 @@ int JackCoreAudioDriver::Attach()
port = fGraphManager->GetPort(port_index);
port->SetAlias(alias);
fPlaybackPortList[i] = port_index;
fEngine->NotifyPortRegistration(port_index, true);
// Monitor ports
if (fWithMonitorPorts) {
......@@ -1686,6 +1689,7 @@ int JackCoreAudioDriver::Attach()
return -1;
} else {
fMonitorPortList[i] = port_index;
fEngine->NotifyPortRegistration(port_index, true);
}
}
}
......
......@@ -107,6 +107,7 @@ JackCoreMidiDriver::Attach()
port->SetAlias(port_obj->GetAlias());
port->SetLatencyRange(JackCaptureLatency, &latency_range);
fCapturePortList[i] = index;
fEngine->NotifyPortRegistration(index, true);
}
// Virtual inputs
......@@ -126,6 +127,7 @@ JackCoreMidiDriver::Attach()
port->SetAlias(port_obj->GetAlias());
port->SetLatencyRange(JackCaptureLatency, &latency_range);
fCapturePortList[num_physical_inputs + i] = index;
fEngine->NotifyPortRegistration(index, true);
}
if (! fEngineControl->fSyncMode) {
......@@ -151,6 +153,7 @@ JackCoreMidiDriver::Attach()
port->SetAlias(port_obj->GetAlias());
port->SetLatencyRange(JackPlaybackLatency, &latency_range);
fPlaybackPortList[i] = index;
fEngine->NotifyPortRegistration(index, true);
}
// Virtual outputs
......@@ -170,6 +173,7 @@ JackCoreMidiDriver::Attach()
port->SetAlias(port_obj->GetAlias());
port->SetLatencyRange(JackPlaybackLatency, &latency_range);
fPlaybackPortList[num_physical_outputs + i] = index;
fEngine->NotifyPortRegistration(index, true);
}
return 0;
......
......@@ -74,6 +74,7 @@ JackWinMMEDriver::Attach()
port->SetAlias(input_port->GetAlias());
port->SetLatencyRange(JackCaptureLatency, &latency_range);
fCapturePortList[i] = index;
fEngine->NotifyPortRegistration(index, true);
}
if (! fEngineControl->fSyncMode) {
......@@ -99,6 +100,7 @@ JackWinMMEDriver::Attach()
port->SetAlias(output_port->GetAlias());
port->SetLatencyRange(JackPlaybackLatency, &latency_range);
fPlaybackPortList[i] = index;
fEngine->NotifyPortRegistration(index, true);
}
return 0;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment