summaryrefslogtreecommitdiff
path: root/common/JackClient.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'common/JackClient.cpp')
-rw-r--r--common/JackClient.cpp31
1 files changed, 31 insertions, 0 deletions
diff --git a/common/JackClient.cpp b/common/JackClient.cpp
index 99293674..36b6981f 100644
--- a/common/JackClient.cpp
+++ b/common/JackClient.cpp
@@ -41,6 +41,8 @@ using namespace std;
namespace Jack
{
+JackClient* JackClient::fClientTable[CLIENT_NUM] = {};
+
#define IsRealTime() ((fProcess != NULL) | (fThreadFun != NULL) | (fSync != NULL) | (fTimebase != NULL))
JackClient::JackClient():fThread(this)
@@ -59,6 +61,7 @@ JackClient::JackClient(JackSynchro* table):fThread(this)
fFreewheel = NULL;
fPortRegistration = NULL;
fPortConnect = NULL;
+ fPortRename = NULL;
fTimebase = NULL;
fSync = NULL;
fThreadFun = NULL;
@@ -72,6 +75,7 @@ JackClient::JackClient(JackSynchro* table):fThread(this)
fClientRegistrationArg = NULL;
fPortRegistrationArg = NULL;
fPortConnectArg = NULL;
+ fPortRenameArg = NULL;
fSyncArg = NULL;
fTimebaseArg = NULL;
fThreadFunArg = NULL;
@@ -97,6 +101,7 @@ int JackClient::Close()
fChannel->Close();
fSynchroTable[GetClientControl()->fRefNum].Disconnect();
+ fClientTable[GetClientControl()->fRefNum] = NULL;
return result;
}
@@ -237,6 +242,12 @@ int JackClient::ClientNotify(int refnum, const char* name, int notify, int sync,
if (fPortConnect)
fPortConnect(value1, value2, 0, fPortConnectArg);
break;
+
+ case kPortRenameCallback:
+ jack_log("JackClient::kPortRenameCallback src = %ld dst = %ld", value1, value2);
+ if (fPortRename)
+ fPortRename(value1, GetGraphManager()->GetPort(value1)->GetName(), fPortRenameArg);
+ break;
case kXRunCallback:
jack_log("JackClient::kXRunCallback");
@@ -554,6 +565,13 @@ int JackClient::PortIsMine(jack_port_id_t port_index)
return GetClientControl()->fRefNum == port->GetRefNum();
}
+int JackClient::PortRename(jack_port_id_t port_index, const char* name)
+{
+ int result = -1;
+ fChannel->PortRename(GetClientControl()->fRefNum, port_index, name, &result);
+ return result;
+}
+
//--------------------
// Context management
//--------------------
@@ -880,6 +898,19 @@ int JackClient::SetPortConnectCallback(JackPortConnectCallback callback, void *a
}
}
+int JackClient::SetPortRenameCallback(JackPortRenameCallback callback, void *arg)
+{
+ if (IsActive()) {
+ jack_error("You cannot set callbacks on an active client");
+ return -1;
+ } else {
+ GetClientControl()->fCallback[kPortRenameCallback] = (callback != NULL);
+ fPortRenameArg = arg;
+ fPortRename = callback;
+ return 0;
+ }
+}
+
int JackClient::SetProcessThread(JackThreadCallback fun, void *arg)
{
if (IsActive()) {