git-svn-id: http://subversion.jackaudio.org/jack/jack2/trunk/jackmp@1535 0c269be4-1314-0410-8aa9-9f06e86f4224tags/0.65
@@ -2,6 +2,10 @@ | |||||
Jackdmp changes log | Jackdmp changes log | ||||
--------------------------- | --------------------------- | ||||
2007-08-26 Stephane Letz <letz@grame.fr> | |||||
* Make "Rename" a method of JackPort class, call it from driver Attach method. | |||||
2007-08-24 Stephane Letz <letz@grame.fr> | 2007-08-24 Stephane Letz <letz@grame.fr> | ||||
* Implement server temporary (-T) mode. | * Implement server temporary (-T) mode. | ||||
@@ -90,7 +90,8 @@ int JackAudioDriver::Attach() | |||||
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_index); | |||||
port = fGraphManager->GetPort(port_index); | |||||
port->Rename("system:capture_%d", i + 1); | |||||
port->SetLatency(fEngineControl->fBufferSize + fCaptureLatency); | port->SetLatency(fEngineControl->fBufferSize + fCaptureLatency); | ||||
fCapturePortList[i] = port_index; | fCapturePortList[i] = port_index; | ||||
JackLog("JackAudioDriver::Attach fCapturePortList[i] %ld = \n", 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); | jack_error("driver: cannot register port for %s", buf); | ||||
return -1; | return -1; | ||||
} | } | ||||
port = fGraphManager->GetPort(port_index); | |||||
port = fGraphManager->GetPort(port_index); | |||||
port->Rename("system:playback_%d", i + 1); | |||||
port->SetLatency(fEngineControl->fBufferSize + fPlaybackLatency); | port->SetLatency(fEngineControl->fBufferSize + fPlaybackLatency); | ||||
fPlaybackPortList[i] = port_index; | fPlaybackPortList[i] = port_index; | ||||
JackLog("JackAudioDriver::Attach fPlaybackPortList[i] %ld = \n", port_index); | JackLog("JackAudioDriver::Attach fPlaybackPortList[i] %ld = \n", port_index); | ||||
@@ -224,27 +226,6 @@ int JackAudioDriver::ProcessSync() | |||||
return 0; | 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) | void JackAudioDriver::NotifyXRun(jack_time_t callback_usecs) | ||||
{ | { | ||||
fEngine->NotifyXRun(callback_usecs); | fEngine->NotifyXRun(callback_usecs); | ||||
@@ -55,8 +55,6 @@ class EXPORT JackAudioDriver : public JackDriver | |||||
int ProcessAsync(); | int ProcessAsync(); | ||||
int ProcessSync(); | int ProcessSync(); | ||||
void RenamePorts(); | |||||
public: | public: | ||||
@@ -65,9 +65,7 @@ class EXPORT JackDriverInterface | |||||
virtual int Attach() = 0; | virtual int Attach() = 0; | ||||
virtual int Detach() = 0; | virtual int Detach() = 0; | ||||
virtual void RenamePorts() = 0; | |||||
virtual int Read() = 0; | virtual int Read() = 0; | ||||
virtual int Write() = 0; | virtual int Write() = 0; | ||||
@@ -45,9 +45,6 @@ class JackFreewheelDriver : public JackDriver | |||||
return false; | return false; | ||||
} | } | ||||
void RenamePorts() | |||||
{} | |||||
int Process(); | int Process(); | ||||
}; | }; | ||||
@@ -59,7 +59,7 @@ class JackGraphManager : public JackShmMem, public JackAtomicState<JackConnectio | |||||
// Ports management | // Ports management | ||||
jack_port_id_t AllocatePort(int refnum, const char* port_name, JackPortFlags flags); | jack_port_id_t AllocatePort(int refnum, const char* port_name, JackPortFlags flags); | ||||
int ReleasePort(int refnum, jack_port_id_t port_index); | int ReleasePort(int refnum, jack_port_id_t port_index); | ||||
void RemoveAllPorts(int refnum); | |||||
void RemoveAllPorts(int refnum); | |||||
void DisconnectAllPorts(int refnum); | void DisconnectAllPorts(int refnum); | ||||
JackPort* GetPort(jack_port_id_t index); | JackPort* GetPort(jack_port_id_t index); | ||||
@@ -187,11 +187,10 @@ int JackPort::SetName(const char* new_name) | |||||
return 0; | return 0; | ||||
} | } | ||||
int JackPort::SetFullName(const char* new_name) | |||||
void JackPort::Rename(const char* name, int index) | |||||
{ | { | ||||
assert(strlen(new_name) < JACK_CLIENT_NAME_SIZE + JACK_PORT_NAME_SIZE); | |||||
strcpy(fName, new_name); | |||||
return 0; | |||||
SetAlias(GetName()); | |||||
snprintf(fName, sizeof(fName) - 1, name, index); | |||||
} | } | ||||
bool JackPort::NameEquals(const char* target) | bool JackPort::NameEquals(const char* target) | ||||
@@ -78,7 +78,7 @@ class JackPort | |||||
const char* GetName() const; | const char* GetName() const; | ||||
const char* GetShortName() const; | const char* GetShortName() const; | ||||
int SetName(const char* name); | int SetName(const char* name); | ||||
int SetFullName(const char* new_name); | |||||
void Rename(const char* name, int index); | |||||
int GetAliases(char* const aliases[2]); | int GetAliases(char* const aliases[2]); | ||||
int SetAlias(const char* alias); | int SetAlias(const char* alias); | ||||
@@ -123,8 +123,6 @@ int JackServer::Open(jack_driver_desc_t* driver_desc, JSList* driver_params) | |||||
return -1; | return -1; | ||||
} | } | ||||
fAudioDriver->RenamePorts(); | |||||
if (fLoopback > 0 && fLoopbackDriver->Attach() != 0) { | if (fLoopback > 0 && fLoopbackDriver->Attach() != 0) { | ||||
jack_error("Cannot attach loopback driver"); | jack_error("Cannot attach loopback driver"); | ||||
return -1; | return -1; | ||||
@@ -83,12 +83,7 @@ class JackThreadedDriver : public JackDriverClientInterface, public JackRunnable | |||||
return fDriver->Detach(); | return fDriver->Detach(); | ||||
} | } | ||||
virtual void RenamePorts() | |||||
{ | |||||
fDriver->RenamePorts(); | |||||
} | |||||
virtual int Read() | |||||
virtual int Read() | |||||
{ | { | ||||
return fDriver->Read(); | return fDriver->Read(); | ||||
} | } | ||||
@@ -835,6 +835,7 @@ int JackCoreAudioDriver::Attach() | |||||
JackLog("AudioDeviceGetProperty kAudioDevicePropertySafetyOffset error \n"); | JackLog("AudioDeviceGetProperty kAudioDevicePropertySafetyOffset error \n"); | ||||
port = fGraphManager->GetPort(port_index); | port = fGraphManager->GetPort(port_index); | ||||
port->Rename("system:capture_%d", i + 1); | |||||
port->SetLatency(fEngineControl->fBufferSize + value1 + value2 + fCaptureLatency); | port->SetLatency(fEngineControl->fBufferSize + value1 + value2 + fCaptureLatency); | ||||
fCapturePortList[i] = port_index; | fCapturePortList[i] = port_index; | ||||
} | } | ||||
@@ -870,7 +871,8 @@ int JackCoreAudioDriver::Attach() | |||||
if (err != noErr) | if (err != noErr) | ||||
JackLog("AudioDeviceGetProperty kAudioDevicePropertySafetyOffset error \n"); | 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); | port->SetLatency(fEngineControl->fBufferSize + value1 + value2 + fPlaybackLatency); | ||||
fPlaybackPortList[i] = port_index; | fPlaybackPortList[i] = port_index; | ||||