| @@ -107,7 +107,6 @@ void JackEngine::ShutDown() | |||||
| } | } | ||||
| } | } | ||||
| void JackEngine::NotifyQuit() | void JackEngine::NotifyQuit() | ||||
| { | { | ||||
| fChannel.NotifyQuit(); | fChannel.NotifyQuit(); | ||||
| @@ -128,9 +127,9 @@ int JackEngine::AllocateRefnum() | |||||
| return -1; | return -1; | ||||
| } | } | ||||
| void JackEngine::ReleaseRefnum(int ref) | |||||
| void JackEngine::ReleaseRefnum(int refnum) | |||||
| { | { | ||||
| fClientTable[ref] = NULL; | |||||
| fClientTable[refnum] = NULL; | |||||
| if (fEngineControl->fTemporary) { | if (fEngineControl->fTemporary) { | ||||
| int i; | int i; | ||||
| @@ -140,7 +139,7 @@ void JackEngine::ReleaseRefnum(int ref) | |||||
| } | } | ||||
| } | } | ||||
| if (i == CLIENT_NUM) { | if (i == CLIENT_NUM) { | ||||
| // last client and temporay case: quit the server | |||||
| // Last client and temporay case: quit the server | |||||
| jack_log("JackEngine::ReleaseRefnum server quit"); | jack_log("JackEngine::ReleaseRefnum server quit"); | ||||
| fEngineControl->fTemporary = false; | fEngineControl->fTemporary = false; | ||||
| throw JackTemporaryException(); | throw JackTemporaryException(); | ||||
| @@ -155,10 +154,10 @@ void JackEngine::ReleaseRefnum(int ref) | |||||
| void JackEngine::ProcessNext(jack_time_t cur_cycle_begin) | void JackEngine::ProcessNext(jack_time_t cur_cycle_begin) | ||||
| { | { | ||||
| fLastSwitchUsecs = cur_cycle_begin; | fLastSwitchUsecs = cur_cycle_begin; | ||||
| if (fGraphManager->RunNextGraph()) { // True if the graph actually switched to a new state | |||||
| if (fGraphManager->RunNextGraph()) { // True if the graph actually switched to a new state | |||||
| fChannel.Notify(ALL_CLIENTS, kGraphOrderCallback, 0); | fChannel.Notify(ALL_CLIENTS, kGraphOrderCallback, 0); | ||||
| } | } | ||||
| fSignal.Signal(); // Signal for threads waiting for next cycle | |||||
| fSignal.Signal(); // Signal for threads waiting for next cycle | |||||
| } | } | ||||
| void JackEngine::ProcessCurrent(jack_time_t cur_cycle_begin) | void JackEngine::ProcessCurrent(jack_time_t cur_cycle_begin) | ||||
| @@ -842,6 +841,17 @@ int JackEngine::ClientDeactivate(int refnum) | |||||
| } | } | ||||
| } | } | ||||
| void JackEngine::ClientKill(int refnum) | |||||
| { | |||||
| jack_log("JackEngine::ClientKill ref = %ld", refnum); | |||||
| if (ClientDeactivate(refnum) < 0) { | |||||
| jack_error("JackServer::ClientKill ref = %ld cannot be removed from the graph !!", refnum); | |||||
| } | |||||
| if (ClientExternalClose(refnum) < 0) { | |||||
| jack_error("JackServer::ClientKill ref = %ld cannot be closed", refnum); | |||||
| } | |||||
| } | |||||
| //----------------- | //----------------- | ||||
| // Port management | // Port management | ||||
| //----------------- | //----------------- | ||||
| @@ -74,7 +74,7 @@ class SERVER_EXPORT JackEngine : public JackLockAble | |||||
| bool GenerateUniqueName(char* name); | bool GenerateUniqueName(char* name); | ||||
| int AllocateRefnum(); | int AllocateRefnum(); | ||||
| void ReleaseRefnum(int ref); | |||||
| void ReleaseRefnum(int refnum); | |||||
| int ClientNotify(JackClientInterface* client, int refnum, const char* name, int notify, int sync, const char* message, int value1, int value2); | int ClientNotify(JackClientInterface* client, int refnum, const char* name, int notify, int sync, const char* message, int value1, int value2); | ||||
| @@ -106,6 +106,7 @@ class SERVER_EXPORT JackEngine : public JackLockAble | |||||
| // Client management | // Client management | ||||
| int ClientCheck(const char* name, int uuid, char* name_res, int protocol, int options, int* status); | int ClientCheck(const char* name, int uuid, char* name_res, int protocol, int options, int* status); | ||||
| int ClientExternalOpen(const char* name, int pid, int uuid, int* ref, int* shared_engine, int* shared_client, int* shared_graph_manager); | int ClientExternalOpen(const char* name, int pid, int uuid, int* ref, int* shared_engine, int* shared_client, int* shared_graph_manager); | ||||
| int ClientInternalOpen(const char* name, int* ref, JackEngineControl** shared_engine, JackGraphManager** shared_manager, JackClientInterface* client, bool wait); | int ClientInternalOpen(const char* name, int* ref, JackEngineControl** shared_engine, JackGraphManager** shared_manager, JackClientInterface* client, bool wait); | ||||
| @@ -114,6 +115,8 @@ class SERVER_EXPORT JackEngine : public JackLockAble | |||||
| int ClientActivate(int refnum, bool is_real_time); | int ClientActivate(int refnum, bool is_real_time); | ||||
| int ClientDeactivate(int refnum); | int ClientDeactivate(int refnum); | ||||
| void ClientKill(int refnum); | |||||
| int GetClientPID(const char* name); | int GetClientPID(const char* name); | ||||
| int GetClientRefNum(const char* name); | int GetClientRefNum(const char* name); | ||||
| @@ -164,6 +164,13 @@ class SERVER_EXPORT JackLockedEngine | |||||
| return (fEngine.CheckClient(refnum)) ? fEngine.ClientDeactivate(refnum) : -1; | return (fEngine.CheckClient(refnum)) ? fEngine.ClientDeactivate(refnum) : -1; | ||||
| CATCH_EXCEPTION_RETURN | CATCH_EXCEPTION_RETURN | ||||
| } | } | ||||
| void ClientKill(int refnum) | |||||
| { | |||||
| TRY_CALL | |||||
| JackLock lock(&fEngine); | |||||
| fEngine.ClientKill(refnum); | |||||
| CATCH_EXCEPTION | |||||
| } | |||||
| // Internal client management | // Internal client management | ||||
| int GetInternalClientName(int int_ref, char* name_res) | int GetInternalClientName(int int_ref, char* name_res) | ||||
| @@ -53,8 +53,7 @@ JackServer::JackServer(bool sync, bool temporary, int timeout, bool rt, int prio | |||||
| // regular freewheel driver because the freewheel driver needs to run in | // regular freewheel driver because the freewheel driver needs to run in | ||||
| // threaded mode when freewheel mode is active and needs to run as a slave | // threaded mode when freewheel mode is active and needs to run as a slave | ||||
| // when freewheel mode isn't active. | // when freewheel mode isn't active. | ||||
| JackFreewheelDriver *freewheelDriver = | |||||
| new JackFreewheelDriver(fEngine, GetSynchroTable()); | |||||
| JackFreewheelDriver* freewheelDriver = new JackFreewheelDriver(fEngine, GetSynchroTable()); | |||||
| fThreadedFreewheelDriver = new JackThreadedDriver(freewheelDriver); | fThreadedFreewheelDriver = new JackThreadedDriver(freewheelDriver); | ||||
| fFreewheelDriver = freewheelDriver; | fFreewheelDriver = freewheelDriver; | ||||
| @@ -299,17 +298,6 @@ void JackServer::Notify(int refnum, int notify, int value) | |||||
| } | } | ||||
| } | } | ||||
| void JackServer::ClientKill(int refnum) | |||||
| { | |||||
| jack_log("JackServer::ClientKill ref = %ld", refnum); | |||||
| if (fEngine->ClientDeactivate(refnum) < 0) { | |||||
| jack_error("JackServer::ClientKill ref = %ld cannot be removed from the graph !!", refnum); | |||||
| } | |||||
| if (fEngine->ClientExternalClose(refnum) < 0) { | |||||
| jack_error("JackServer::ClientKill ref = %ld cannot be closed", refnum); | |||||
| } | |||||
| } | |||||
| //---------------------- | //---------------------- | ||||
| // Backend management | // Backend management | ||||
| //---------------------- | //---------------------- | ||||
| @@ -82,8 +82,7 @@ class SERVER_EXPORT JackServer | |||||
| int SetFreewheel(bool onoff); | int SetFreewheel(bool onoff); | ||||
| int InternalClientLoad1(const char* client_name, const char* so_name, const char* objet_data, int options, int* int_ref, int uuid, int* status); | int InternalClientLoad1(const char* client_name, const char* so_name, const char* objet_data, int options, int* int_ref, int uuid, int* status); | ||||
| int InternalClientLoad2(const char* client_name, const char* so_name, const JSList * parameters, int options, int* int_ref, int uuid, int* status); | int InternalClientLoad2(const char* client_name, const char* so_name, const JSList * parameters, int options, int* int_ref, int uuid, int* status); | ||||
| void ClientKill(int refnum); | |||||
| // Transport management | // Transport management | ||||
| int ReleaseTimebase(int refnum); | int ReleaseTimebase(int refnum); | ||||
| int SetTimebaseCallback(int refnum, int conditional); | int SetTimebaseCallback(int refnum, int conditional); | ||||
| @@ -170,13 +170,13 @@ void JackSocketServerChannel::ClientKill(int fd) | |||||
| int refnum = elem.first; | int refnum = elem.first; | ||||
| assert(socket); | assert(socket); | ||||
| jack_log("JackSocketServerChannel::ClientKill ref = %d fd = %d", refnum, fd); | |||||
| if (refnum == -1) { // Should never happen... correspond to a client that started the socket but never opened... | if (refnum == -1) { // Should never happen... correspond to a client that started the socket but never opened... | ||||
| jack_log("Client was not opened : probably correspond to server_check"); | jack_log("Client was not opened : probably correspond to server_check"); | ||||
| } else { | } else { | ||||
| fServer->ClientKill(refnum); | |||||
| fServer->GetEngine()->ClientKill(refnum); | |||||
| } | } | ||||
| jack_log("JackSocketServerChannel::ClientKill ref = %d fd = %d", refnum, fd); | |||||
| fSocketTable.erase(fd); | fSocketTable.erase(fd); | ||||
| socket->Close(); | socket->Close(); | ||||
| delete socket; | delete socket; | ||||
| @@ -136,7 +136,7 @@ void JackClientPipeThread::ClientKill() | |||||
| } else if (fRefNum == 0) { // Correspond to a still not opened client. | } else if (fRefNum == 0) { // Correspond to a still not opened client. | ||||
| jack_log("Kill a not opened client %x", this); | jack_log("Kill a not opened client %x", this); | ||||
| } else { | } else { | ||||
| fServer->ClientKill(fRefNum); | |||||
| fServer->GetEngine()->ClientKill(fRefNum); | |||||
| } | } | ||||
| Close(); | Close(); | ||||
| @@ -324,7 +324,7 @@ int JackPortAudioDriver::SetBufferSize(jack_nframes_t buffer_size) | |||||
| goto error; | goto error; | ||||
| } | } | ||||
| // It seems that some ASIO drivers (like ASIO4All needs this to restart correctly); | |||||
| // It seems that some ASIO drivers (like ASIO4All) needs this to restart correctly; | |||||
| delete fPaDevices; | delete fPaDevices; | ||||
| fPaDevices = new PortAudioDevices(); | fPaDevices = new PortAudioDevices(); | ||||