summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorsletz <sletz@0c269be4-1314-0410-8aa9-9f06e86f4224>2007-08-26 10:07:59 +0000
committersletz <sletz@0c269be4-1314-0410-8aa9-9f06e86f4224>2007-08-26 10:07:59 +0000
commit1231a5d893bf20892693e74bfc467c8d16eeda1a (patch)
treeb6408c2769cf2457de009740673aba626bb54695
parentbff8a3569917b43a967f5d8be49f8ddf2f8ceecf (diff)
downloadjack2-1231a5d893bf20892693e74bfc467c8d16eeda1a.tar.gz
Make Rename a method of JackPort class, call it from driver Attach method.
git-svn-id: http://subversion.jackaudio.org/jack/jack2/trunk/jackmp@1535 0c269be4-1314-0410-8aa9-9f06e86f4224
-rw-r--r--ChangeLog4
-rw-r--r--common/JackAudioDriver.cpp27
-rw-r--r--common/JackAudioDriver.h2
-rw-r--r--common/JackDriver.h4
-rw-r--r--common/JackFreewheelDriver.h3
-rw-r--r--common/JackGraphManager.h2
-rw-r--r--common/JackPort.cpp7
-rw-r--r--common/JackPort.h2
-rw-r--r--common/JackServer.cpp2
-rw-r--r--common/JackThreadedDriver.h7
-rw-r--r--macosx/JackCoreAudioDriver.cpp4
11 files changed, 18 insertions, 46 deletions
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 <letz@grame.fr>
+
+ * Make "Rename" a method of JackPort class, call it from driver Attach method.
+
2007-08-24 Stephane Letz <letz@grame.fr>
* 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 JackAtomicState<JackConnectio
// Ports management
jack_port_id_t AllocatePort(int refnum, const char* port_name, JackPortFlags flags);
int ReleasePort(int refnum, jack_port_id_t port_index);
- void RemoveAllPorts(int refnum);
+ void RemoveAllPorts(int refnum);
void DisconnectAllPorts(int refnum);
JackPort* GetPort(jack_port_id_t index);
diff --git a/common/JackPort.cpp b/common/JackPort.cpp
index bc0d66a9..7ac102fe 100644
--- a/common/JackPort.cpp
+++ b/common/JackPort.cpp
@@ -187,11 +187,10 @@ int JackPort::SetName(const char* new_name)
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)
diff --git a/common/JackPort.h b/common/JackPort.h
index 45748f61..73a25980 100644
--- a/common/JackPort.h
+++ b/common/JackPort.h
@@ -78,7 +78,7 @@ class JackPort
const char* GetName() const;
const char* GetShortName() const;
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 SetAlias(const char* alias);
diff --git a/common/JackServer.cpp b/common/JackServer.cpp
index 50f0bf51..ba2d0e36 100644
--- a/common/JackServer.cpp
+++ b/common/JackServer.cpp
@@ -123,8 +123,6 @@ int JackServer::Open(jack_driver_desc_t* driver_desc, JSList* driver_params)
return -1;
}
- fAudioDriver->RenamePorts();
-
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;