Commit cfc2315b authored by sletz's avatar sletz
Browse files

Port connection callback.

git-svn-id: http://subversion.jackaudio.org/jack/jack2/trunk/jackmp@1781 0c269be4-1314-0410-8aa9-9f06e86f4224
parent 5518dce6
......@@ -19,7 +19,8 @@ Tim Blechmann
2008-01-28 Stephane Letz <letz@grame.fr>
* Updated API to match jack 0.109.0 version (in progress). Correct issue in CoreAudio driver.
* Updated API to match jack 0.109.0 version (in progress). Correct issue in CoreAudio driver.
* Port connection callback.
2008-01-25 Stephane Letz <letz@grame.fr>
......
......@@ -84,6 +84,9 @@ extern "C"
EXPORT int jack_set_port_registration_callback (jack_client_t *,
JackPortRegistrationCallback
registration_callback, void *arg);
EXPORT int jack_set_port_connect_callback (jack_client_t *,
JackPortConnectCallback
connect_callback, void *arg);
EXPORT int jack_set_graph_order_callback (jack_client_t *,
JackGraphOrderCallback graph_callback,
void *);
......@@ -112,9 +115,10 @@ extern "C"
EXPORT int jack_port_tie (jack_port_t *src, jack_port_t *dst);
EXPORT int jack_port_untie (jack_port_t *port);
EXPORT jack_nframes_t jack_port_get_latency (jack_port_t *port);
EXPORT jack_nframes_t jack_port_get_total_latency (jack_client_t *,
EXPORT jack_nframes_t jack_port_get_total_latency (jack_client_t *,
jack_port_t *port);
EXPORT void jack_port_set_latency (jack_port_t *, jack_nframes_t);
EXPORT int jack_recompute_total_latency (jack_client_t*, jack_port_t* port);
EXPORT int jack_recompute_total_latencies (jack_client_t*);
EXPORT int jack_port_set_name (jack_port_t *port, const char *port_name);
EXPORT int jack_port_set_alias (jack_port_t *port, const char *alias);
......@@ -242,11 +246,11 @@ EXPORT void jack_set_error_function (void (*func)(const char *))
EXPORT jack_client_t* jack_client_new(const char* client_name)
{
jack_error("jack_client_new: deprecated");
int options = JackUseExactName;
if (getenv("JACK_START_SERVER") == NULL)
options |= JackNoStartServer;
return jack_client_open(client_name, (jack_options_t)options, NULL);
return jack_client_open(client_name, (jack_options_t)options, NULL);
}
EXPORT void* jack_port_get_buffer(jack_port_t* port, jack_nframes_t frames)
......@@ -416,8 +420,22 @@ EXPORT void jack_port_set_latency(jack_port_t* port, jack_nframes_t frames)
}
}
EXPORT int jack_recompute_total_latencies(jack_client_t* ext_client, jack_port_t* port)
{
#ifdef __CLIENTDEBUG__
JackLibGlobals::CheckContext();
#endif
// The latency computation is done each time jack_port_get_total_latency is called
return 0;
}
EXPORT int jack_recompute_total_latencies(jack_client_t* ext_client)
{
#ifdef __CLIENTDEBUG__
JackLibGlobals::CheckContext();
#endif
// The latency computation is done each time jack_port_get_total_latency is called
return 0;
}
......@@ -691,6 +709,20 @@ EXPORT int jack_set_port_registration_callback(jack_client_t* ext_client, JackPo
}
}
EXPORT int jack_set_port_connect_callback(jack_client_t* ext_client, JackPortConnectCallback portconnect_callback, void* arg)
{
#ifdef __CLIENTDEBUG__
JackLibGlobals::CheckContext();
#endif
JackClient* client = (JackClient*)ext_client;
if (client == NULL) {
jack_error("jack_set_port_connect_callback called with a NULL client");
return -1;
} else {
return client->SetPortConnectCallback(portconnect_callback, arg);
}
}
EXPORT int jack_set_graph_order_callback(jack_client_t* ext_client, JackGraphOrderCallback graph_callback, void* arg)
{
#ifdef __CLIENTDEBUG__
......
......@@ -150,7 +150,7 @@ class JackNotifyChannelInterface
/*
The "sync" parameter allows to choose between "synchronous" and "asynchronous" notification
*/
virtual void ClientNotify(int refnum, const char* name, int notify, int sync, int value, int* result)
virtual void ClientNotify(int refnum, const char* name, int notify, int sync, int value1, int value2, int* result)
{}
};
......@@ -202,7 +202,7 @@ class JackServerNotifyChannelInterface
virtual void Close()
{}
virtual void ClientNotify(int refnum, int notify, int value)
virtual void ClientNotify(int refnum, int notify, int value1, int value2)
{}
};
......
......@@ -52,6 +52,7 @@ JackClient::JackClient(JackSynchro** table)
fClientRegistration = NULL;
fFreewheel = NULL;
fPortRegistration = NULL;
fPortConnect = NULL;
fSync = NULL;
fProcessArg = NULL;
fGraphOrderArg = NULL;
......@@ -62,6 +63,7 @@ JackClient::JackClient(JackSynchro** table)
fFreewheelArg = NULL;
fClientRegistrationArg = NULL;
fPortRegistrationArg = NULL;
fPortConnectArg = NULL;
fSyncArg = NULL;
fConditionnal = 0; // Temporary??
}
......@@ -117,12 +119,12 @@ void JackClient::SetupDriverSync(bool freewheel)
\brief Notification received from the server.
*/
int JackClient::ClientNotifyImp(int refnum, const char* name, int notify, int sync, int value)
int JackClient::ClientNotifyImp(int refnum, const char* name, int notify, int sync, int value1, int value)
{
return 0;
}
int JackClient::ClientNotify(int refnum, const char* name, int notify, int sync, int value)
int JackClient::ClientNotify(int refnum, const char* name, int notify, int sync, int value1, int value2)
{
int res = 0;
......@@ -130,11 +132,11 @@ int JackClient::ClientNotify(int refnum, const char* name, int notify, int sync,
switch (notify) {
case kAddClient:
res = ClientNotifyImp(refnum, name, notify, sync, value);
res = ClientNotifyImp(refnum, name, notify, sync, value1, value2);
break;
case kRemoveClient:
res = ClientNotifyImp(refnum, name, notify, sync, value);
res = ClientNotifyImp(refnum, name, notify, sync, value1, value2);
break;
case kActivateClient:
......@@ -164,9 +166,9 @@ int JackClient::ClientNotify(int refnum, const char* name, int notify, int sync,
break;
case kBufferSizeCallback:
JackLog("JackClient::kBufferSizeCallback buffer_size = %ld\n", value);
JackLog("JackClient::kBufferSizeCallback buffer_size = %ld\n", value1);
if (fBufferSize)
res = fBufferSize(value, fBufferSizeArg);
res = fBufferSize(value1, fBufferSizeArg);
break;
case kGraphOrderCallback:
......@@ -192,15 +194,15 @@ int JackClient::ClientNotify(int refnum, const char* name, int notify, int sync,
break;
case kPortRegistrationOnCallback:
JackLog("JackClient::kPortRegistrationOn port_index = %ld\n", value);
JackLog("JackClient::kPortRegistrationOn port_index = %ld\n", value1);
if (fPortRegistration)
fPortRegistration(value, 1, fPortRegistrationArg);
fPortRegistration(value1, 1, fPortRegistrationArg);
break;
case kPortRegistrationOffCallback:
JackLog("JackClient::kPortRegistrationOff port_index = %ld \n", value);
JackLog("JackClient::kPortRegistrationOff port_index = %ld \n", value1);
if (fPortRegistration)
fPortRegistration(value, 0, fPortRegistrationArg);
fPortRegistration(value1, 0, fPortRegistrationArg);
break;
case kXRunCallback:
......@@ -816,6 +818,20 @@ int JackClient::SetPortRegistrationCallback(JackPortRegistrationCallback callbac
}
}
int JackClient::SetPortConnectCallback(JackPortConnectCallback callback, void *arg)
{
if (IsActive()) {
jack_error("You cannot set callbacks on an active client");
return -1;
} else {
GetClientControl()->fCallback[kPortConnectCallback] = (callback != NULL);
GetClientControl()->fCallback[kPortDisconnectCallback] = (callback != NULL);
fPortConnectArg = arg;
fPortConnect = callback;
return 0;
}
}
//------------------
// Internal clients
//------------------
......
......@@ -62,8 +62,10 @@ class JackClient : public JackClientInterface, public JackRunnableInterface
JackClientRegistrationCallback fClientRegistration;
JackFreewheelCallback fFreewheel;
JackPortRegistrationCallback fPortRegistration;
JackPortConnectCallback fPortConnect;
JackTimebaseCallback fTimebase;
JackSyncCallback fSync;
void* fProcessArg;
void* fGraphOrderArg;
void* fXrunArg;
......@@ -73,6 +75,7 @@ class JackClient : public JackClientInterface, public JackRunnableInterface
void* fClientRegistrationArg;
void* fFreewheelArg;
void* fPortRegistrationArg;
void* fPortConnectArg;
void* fTimebaseArg;
void* fSyncArg;
int fConditionnal;
......@@ -92,7 +95,7 @@ class JackClient : public JackClientInterface, public JackRunnableInterface
void CallTimebaseCallback();
int RequestNewPos(jack_position_t* pos);
virtual int ClientNotifyImp(int refnum, const char* name, int notify, int sync, int value);
virtual int ClientNotifyImp(int refnum, const char* name, int notify, int sync, int value1, int value);
public:
......@@ -107,7 +110,7 @@ class JackClient : public JackClientInterface, public JackRunnableInterface
virtual JackEngineControl* GetEngineControl() const = 0;
// Notifications
virtual int ClientNotify(int refnum, const char* name, int notify, int sync, int value);
virtual int ClientNotify(int refnum, const char* name, int notify, int sync, int value1, int value2);
virtual int Activate();
virtual int Deactivate();
......@@ -151,7 +154,8 @@ class JackClient : public JackClientInterface, public JackRunnableInterface
virtual int SetClientRegistrationCallback(JackClientRegistrationCallback callback, void* arg);
virtual int SetFreewheelCallback(JackFreewheelCallback callback, void* arg);
virtual int SetPortRegistrationCallback(JackPortRegistrationCallback callback, void* arg);
virtual int SetPortConnectCallback(JackPortConnectCallback callback, void *arg);
// Internal clients
virtual char* GetInternalClientName(int ref);
virtual int InternalClientHandle(const char* client_name, jack_status_t* status);
......
......@@ -44,7 +44,7 @@ class EXPORT JackClientInterface
virtual int Close() = 0;
virtual int ClientNotify(int refnum, const char* name, int notify, int sync, int value) = 0;
virtual int ClientNotify(int refnum, const char* name, int notify, int sync, int value1, int value2) = 0;
virtual JackClientControl* GetClientControl() const = 0;
};
......
......@@ -136,10 +136,10 @@ JackEngineControl* JackDebugClient::GetEngineControl() const
\brief Notification received from the server.
*/
int JackDebugClient::ClientNotify(int refnum, const char* name, int notify, int sync, int value)
int JackDebugClient::ClientNotify(int refnum, const char* name, int notify, int sync, int value1, int value2)
{
CheckClient();
return fClient->ClientNotify( refnum, name, notify, sync, value);
return fClient->ClientNotify( refnum, name, notify, sync, value1, value2);
}
int JackDebugClient::Activate()
......@@ -486,6 +486,12 @@ int JackDebugClient::SetPortRegistrationCallback(JackPortRegistrationCallback ca
return fClient->SetPortRegistrationCallback(callback, arg);
}
int JackDebugClient::SetPortConnectCallback(JackPortConnectCallback callback, void *arg)
{
CheckClient();
return fClient->SetPortConnectCallback(callback, arg);
}
JackClientControl* JackDebugClient::GetClientControl() const
{
CheckClient();
......
......@@ -75,7 +75,7 @@ class JackDebugClient : public JackClient
virtual JackEngineControl* GetEngineControl() const;
// Notifications
int ClientNotify(int refnum, const char* name, int notify, int sync, int value);
int ClientNotify(int refnum, const char* name, int notify, int sync, int value1, int value2);
int Activate();
int Deactivate();
......@@ -119,6 +119,8 @@ class JackDebugClient : public JackClient
int SetClientRegistrationCallback(JackClientRegistrationCallback callback, void* arg);
int SetFreewheelCallback(JackFreewheelCallback callback, void* arg);
int SetPortRegistrationCallback(JackPortRegistrationCallback callback, void* arg);
int SetPortConnectCallback(JackPortConnectCallback callback, void *arg);
JackClientControl* GetClientControl() const;
void CheckClient() const;
......
......@@ -150,7 +150,7 @@ void JackDriver::SetupDriverSync(int ref, bool freewheel)
}
}
int JackDriver::ClientNotify(int refnum, const char* name, int notify, int sync, int value)
int JackDriver::ClientNotify(int refnum, const char* name, int notify, int sync, int value1, int value2)
{
switch (notify) {
......
......@@ -205,7 +205,7 @@ class EXPORT JackDriver : public JackDriverClient
virtual bool IsRealTime();
int ClientNotify(int refnum, const char* name, int notify, int sync, int value);
int ClientNotify(int refnum, const char* name, int notify, int sync, int value1, int value2);
void SetupDriverSync(int ref, bool freewheel);
......
......@@ -134,7 +134,7 @@ void JackEngine::ProcessNext(jack_time_t callback_usecs)
{
fLastSwitchUsecs = callback_usecs;
if (fGraphManager->RunNextGraph()) // True if the graph actually switched to a new state
fChannel->ClientNotify(ALL_CLIENTS, kGraphOrderCallback, 0);
fChannel->ClientNotify(ALL_CLIENTS, kGraphOrderCallback, 0, 0);
fSignal->SignalAll(); // Signal for threads waiting for next cycle
}
......@@ -191,12 +191,12 @@ void JackEngine::CheckXRun(jack_time_t callback_usecs) // REVOIR les conditions
if (status != NotTriggered && status != Finished) {
jack_error("JackEngine::XRun: client = %s was not run: state = %ld", client->GetClientControl()->fName, status);
fChannel->ClientNotify(ALL_CLIENTS, kXRunCallback, 0); // Notify all clients
fChannel->ClientNotify(ALL_CLIENTS, kXRunCallback, 0, 0); // Notify all clients
}
if (status == Finished && (long)(finished_date - callback_usecs) > 0) {
jack_error("JackEngine::XRun: client %s finished after current callback", client->GetClientControl()->fName);
fChannel->ClientNotify(ALL_CLIENTS, kXRunCallback, 0); // Notify all clients
fChannel->ClientNotify(ALL_CLIENTS, kXRunCallback, 0, 0); // Notify all clients
}
}
}
......@@ -206,7 +206,7 @@ void JackEngine::CheckXRun(jack_time_t callback_usecs) // REVOIR les conditions
// Notifications
//---------------
void JackEngine::NotifyClient(int refnum, int event, int sync, int value)
void JackEngine::NotifyClient(int refnum, int event, int sync, int value1, int value2)
{
JackClientInterface* client = fClientTable[refnum];
......@@ -214,21 +214,21 @@ void JackEngine::NotifyClient(int refnum, int event, int sync, int value)
if (!client) {
JackLog("JackEngine::NotifyClient: client not available anymore\n");
} else if (client->GetClientControl()->fCallback[event]) {
if (client->ClientNotify(refnum, client->GetClientControl()->fName, event, sync, value) < 0)
jack_error("NotifyClient fails name = %s event = %ld = val = %ld", client->GetClientControl()->fName, event, value);
if (client->ClientNotify(refnum, client->GetClientControl()->fName, event, sync, value1, value2) < 0)
jack_error("NotifyClient fails name = %s event = %ld = val1 = %ld val2 = %ld", client->GetClientControl()->fName, event, value1, value2);
} else {
JackLog("JackEngine::NotifyClient: no callback for event = %ld\n", event);
}
}
void JackEngine::NotifyClients(int event, int sync, int value)
void JackEngine::NotifyClients(int event, int sync, int value1, int value2)
{
for (int i = 0; i < CLIENT_NUM; i++) {
JackClientInterface* client = fClientTable[i];
if (client) {
if (client->GetClientControl()->fCallback[event]) {
if (client->ClientNotify(i, client->GetClientControl()->fName, event, sync, value) < 0)
jack_error("NotifyClient fails name = %s event = %ld = val = %ld", client->GetClientControl()->fName, event, value);
if (client->ClientNotify(i, client->GetClientControl()->fName, event, sync, value1, value2) < 0)
jack_error("NotifyClient fails name = %s event = %ld = val1 = %ld val2 = %ld", client->GetClientControl()->fName, event, value1, value2);
} else {
JackLog("JackEngine::NotifyClients: no callback for event = %ld\n", event);
}
......@@ -242,11 +242,11 @@ int JackEngine::NotifyAddClient(JackClientInterface* new_client, const char* nam
for (int i = 0; i < CLIENT_NUM; i++) {
JackClientInterface* old_client = fClientTable[i];
if (old_client) {
if (old_client->ClientNotify(refnum, name, kAddClient, true, 0) < 0) {
if (old_client->ClientNotify(refnum, name, kAddClient, true, 0, 0) < 0) {
jack_error("NotifyAddClient old_client fails name = %s", old_client->GetClientControl()->fName);
return -1;
}
if (new_client->ClientNotify(i, old_client->GetClientControl()->fName, kAddClient, true, 0) < 0) {
if (new_client->ClientNotify(i, old_client->GetClientControl()->fName, kAddClient, true, 0, 0) < 0) {
jack_error("NotifyAddClient new_client fails name = %s", name);
return -1;
}
......@@ -262,7 +262,7 @@ void JackEngine::NotifyRemoveClient(const char* name, int refnum)
for (int i = 0; i < CLIENT_NUM; i++) {
JackClientInterface* client = fClientTable[i];
if (client) {
client->ClientNotify(refnum, name, kRemoveClient, true, 0);
client->ClientNotify(refnum, name, kRemoveClient, true, 0, 0);
}
}
}
......@@ -272,42 +272,47 @@ void JackEngine::NotifyXRun(jack_time_t callback_usecs)
{
// Use the audio thread => request thread communication channel
fEngineControl->ResetFrameTime(callback_usecs);
fChannel->ClientNotify(ALL_CLIENTS, kXRunCallback, 0);
fChannel->ClientNotify(ALL_CLIENTS, kXRunCallback, 0, 0);
}
void JackEngine::NotifyXRun(int refnum)
{
if (refnum == ALL_CLIENTS) {
NotifyClients(kXRunCallback, false, 0);
NotifyClients(kXRunCallback, false, 0, 0);
} else {
NotifyClient(refnum, kXRunCallback, false, 0);
NotifyClient(refnum, kXRunCallback, false, 0, 0);
}
}
void JackEngine::NotifyGraphReorder()
{
NotifyClients(kGraphOrderCallback, false, 0);
NotifyClients(kGraphOrderCallback, false, 0, 0);
}
void JackEngine::NotifyBufferSize(jack_nframes_t nframes)
{
NotifyClients(kBufferSizeCallback, true, nframes);
NotifyClients(kBufferSizeCallback, true, nframes, 0);
}
void JackEngine::NotifyFreewheel(bool onoff)
{
fEngineControl->fRealTime = !onoff;
NotifyClients((onoff ? kStartFreewheelCallback : kStopFreewheelCallback), true, 0);
NotifyClients((onoff ? kStartFreewheelCallback : kStopFreewheelCallback), true, 0, 0);
}
void JackEngine::NotifyPortRegistation(jack_port_id_t port_index, bool onoff)
{
NotifyClients((onoff ? kPortRegistrationOnCallback : kPortRegistrationOffCallback), false, port_index);
NotifyClients((onoff ? kPortRegistrationOnCallback : kPortRegistrationOffCallback), false, port_index, 0);
}
void JackEngine::NotifyPortConnect(jack_port_id_t src, jack_port_id_t dst, bool onoff)
{
NotifyClients((onoff ? kPortConnectCallback : kPortDisconnectCallback), false, src, dst);
}
void JackEngine::NotifyActivate(int refnum)
{
NotifyClient(refnum, kActivateClient, true, 0);
NotifyClient(refnum, kActivateClient, true, 0, 0);
}
//----------------------------
......@@ -693,8 +698,11 @@ int JackEngine::PortConnect(int refnum, jack_port_id_t src, jack_port_id_t dst)
" \"%s\" is not active", client->GetClientControl()->fName);
return -1;
}
return fGraphManager->Connect(src, dst);
int res = fGraphManager->Connect(src, dst);
if (res == 0)
NotifyPortConnect(src, dst, true);
return res;
}
int JackEngine::PortDisconnect(int refnum, jack_port_id_t src, jack_port_id_t dst)
......@@ -702,12 +710,35 @@ int JackEngine::PortDisconnect(int refnum, jack_port_id_t src, jack_port_id_t ds
JackLog("JackEngine::PortDisconnect src = %d dst = %d\n", src, dst);
if (dst == ALL_PORTS) {
return fGraphManager->DisconnectAll(src);
/*
jack_int_t connections[CONNECTION_NUM];
JackPort* port = fGraphManager->GetPort(src);
fGraphManager->GetConnections(src, connections);
if (fGraphManager->DisconnectAll(src) < 0)
return -1;
if (port->fFlags & JackPortIsOutput) {
for (int i = 0; (i < CONNECTION_NUM) && (connections[i] != EMPTY); i++) {
NotifyPortConnect(src, connections[i], false);
}
} else {
for (int i = 0; (i < CONNECTION_NUM) && (connections[i] != EMPTY); i++) {
NotifyPortConnect(connections[i], src, false);
}
}
*/
if (fGraphManager->DisconnectAll(src) < 0)
return -1;
return 0;
} else if (fGraphManager->CheckPorts(src, dst) < 0) {
return -1;
} else if (fGraphManager->Disconnect(src, dst) == 0) {
NotifyPortConnect(src, dst, false);
return 0;
} else {
return (fGraphManager->CheckPorts(src, dst) < 0)
? -1
: fGraphManager->Disconnect(src, dst);
}
return -1;
}
}
//----------------------
......
......@@ -64,7 +64,10 @@ class JackEngine
int AllocateRefnum();
void ReleaseRefnum(int ref);
void NotifyClient(int refnum, int event, int sync, int value1, int value2);
void NotifyClients(int event, int sync, int value1, int value2);
public:
JackEngine(JackGraphManager* manager, JackSynchro** table, JackEngineControl* controler);
......@@ -84,7 +87,7 @@ class JackEngine
int ClientActivate(int refnum);
int ClientDeactivate(int refnum);
// Internal lient management
// Internal client management
int GetInternalClientName(int int_ref, char* name_res);
int InternalClientHandle(const char* client_name, int* status, int* int_ref);
int InternalClientUnload(int refnum, int* status);
......@@ -106,15 +109,14 @@ class JackEngine
// Graph
bool Process(jack_time_t callback_usecs);
// Notifications
void NotifyClient(int refnum, int event, int sync, int value);
void NotifyClients(int event, int sync, int value);
void NotifyXRun(jack_time_t callback_usecs);
// Notifications
void NotifyXRun(jack_time_t callback_usecs);
void NotifyXRun(int refnum);
void NotifyGraphReorder();
void NotifyBufferSize(jack_nframes_t nframes);
void NotifyFreewheel(bool onoff);
void NotifyPortRegistation(jack_port_id_t port_index, bool onoff);
void NotifyPortConnect(jack_port_id_t src, jack_port_id_t dst, bool onoff);
void NotifyActivate(int refnum);
};
......
......@@ -36,11 +36,11 @@ JackExternalClient::~JackExternalClient()
delete fChannel;
}
int JackExternalClient::ClientNotify(int refnum, const char* name, int notify, int sync, int value)
int JackExternalClient::ClientNotify(int refnum, const char* name, int notify, int sync, int value1, int value2)
{
int result = -1;
JackLog("JackExternalClient::ClientNotify ref = %ld name = %s notify = %ld\n", refnum, name, notify);
fChannel->ClientNotify(refnum, name, notify, sync, value, &result);
fChannel->ClientNotify(refnum, name, notify, sync, value1, value2, &result);
return result;
}
......
......@@ -49,7 +49,7 @@ class JackExternalClient : public JackClientInterface
int Open(const char* name, int refnum, int* shared_client);
int Close();
int ClientNotify(int refnum, const char* name, int notify, int sync, int value);
int ClientNotify(int refnum, const char* name, int notify, int sync, int value1, int value2);
JackClientControl* GetClientControl() const;
};
......
......@@ -397,7 +397,7 @@ void JackGraphManager::DisconnectAllInput(jack_port_id_t port_index)
for (int i = 0; i < PORT_NUM; i++) {
if (manager->IsConnected(i, port_index)) {
JackLog("JackGraphManager::Disconnect i = %ld port_index = %ld\n", i, port_index);
JackLog("JackGraphManager::Disconnect i = %ld port_index = %ld\n", i, port_index);
Disconnect(i, port_index);
}
}
......@@ -411,8 +411,8 @@ void JackGraphManager::DisconnectAllOutput(jack_port_id_t port_index)
JackConnectionManager* manager = WriteNextStateStart();
const jack_int_t* connections = manager->GetConnections(port_index);
while (connections[0] != EMPTY) {
Disconnect(port_index, connections[0]); // Warning : Disconnect shift port to left
while (connections[0] != EMPTY) {
Disconnect(port_index, connections[0]); // Warning : Disconnect shift port to left
}
WriteNextStateStop();
}
......@@ -424,13 +424,20 @@ int JackGraphManager::DisconnectAll(jack_port_id_t port_index)
JackPort* port = GetPort(port_index);
if (port->fFlags & JackPortIsOutput) {
DisconnectAllOutput(port_index);
DisconnectAllOutput(port_index);
} else {
DisconnectAllInput(port_index);