diff --git a/ChangeLog b/ChangeLog index e6a278ee..82afeea7 100644 --- a/ChangeLog +++ b/ChangeLog @@ -2,6 +2,10 @@ Jackdmp changes log --------------------------- +2007-08-26 Stephane Letz + + * Make "Rename" a method of JackPort class, call it from driver Attach method. + 2007-08-24 Stephane Letz * Implement server temporary (-T) mode. diff --git a/common/JackAudioDriver.cpp b/common/JackAudioDriver.cpp index 878f9bc9..94fd9bcb 100644 --- a/common/JackAudioDriver.cpp +++ b/common/JackAudioDriver.cpp @@ -90,7 +90,8 @@ int JackAudioDriver::Attach() jack_error("driver: cannot register port for %s", buf); return -1; } - port = fGraphManager->GetPort(port_index); + port = fGraphManager->GetPort(port_index); + port->Rename("system:capture_%d", i + 1); port->SetLatency(fEngineControl->fBufferSize + fCaptureLatency); fCapturePortList[i] = port_index; JackLog("JackAudioDriver::Attach fCapturePortList[i] %ld = \n", port_index); @@ -104,7 +105,8 @@ int JackAudioDriver::Attach() jack_error("driver: cannot register port for %s", buf); return -1; } - port = fGraphManager->GetPort(port_index); + port = fGraphManager->GetPort(port_index); + port->Rename("system:playback_%d", i + 1); port->SetLatency(fEngineControl->fBufferSize + fPlaybackLatency); fPlaybackPortList[i] = port_index; JackLog("JackAudioDriver::Attach fPlaybackPortList[i] %ld = \n", port_index); @@ -224,27 +226,6 @@ int JackAudioDriver::ProcessSync() return 0; } -void JackAudioDriver::RenamePorts() -{ - JackPort* port; - char buf[JACK_CLIENT_NAME_SIZE + JACK_PORT_NAME_SIZE]; - int i; - - for (i = 0; i < fCaptureChannels; i++) { - port = fGraphManager->GetPort(fCapturePortList[i]); - port->SetAlias(port->GetName()); - snprintf(buf, sizeof(buf) - 1, "system:capture_%d", i + 1); - port->SetFullName(buf); - } - - for (i = 0; i < fPlaybackChannels; i++) { - port = fGraphManager->GetPort(fPlaybackPortList[i]); - port->SetAlias(port->GetName()); - snprintf(buf, sizeof(buf) - 1, "system:playback_%d", i + 1); - port->SetFullName(buf); - } -} - void JackAudioDriver::NotifyXRun(jack_time_t callback_usecs) { fEngine->NotifyXRun(callback_usecs); diff --git a/common/JackAudioDriver.h b/common/JackAudioDriver.h index 5ea6432e..d3c86da6 100644 --- a/common/JackAudioDriver.h +++ b/common/JackAudioDriver.h @@ -55,8 +55,6 @@ class EXPORT JackAudioDriver : public JackDriver int ProcessAsync(); int ProcessSync(); - - void RenamePorts(); public: diff --git a/common/JackDriver.h b/common/JackDriver.h index 2024241a..f304afc9 100644 --- a/common/JackDriver.h +++ b/common/JackDriver.h @@ -65,9 +65,7 @@ class EXPORT JackDriverInterface virtual int Attach() = 0; virtual int Detach() = 0; - - virtual void RenamePorts() = 0; - + virtual int Read() = 0; virtual int Write() = 0; diff --git a/common/JackFreewheelDriver.h b/common/JackFreewheelDriver.h index 867c310b..db486df1 100644 --- a/common/JackFreewheelDriver.h +++ b/common/JackFreewheelDriver.h @@ -45,9 +45,6 @@ class JackFreewheelDriver : public JackDriver return false; } - void RenamePorts() - {} - int Process(); }; diff --git a/common/JackGraphManager.h b/common/JackGraphManager.h index 3cf0d928..dd8af9d8 100644 --- a/common/JackGraphManager.h +++ b/common/JackGraphManager.h @@ -59,7 +59,7 @@ class JackGraphManager : public JackShmMem, public JackAtomicStateRenamePorts(); - if (fLoopback > 0 && fLoopbackDriver->Attach() != 0) { jack_error("Cannot attach loopback driver"); return -1; diff --git a/common/JackThreadedDriver.h b/common/JackThreadedDriver.h index c5aa0b3f..191aecf9 100644 --- a/common/JackThreadedDriver.h +++ b/common/JackThreadedDriver.h @@ -83,12 +83,7 @@ class JackThreadedDriver : public JackDriverClientInterface, public JackRunnable return fDriver->Detach(); } - virtual void RenamePorts() - { - fDriver->RenamePorts(); - } - - virtual int Read() + virtual int Read() { return fDriver->Read(); } diff --git a/macosx/JackCoreAudioDriver.cpp b/macosx/JackCoreAudioDriver.cpp index e6ea8928..fbdd1616 100644 --- a/macosx/JackCoreAudioDriver.cpp +++ b/macosx/JackCoreAudioDriver.cpp @@ -835,6 +835,7 @@ int JackCoreAudioDriver::Attach() JackLog("AudioDeviceGetProperty kAudioDevicePropertySafetyOffset error \n"); port = fGraphManager->GetPort(port_index); + port->Rename("system:capture_%d", i + 1); port->SetLatency(fEngineControl->fBufferSize + value1 + value2 + fCaptureLatency); fCapturePortList[i] = port_index; } @@ -870,7 +871,8 @@ int JackCoreAudioDriver::Attach() if (err != noErr) JackLog("AudioDeviceGetProperty kAudioDevicePropertySafetyOffset error \n"); - port = fGraphManager->GetPort(port_index); + port = fGraphManager->GetPort(port_index); + port->Rename("system:playback_%d", i + 1); port->SetLatency(fEngineControl->fBufferSize + value1 + value2 + fPlaybackLatency); fPlaybackPortList[i] = port_index;