diff --git a/common/JackAPI.cpp b/common/JackAPI.cpp index 2c8b8c7f..7475ec49 100644 --- a/common/JackAPI.cpp +++ b/common/JackAPI.cpp @@ -108,8 +108,8 @@ extern "C" JackPortConnectCallback connect_callback, void *arg); EXPORT int jack_set_port_rename_callback (jack_client_t *, - JackPortRenameCallback - rename_callback, void *arg); + JackPortRenameCallback + rename_callback, void *arg); EXPORT int jack_set_graph_order_callback (jack_client_t *, JackGraphOrderCallback graph_callback, void *); @@ -217,7 +217,7 @@ extern "C" EXPORT int jack_client_create_thread (jack_client_t* client, pthread_t *thread, int priority, - int realtime, // boolean + int realtime, // boolean thread_routine routine, void *arg); EXPORT int jack_drop_real_time_scheduling (pthread_t thread); @@ -1686,7 +1686,7 @@ EXPORT int jack_acquire_real_time_scheduling(pthread_t thread, int priority) EXPORT int jack_client_create_thread(jack_client_t* client, pthread_t *thread, int priority, - int realtime, /* boolean */ + int realtime, /* boolean */ thread_routine routine, void *arg) { @@ -1766,8 +1766,8 @@ EXPORT jack_intclient_t jack_internal_client_handle(jack_client_t* ext_client, c return 0; } else { jack_status_t my_status; - if (status == NULL) /* no status from caller? */ - status = &my_status; /* use local status word */ + if (status == NULL) /* no status from caller? */ + status = &my_status; /* use local status word */ *status = (jack_status_t)0; return client->InternalClientHandle(client_name, status); } @@ -1786,8 +1786,8 @@ EXPORT jack_intclient_t jack_internal_client_load_aux(jack_client_t* ext_client, jack_varargs_t va; jack_status_t my_status; - if (status == NULL) /* no status from caller? */ - status = &my_status; /* use local status word */ + if (status == NULL) /* no status from caller? */ + status = &my_status; /* use local status word */ *status = (jack_status_t)0; /* validate parameters */ @@ -1911,7 +1911,7 @@ EXPORT void jack_session_event_free(jack_session_event_t* ev) free((void *)ev->session_dir); free((void *)ev->client_uuid); if (ev->command_line) - free(ev->command_line); + free(ev->command_line); free(ev); } @@ -1964,16 +1964,16 @@ EXPORT void jack_session_commands_free( jack_session_command_t *cmds ) { int i=0; while(1) { - if (cmds[i].client_name) - free ((char *)cmds[i].client_name); - if (cmds[i].command) - free ((char *)cmds[i].command); - if (cmds[i].uuid) - free ((char *)cmds[i].uuid); - else - break; - - i += 1; + if (cmds[i].client_name) + free ((char *)cmds[i].client_name); + if (cmds[i].command) + free ((char *)cmds[i].command); + if (cmds[i].uuid) + free ((char *)cmds[i].uuid); + else + break; + + i += 1; } free(cmds); diff --git a/common/JackChannel.h b/common/JackChannel.h index 5c22a143..8dd3d666 100644 --- a/common/JackChannel.h +++ b/common/JackChannel.h @@ -127,23 +127,23 @@ class JackClientChannelInterface virtual void InternalClientUnload(int refnum, int int_ref, int* status, int* result) {} - virtual void SessionNotify(int refnum, const char* target, jack_session_event_type_t type, const char *path, jack_session_command_t **result) - {} + virtual void SessionNotify(int refnum, const char* target, jack_session_event_type_t type, const char *path, jack_session_command_t **result) + {} - virtual void SessionReply(int refnum, int *result) - {} + virtual void SessionReply(int refnum, int *result) + {} - virtual void GetUUIDForClientName( int refnum, const char *client_name, char *uuid_res, int *result ) - {} + virtual void GetUUIDForClientName( int refnum, const char *client_name, char *uuid_res, int *result ) + {} - virtual void GetClientNameForUUID( int refnum, const char *uuid, char *name_res, int *result ) - {} + virtual void GetClientNameForUUID( int refnum, const char *uuid, char *name_res, int *result ) + {} - virtual void ReserveClientName( int refnum, const char *client_name, const char *uuid, int *result ) - {} + virtual void ReserveClientName( int refnum, const char *client_name, const char *uuid, int *result ) + {} - virtual bool IsChannelThread() - { return false; } + virtual bool IsChannelThread() + { return false; } }; } diff --git a/common/JackClient.cpp b/common/JackClient.cpp index 1f033873..999b97b7 100644 --- a/common/JackClient.cpp +++ b/common/JackClient.cpp @@ -112,9 +112,9 @@ pthread_t JackClient::GetThreadID() } /*! - In "async" mode, the server does not synchronize itself on the output drivers, thus it would never "consume" the activations. - The synchronization primitives for drivers are setup in "flush" mode that to not keep unneeded activations. - Drivers synchro are setup in "flush" mode if server is "async" and NOT freewheel. + In "async" mode, the server does not synchronize itself on the output drivers, thus it would never "consume" the activations. + The synchronization primitives for drivers are setup in "flush" mode that to not keep unneeded activations. + Drivers synchro are setup in "flush" mode if server is "async" and NOT freewheel. */ void JackClient::SetupDriverSync(bool freewheel) { @@ -170,7 +170,7 @@ int JackClient::ClientNotify(int refnum, const char* name, int notify, int sync, case kAddClient: jack_log("JackClient::kAddClient fName = %s name = %s", GetClientControl()->fName, name); - if (fClientRegistration && strcmp(GetClientControl()->fName, name) != 0) { // Don't call the callback for the registering client itself + if (fClientRegistration && strcmp(GetClientControl()->fName, name) != 0) { // Don't call the callback for the registering client itself fClientRegistration(name, 1, fClientRegistrationArg); } break; @@ -276,23 +276,23 @@ int JackClient::ClientNotify(int refnum, const char* name, int notify, int sync, case kSessionCallback: jack_log("JackClient::kSessionCallback"); if (fSession) { - jack_session_event_t *event = (jack_session_event_t *) malloc( sizeof(jack_session_event_t) ); - char uuid_buf[32]; - event->type = (jack_session_event_type_t) value1; - event->session_dir = strdup( message ); - event->command_line = NULL; - event->flags = (jack_session_flags_t) 0; - snprintf( uuid_buf, sizeof(uuid_buf), "%d", GetClientControl()->fSessionID ); - event->client_uuid = strdup( uuid_buf ); + jack_session_event_t *event = (jack_session_event_t *) malloc( sizeof(jack_session_event_t) ); + char uuid_buf[32]; + event->type = (jack_session_event_type_t) value1; + event->session_dir = strdup( message ); + event->command_line = NULL; + event->flags = (jack_session_flags_t) 0; + snprintf( uuid_buf, sizeof(uuid_buf), "%d", GetClientControl()->fSessionID ); + event->client_uuid = strdup( uuid_buf ); - fImmediateSessionReply = false; + fImmediateSessionReply = false; fSession(event, fSessionArg); - if (fImmediateSessionReply) - res = 1; - else - res = 2; + if (fImmediateSessionReply) + res = 1; + else + res = 2; } break; } @@ -303,7 +303,7 @@ int JackClient::ClientNotify(int refnum, const char* name, int notify, int sync, /*! \brief We need to start thread before activating in the server, otherwise the FW driver - connected to the client may not be activated. + connected to the client may not be activated. */ int JackClient::Activate() { @@ -433,7 +433,7 @@ inline void JackClient::ExecuteThread() while (true) { CycleWaitAux(); CycleSignalAux(CallProcessCallback()); - } + } } inline jack_nframes_t JackClient::CycleWaitAux() @@ -1010,7 +1010,7 @@ int JackClient::SetSessionCallback(JackSessionCallback callback, void *arg) jack_error("You cannot set callbacks on an active client"); return -1; } else { - GetClientControl()->fCallback[kSessionCallback] = (callback != NULL); + GetClientControl()->fCallback[kSessionCallback] = (callback != NULL); fSessionArg = arg; fSession = callback; return 0; @@ -1088,18 +1088,18 @@ jack_session_command_t *JackClient::SessionNotify( const char* target, jack_sess int JackClient::SessionReply( jack_session_event_t *ev ) { if (ev->command_line) { - strncpy( GetClientControl()->fSessionCommand, ev->command_line, sizeof(GetClientControl()->fSessionCommand) ); + strncpy( GetClientControl()->fSessionCommand, ev->command_line, sizeof(GetClientControl()->fSessionCommand) ); } else { - GetClientControl()->fSessionCommand[0] = '\0'; + GetClientControl()->fSessionCommand[0] = '\0'; } GetClientControl()->fSessionFlags = ev->flags; jack_log( "JackClient::SessionReply... we are here" ); if (fChannel->IsChannelThread()) { - jack_log( "JackClient::SessionReply... in callback reply" ); - fImmediateSessionReply = true; - return 0; + jack_log( "JackClient::SessionReply... in callback reply" ); + fImmediateSessionReply = true; + return 0; } jack_log( "JackClient::SessionReply... out of cb" ); @@ -1116,7 +1116,7 @@ char* JackClient::GetUUIDForClientName(const char* client_name) fChannel->GetUUIDForClientName( GetClientControl()->fRefNum, client_name, uuid_res, &result); if(result) - return NULL; + return NULL; return strdup(uuid_res); } @@ -1128,7 +1128,7 @@ char* JackClient::GetClientNameForUUID(const char* uuid) fChannel->GetClientNameForUUID(GetClientControl()->fRefNum, uuid, name_res, &result); if(result) - return NULL; + return NULL; return strdup(name_res); } diff --git a/common/JackClient.h b/common/JackClient.h index 168adb48..d628ea6f 100644 --- a/common/JackClient.h +++ b/common/JackClient.h @@ -93,7 +93,7 @@ class JackClient : public JackClientInterface, public JackRunnableInterface JackSynchro* fSynchroTable; std::list fPortList; - bool fImmediateSessionReply; + bool fImmediateSessionReply; int StartThread(); void SetupDriverSync(bool freewheel); @@ -190,9 +190,9 @@ class JackClient : public JackClientInterface, public JackRunnableInterface void CycleSignal(int status); int SetProcessThread(JackThreadCallback fun, void *arg); - // Session api - virtual jack_session_command_t *SessionNotify(const char *target, jack_session_event_type_t type, const char *path); - virtual int SessionReply(jack_session_event_t *ev); + // Session api + virtual jack_session_command_t *SessionNotify(const char *target, jack_session_event_type_t type, const char *path); + virtual int SessionReply(jack_session_event_t *ev); char* GetUUIDForClientName(const char* client_name); char* GetClientNameForUUID(const char* uuid); int ReserveClientName(const char *name, const char* uuid); diff --git a/common/JackClientControl.h b/common/JackClientControl.h index 72e525c9..7a88c1e2 100644 --- a/common/JackClientControl.h +++ b/common/JackClientControl.h @@ -84,7 +84,7 @@ struct JackClientControl : public JackShmMemAble fTransportTimebase = false; fActive = false; - fSessionID = uuid; + fSessionID = uuid; } } POST_PACKED_STRUCTURE; diff --git a/common/JackControlAPI.cpp b/common/JackControlAPI.cpp index 31831605..0cde8d72 100644 --- a/common/JackControlAPI.cpp +++ b/common/JackControlAPI.cpp @@ -450,21 +450,21 @@ sigset_t jackctl_setup_signals( unsigned int flags) { - if ((waitEvent = CreateEvent(NULL, FALSE, FALSE, NULL)) == NULL) { + if ((waitEvent = CreateEvent(NULL, FALSE, FALSE, NULL)) == NULL) { jack_error("CreateEvent fails err = %ld", GetLastError()); return 0; } - (void) signal(SIGINT, do_nothing_handler); + (void) signal(SIGINT, do_nothing_handler); (void) signal(SIGABRT, do_nothing_handler); (void) signal(SIGTERM, do_nothing_handler); - return (sigset_t)waitEvent; + return (sigset_t)waitEvent; } void jackctl_wait_signals(sigset_t signals) { - if (WaitForSingleObject(waitEvent, INFINITE) != WAIT_OBJECT_0) { + if (WaitForSingleObject(waitEvent, INFINITE) != WAIT_OBJECT_0) { jack_error("WaitForSingleObject fails err = %ld", GetLastError()); } } diff --git a/common/JackDebugClient.cpp b/common/JackDebugClient.cpp index 8e413a73..9da70f29 100644 --- a/common/JackDebugClient.cpp +++ b/common/JackDebugClient.cpp @@ -36,8 +36,8 @@ namespace Jack JackDebugClient::JackDebugClient(JackClient * client) { - fTotalPortNumber = 1; // The total number of port opened and maybe closed. Historical view. - fOpenPortNumber = 0; // The current number of opened port. + fTotalPortNumber = 1; // The total number of port opened and maybe closed. Historical view. + fOpenPortNumber = 0; // The current number of opened port. fIsActivated = 0; fIsDeactivated = 0; fIsClosed = 0; @@ -210,8 +210,8 @@ int JackDebugClient::PortUnRegister(jack_port_id_t port_index) int res = fClient->PortUnRegister(port_index); fOpenPortNumber--; int i; - for (i = (fTotalPortNumber - 1); i >= 0; i--) { // We search the record into the history - if (fPortList[i].idport == port_index) { // We found the last record + for (i = (fTotalPortNumber - 1); i >= 0; i--) { // We search the record into the history + if (fPortList[i].idport == port_index) { // We found the last record if (fPortList[i].IsUnregistered != 0) *fStream << "!!! ERROR !!! : '" << fClientName << "' id deregistering port '" << fPortList[i].name << "' that have already been unregistered !" << endl; fPortList[i].IsUnregistered++; @@ -233,8 +233,8 @@ int JackDebugClient::PortConnect(const char* src, const char* dst) *fStream << "!!! ERROR !!! Trying to connect a port ( " << src << " to " << dst << ") while the client has not been activated !" << endl; int i; int res = fClient->PortConnect( src, dst); - for (i = (fTotalPortNumber - 1); i >= 0; i--) { // We search the record into the history - if (strcmp(fPortList[i].name, src) == 0) { // We found the last record in sources + for (i = (fTotalPortNumber - 1); i >= 0; i--) { // We search the record into the history + if (strcmp(fPortList[i].name, src) == 0) { // We found the last record in sources if (fPortList[i].IsUnregistered != 0) *fStream << "!!! ERROR !!! Connecting port " << src << " previoulsy unregistered !" << endl; fPortList[i].IsConnected++; @@ -293,8 +293,8 @@ int JackDebugClient::PortDisconnect(jack_port_id_t src) *fStream << "!!! ERROR !!! : Trying to disconnect port " << src << " while that client has not been activated !" << endl; int res = fClient->PortDisconnect(src); int i; - for (i = (fTotalPortNumber - 1); i >= 0; i--) { // We search the record into the history - if (fPortList[i].idport == src) { // We found the record in sources + for (i = (fTotalPortNumber - 1); i >= 0; i--) { // We search the record into the history + if (fPortList[i].idport == src) { // We found the record in sources if (fPortList[i].IsUnregistered != 0) *fStream << "!!! ERROR !!! : Disconnecting port " << src << " previoulsy unregistered !" << endl; fPortList[i].IsConnected--; diff --git a/common/JackDebugClient.h b/common/JackDebugClient.h index 27a7f7b1..032919bb 100644 --- a/common/JackDebugClient.h +++ b/common/JackDebugClient.h @@ -53,8 +53,8 @@ class JackDebugClient : public JackClient JackClient* fClient; std::ofstream* fStream; PortFollower fPortList[MAX_PORT_HISTORY]; // Arbitrary value... To be tuned... - int fTotalPortNumber; // The total number of port opened and maybe closed. Historical view. - int fOpenPortNumber; // The current number of opened port. + int fTotalPortNumber; // The total number of port opened and maybe closed. Historical view. + int fOpenPortNumber; // The current number of opened port. int fIsActivated; int fIsDeactivated; int fIsClosed; diff --git a/common/JackEngine.cpp b/common/JackEngine.cpp index e77e3ae7..b28a61db 100644 --- a/common/JackEngine.cpp +++ b/common/JackEngine.cpp @@ -139,7 +139,7 @@ void JackEngine::ReleaseRefnum(int ref) void JackEngine::ProcessNext(jack_time_t 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); fSignal.Signal(); // Signal for threads waiting for next cycle } @@ -431,7 +431,7 @@ bool JackEngine::GenerateUniqueName(char* name) if (length > JACK_CLIENT_NAME_SIZE - 4) { jack_error("%s exists and is too long to make unique", name); - return true; /* failure */ + return true; /* failure */ } /* generate a unique name by appending "-01".."-99" */ @@ -466,8 +466,8 @@ bool JackEngine::ClientCheckName(const char* name) } for (std::map::iterator i=fReservationMap.begin(); i!=fReservationMap.end(); i++) { - if (i->second == name) - return true; + if (i->second == name) + return true; } return false; @@ -481,13 +481,13 @@ int JackEngine::GetNewUUID() void JackEngine::EnsureUUID(int uuid) { if (uuid > fMaxUUID) - fMaxUUID = uuid+1; + fMaxUUID = uuid+1; for (int i = 0; i < CLIENT_NUM; i++) { JackClientInterface* client = fClientTable[i]; if (client && (client->GetClientControl()->fSessionID==uuid)) { - client->GetClientControl()->fSessionID = GetNewUUID(); - } + client->GetClientControl()->fSessionID = GetNewUUID(); + } } } @@ -519,18 +519,18 @@ int JackEngine::ClientExternalOpen(const char* name, int pid, int uuid, int* ref char real_name[JACK_CLIENT_NAME_SIZE+1]; if (uuid < 0) { - uuid = GetNewUUID(); - strncpy( real_name, name, JACK_CLIENT_NAME_SIZE ); + uuid = GetNewUUID(); + strncpy( real_name, name, JACK_CLIENT_NAME_SIZE ); } else { - std::map::iterator res = fReservationMap.find(uuid); - if (res != fReservationMap.end()) { - strncpy( real_name, res->second.c_str(), JACK_CLIENT_NAME_SIZE ); - fReservationMap.erase(uuid); - } else { - strncpy( real_name, name, JACK_CLIENT_NAME_SIZE ); - } - - EnsureUUID(uuid); + std::map::iterator res = fReservationMap.find(uuid); + if (res != fReservationMap.end()) { + strncpy( real_name, res->second.c_str(), JACK_CLIENT_NAME_SIZE ); + fReservationMap.erase(uuid); + } else { + strncpy( real_name, name, JACK_CLIENT_NAME_SIZE ); + } + + EnsureUUID(uuid); } jack_log("JackEngine::ClientExternalOpen: name = %s ", real_name); @@ -549,9 +549,9 @@ int JackEngine::ClientExternalOpen(const char* name, int pid, int uuid, int* ref } if (uuid < 0) - uuid = GetNewUUID(); + uuid = GetNewUUID(); else - EnsureUUID(uuid); + EnsureUUID(uuid); if (client->Open(real_name, pid, refnum, uuid, shared_client) < 0) { jack_error("Cannot open client"); @@ -916,17 +916,17 @@ int JackEngine::PortRename(int refnum, jack_port_id_t port, const char* name) void JackEngine::SessionNotify(int refnum, const char *target, jack_session_event_type_t type, const char *path, JackChannelTransaction *socket ) { if (fSessionPendingReplies != 0) { - JackSessionNotifyResult res(-1); - res.Write(socket); - jack_log("JackEngine::SessionNotify ... busy"); - return; + JackSessionNotifyResult res(-1); + res.Write(socket); + jack_log("JackEngine::SessionNotify ... busy"); + return; } for (int i = 0; i < CLIENT_NUM; i++) { JackClientInterface* client = fClientTable[i]; if (client && (client->GetClientControl()->fSessionID < 0)) { - client->GetClientControl()->fSessionID = GetNewUUID(); - } + client->GetClientControl()->fSessionID = GetNewUUID(); + } } fSessionResult = new JackSessionNotifyResult(); @@ -934,48 +934,48 @@ void JackEngine::SessionNotify(int refnum, const char *target, jack_session_even JackClientInterface* client = fClientTable[i]; if (client && client->GetClientControl()->fCallback[kSessionCallback]) { - // check if this is a notification to a specific client. - if (target!=NULL && strlen(target)!=0) { - if (strcmp(target, client->GetClientControl()->fName)) { - continue; - } - } + // check if this is a notification to a specific client. + if (target!=NULL && strlen(target)!=0) { + if (strcmp(target, client->GetClientControl()->fName)) { + continue; + } + } - // TODO: this is linux specific right now. need proper platform abstract way. + // TODO: this is linux specific right now. need proper platform abstract way. #define DIR_SEPARATOR '/' - char path_buf[JACK_PORT_NAME_SIZE]; - snprintf( path_buf, sizeof(path_buf), "%s%s%c", path, client->GetClientControl()->fName, DIR_SEPARATOR ); - int mkdir_res = mkdir( path_buf, 0777 ); - - if (mkdir_res != 0 && mkdir_res != EEXIST) - { - jack_error( "JackEngine::SessionNotify: can not create session directory '%s'", path_buf ); - } - // end of platform specific code. - - - int result = client->ClientNotify(i, client->GetClientControl()->fName, kSessionCallback, true, path_buf, (int) type, 0); - - if (result == 2) { - fSessionPendingReplies += 1; - } else if (result == 1) { - char uuid_buf[32]; - snprintf( uuid_buf, sizeof(uuid_buf), "%d", client->GetClientControl()->fSessionID ); - fSessionResult->fCommandList.push_back( JackSessionCommand( uuid_buf, - client->GetClientControl()->fName, - client->GetClientControl()->fSessionCommand, - client->GetClientControl()->fSessionFlags )); - } - } + char path_buf[JACK_PORT_NAME_SIZE]; + snprintf( path_buf, sizeof(path_buf), "%s%s%c", path, client->GetClientControl()->fName, DIR_SEPARATOR ); + int mkdir_res = mkdir( path_buf, 0777 ); + + if (mkdir_res != 0 && mkdir_res != EEXIST) + { + jack_error( "JackEngine::SessionNotify: can not create session directory '%s'", path_buf ); + } + // end of platform specific code. + + + int result = client->ClientNotify(i, client->GetClientControl()->fName, kSessionCallback, true, path_buf, (int) type, 0); + + if (result == 2) { + fSessionPendingReplies += 1; + } else if (result == 1) { + char uuid_buf[32]; + snprintf( uuid_buf, sizeof(uuid_buf), "%d", client->GetClientControl()->fSessionID ); + fSessionResult->fCommandList.push_back( JackSessionCommand( uuid_buf, + client->GetClientControl()->fName, + client->GetClientControl()->fSessionCommand, + client->GetClientControl()->fSessionFlags )); + } + } } if (fSessionPendingReplies == 0) { - fSessionResult->Write(socket); - delete fSessionResult; - fSessionResult = NULL; + fSessionResult->Write(socket); + delete fSessionResult; + fSessionResult = NULL; } else { - fSessionTransaction = socket; + fSessionTransaction = socket; } } @@ -986,14 +986,14 @@ void JackEngine::SessionReply(int refnum) snprintf( uuid_buf, sizeof(uuid_buf), "%d", client->GetClientControl()->fSessionID ); fSessionResult->fCommandList.push_back( JackSessionCommand( uuid_buf, client->GetClientControl()->fName, - client->GetClientControl()->fSessionCommand, - client->GetClientControl()->fSessionFlags )); + client->GetClientControl()->fSessionCommand, + client->GetClientControl()->fSessionFlags )); fSessionPendingReplies -= 1; if (fSessionPendingReplies == 0) { - fSessionResult->Write(fSessionTransaction); - delete fSessionResult; - fSessionResult = NULL; + fSessionResult->Write(fSessionTransaction); + delete fSessionResult; + fSessionResult = NULL; } } @@ -1002,11 +1002,11 @@ void JackEngine::GetUUIDForClientName(const char *client_name, char *uuid_res, i for (int i = 0; i < CLIENT_NUM; i++) { JackClientInterface* client = fClientTable[i]; - if (client && (strcmp(client_name, client->GetClientControl()->fName)==0)) { - snprintf(uuid_res, 32, "%d", client->GetClientControl()->fSessionID); - *result = 0; - return; - } + if (client && (strcmp(client_name, client->GetClientControl()->fName)==0)) { + snprintf(uuid_res, 32, "%d", client->GetClientControl()->fSessionID); + *result = 0; + return; + } } // did not find name. *result = -1; @@ -1018,17 +1018,17 @@ void JackEngine::GetClientNameForUUID(const char *uuid, char *name_res, int *res for (int i = 0; i < CLIENT_NUM; i++) { JackClientInterface* client = fClientTable[i]; - if (!client) - continue; + if (!client) + continue; - char uuid_buf[33]; - snprintf(uuid_buf, 32, "%d", client->GetClientControl()->fSessionID); + char uuid_buf[33]; + snprintf(uuid_buf, 32, "%d", client->GetClientControl()->fSessionID); - if (strcmp(uuid,uuid_buf) == 0) { - strncpy(name_res, client->GetClientControl()->fName, JACK_CLIENT_NAME_SIZE); - *result = 0; - return; - } + if (strcmp(uuid,uuid_buf) == 0) { + strncpy(name_res, client->GetClientControl()->fName, JACK_CLIENT_NAME_SIZE); + *result = 0; + return; + } } // did not find uuid. *result = -1; @@ -1040,8 +1040,8 @@ void JackEngine::ReserveClientName(const char *name, const char *uuid, int *resu if (ClientCheckName(name)) { - *result = -1; - return; + *result = -1; + return; } EnsureUUID(atoi(uuid)); diff --git a/common/JackEngine.h b/common/JackEngine.h index 9db1577d..fdd09a42 100644 --- a/common/JackEngine.h +++ b/common/JackEngine.h @@ -52,11 +52,11 @@ class SERVER_EXPORT JackEngine : public JackLockAble JackProcessSync fSignal; jack_time_t fLastSwitchUsecs; - int fSessionPendingReplies; - JackChannelTransaction *fSessionTransaction; - JackSessionNotifyResult *fSessionResult; - std::map fReservationMap; - int fMaxUUID; + int fSessionPendingReplies; + JackChannelTransaction *fSessionTransaction; + JackSessionNotifyResult *fSessionResult; + std::map fReservationMap; + int fMaxUUID; int ClientCloseAux(int refnum, JackClientInterface* client, bool wait); @@ -139,13 +139,13 @@ class SERVER_EXPORT JackEngine : public JackLockAble void NotifyFreewheel(bool onoff); void NotifyQuit(); - void SessionNotify( int refnum, const char *target, jack_session_event_type_t type, const char *path, JackChannelTransaction *socket ); - void SessionReply( int refnum ); - int GetNewUUID(); - void EnsureUUID(int uuid); - void GetUUIDForClientName(const char *client_name, char *uuid_res, int *result); - void GetClientNameForUUID(const char *uuid, char *name_res, int *result); - void ReserveClientName(const char *name, const char *uuid, int *result); + void SessionNotify( int refnum, const char *target, jack_session_event_type_t type, const char *path, JackChannelTransaction *socket ); + void SessionReply( int refnum ); + int GetNewUUID(); + void EnsureUUID(int uuid); + void GetUUIDForClientName(const char *client_name, char *uuid_res, int *result); + void GetClientNameForUUID(const char *uuid, char *name_res, int *result); + void ReserveClientName(const char *name, const char *uuid, int *result); }; diff --git a/common/JackExternalClient.h b/common/JackExternalClient.h index aa607ea4..c7c7fc42 100644 --- a/common/JackExternalClient.h +++ b/common/JackExternalClient.h @@ -39,7 +39,7 @@ class JackExternalClient : public JackClientInterface private: JackNotifyChannel fChannel; /*! Server/client communication channel */ - JackClientControl* fClientControl; /*! Client control in shared memory */ + JackClientControl* fClientControl; /*! Client control in shared memory */ public: diff --git a/common/JackInternalClient.h b/common/JackInternalClient.h index bf058da2..ae7dbebf 100644 --- a/common/JackInternalClient.h +++ b/common/JackInternalClient.h @@ -52,8 +52,8 @@ class JackInternalClient : public JackClient JackEngineControl* GetEngineControl() const; JackClientControl* GetClientControl() const; - static JackGraphManager* fGraphManager; /*! Shared memory Port manager */ - static JackEngineControl* fEngineControl; /*! Shared engine cotrol */ + static JackGraphManager* fGraphManager; /*! Shared memory Port manager */ + static JackEngineControl* fEngineControl; /*! Shared engine cotrol */ }; /*! diff --git a/common/JackInternalClientChannel.h b/common/JackInternalClientChannel.h index 789c4f97..f46cd291 100644 --- a/common/JackInternalClientChannel.h +++ b/common/JackInternalClientChannel.h @@ -112,10 +112,10 @@ class JackInternalClientChannel : public detail::JackClientChannelInterface *result = fServer->SetFreewheel(onoff); } - void SessionNotify( int refnum, const char *target, jack_session_event_type_t type, const char *path, jack_session_command_t **result ) - { - *result = NULL; - } + void SessionNotify( int refnum, const char *target, jack_session_event_type_t type, const char *path, jack_session_command_t **result ) + { + *result = NULL; + } void ReleaseTimebase(int refnum, int* result) { @@ -139,7 +139,7 @@ class JackInternalClientChannel : public detail::JackClientChannelInterface void InternalClientLoad(int refnum, const char* client_name, const char* so_name, const char* objet_data, int options, int* status, int* int_ref, int* result, int uuid) { - *result = fServer->InternalClientLoad(client_name, so_name, objet_data, options, int_ref, status, uuid); + *result = fServer->InternalClientLoad(client_name, so_name, objet_data, options, int_ref, status, uuid); } void InternalClientUnload(int refnum, int int_ref, int* status, int* result) diff --git a/common/JackLibAPI.cpp b/common/JackLibAPI.cpp index 0c035603..d9e7a817 100644 --- a/common/JackLibAPI.cpp +++ b/common/JackLibAPI.cpp @@ -57,7 +57,7 @@ int JackLibGlobals::fClientCount = 0; jack_client_t* jack_client_new_aux(const char* client_name, jack_options_t options, jack_status_t* status) { - jack_varargs_t va; /* variable arguments */ + jack_varargs_t va; /* variable arguments */ jack_status_t my_status; JackClient* client; @@ -68,8 +68,8 @@ jack_client_t* jack_client_new_aux(const char* client_name, jack_options_t optio jack_log("jack_client_new %s", client_name); - if (status == NULL) /* no status from caller? */ - status = &my_status; /* use local status word */ + if (status == NULL) /* no status from caller? */ + status = &my_status; /* use local status word */ *status = (jack_status_t)0; /* validate parameters */ diff --git a/common/JackLibClient.h b/common/JackLibClient.h index 12c13c86..3095e525 100644 --- a/common/JackLibClient.h +++ b/common/JackLibClient.h @@ -37,7 +37,7 @@ class JackLibClient : public JackClient private: - JackShmReadWritePtr1 fClientControl; /*! Shared client control */ + JackShmReadWritePtr1 fClientControl; /*! Shared client control */ public: diff --git a/common/JackLockedEngine.h b/common/JackLockedEngine.h index 792e97c9..0e646654 100644 --- a/common/JackLockedEngine.h +++ b/common/JackLockedEngine.h @@ -307,43 +307,43 @@ class SERVER_EXPORT JackLockedEngine CATCH_EXCEPTION } - void SessionNotify(int refnum, const char* target, jack_session_event_type_t type, const char *path, JackChannelTransaction *socket) - { + void SessionNotify(int refnum, const char* target, jack_session_event_type_t type, const char *path, JackChannelTransaction *socket) + { TRY_CALL JackLock lock(&fEngine); fEngine.SessionNotify(refnum, target, type, path, socket); CATCH_EXCEPTION - } + } - void SessionReply(int refnum) - { + void SessionReply(int refnum) + { TRY_CALL JackLock lock(&fEngine); fEngine.SessionReply(refnum); CATCH_EXCEPTION - } + } - void GetUUIDForClientName(const char *client_name, char *uuid_res, int *result) - { + void GetUUIDForClientName(const char *client_name, char *uuid_res, int *result) + { TRY_CALL JackLock lock(&fEngine); - fEngine.GetUUIDForClientName(client_name, uuid_res, result); + fEngine.GetUUIDForClientName(client_name, uuid_res, result); CATCH_EXCEPTION - } - void GetClientNameForUUID(const char *uuid, char *name_res, int *result) - { + } + void GetClientNameForUUID(const char *uuid, char *name_res, int *result) + { TRY_CALL JackLock lock(&fEngine); - fEngine.GetClientNameForUUID(uuid, name_res, result); + fEngine.GetClientNameForUUID(uuid, name_res, result); CATCH_EXCEPTION - } - void ReserveClientName(const char *name, const char *uuid, int *result) - { + } + void ReserveClientName(const char *name, const char *uuid, int *result) + { TRY_CALL JackLock lock(&fEngine); - fEngine.ReserveClientName(name, uuid, result); + fEngine.ReserveClientName(name, uuid, result); CATCH_EXCEPTION - } + } }; } // end of namespace diff --git a/common/JackRequest.h b/common/JackRequest.h index 2ec1aff0..62b4cc45 100644 --- a/common/JackRequest.h +++ b/common/JackRequest.h @@ -67,11 +67,11 @@ struct JackRequest kInternalClientUnload = 30, kPortRename = 31, kNotification = 32, - kSessionNotify = 33, - kSessionReply = 34, - kGetClientByUUID = 35, - kReserveClientName = 36, - kGetUUIDByClient = 37 + kSessionNotify = 33, + kSessionReply = 34, + kGetClientByUUID = 35, + kReserveClientName = 36, + kGetUUIDByClient = 37 }; RequestType fType; @@ -104,7 +104,7 @@ struct JackRequest struct JackResult { - int fResult; + int fResult; JackResult(): fResult( -1) {} @@ -215,7 +215,7 @@ struct JackClientOpenRequest : public JackRequest { snprintf(fName, sizeof(fName), "%s", name); fPID = pid; - fUUID = uuid; + fUUID = uuid; } int Read(JackChannelTransaction* trans) @@ -1094,10 +1094,10 @@ struct JackSessionCommand JackSessionCommand( const char *uuid, const char *clientname, const char *command, jack_session_flags_t flags ) { - strncpy( fUUID, uuid, sizeof(fUUID)); - strncpy( fClientName, clientname, sizeof(fClientName)); - strncpy( fCommand, command, sizeof(fCommand)); - fFlags = flags; + strncpy( fUUID, uuid, sizeof(fUUID)); + strncpy( fClientName, clientname, sizeof(fClientName)); + strncpy( fCommand, command, sizeof(fCommand)); + fFlags = flags; } }; @@ -1116,34 +1116,34 @@ struct JackSessionNotifyResult : public JackResult int Read(JackChannelTransaction* trans) { CheckRes(JackResult::Read(trans)); - while(1) { - JackSessionCommand buffer; + while(1) { + JackSessionCommand buffer; - CheckRes(trans->Read(buffer.fUUID, sizeof(buffer.fUUID))); - if (buffer.fUUID[0] == '\0') - break; + CheckRes(trans->Read(buffer.fUUID, sizeof(buffer.fUUID))); + if (buffer.fUUID[0] == '\0') + break; - CheckRes(trans->Read(buffer.fClientName, sizeof(buffer.fClientName))); - CheckRes(trans->Read(buffer.fCommand, sizeof(buffer.fCommand))); - CheckRes(trans->Read(&(buffer.fFlags), sizeof(buffer.fFlags))); + CheckRes(trans->Read(buffer.fClientName, sizeof(buffer.fClientName))); + CheckRes(trans->Read(buffer.fCommand, sizeof(buffer.fCommand))); + CheckRes(trans->Read(&(buffer.fFlags), sizeof(buffer.fFlags))); - fCommandList.push_back(buffer); - } + fCommandList.push_back(buffer); + } return 0; } int Write(JackChannelTransaction* trans) { - char terminator[32]; - terminator[0] = '\0'; + char terminator[32]; + terminator[0] = '\0'; CheckRes(JackResult::Write(trans)); - for (std::list::iterator i=fCommandList.begin(); i!=fCommandList.end(); i++) { - CheckRes(trans->Write(i->fUUID, sizeof(i->fUUID))); - CheckRes(trans->Write(i->fClientName, sizeof(i->fClientName))); - CheckRes(trans->Write(i->fCommand, sizeof(i->fCommand))); - CheckRes(trans->Write(&(i->fFlags), sizeof(i->fFlags))); - } + for (std::list::iterator i=fCommandList.begin(); i!=fCommandList.end(); i++) { + CheckRes(trans->Write(i->fUUID, sizeof(i->fUUID))); + CheckRes(trans->Write(i->fClientName, sizeof(i->fClientName))); + CheckRes(trans->Write(i->fCommand, sizeof(i->fCommand))); + CheckRes(trans->Write(&(i->fFlags), sizeof(i->fFlags))); + } CheckRes(trans->Write(terminator, sizeof(terminator))); return 0; } @@ -1167,10 +1167,10 @@ struct JackSessionNotifyRequest : public JackRequest : JackRequest(JackRequest::kSessionNotify), fEventType(type), fRefNum(refnum) { snprintf(fPath, sizeof(fPath), "%s", path); - if (dst) - snprintf(fDst, sizeof(fDst), "%s", dst); - else - fDst[0] = '\0'; + if (dst) + snprintf(fDst, sizeof(fDst), "%s", dst); + else + fDst[0] = '\0'; } int Read(JackChannelTransaction* trans) @@ -1289,7 +1289,7 @@ struct JackGetUUIDRequest : public JackRequest JackGetUUIDRequest(const char* client_name) : JackRequest(JackRequest::kGetUUIDByClient) { - strncpy(fName, client_name, sizeof(fName)); + strncpy(fName, client_name, sizeof(fName)); } int Read(JackChannelTransaction* trans) @@ -1318,7 +1318,7 @@ struct JackGetClientNameRequest : public JackRequest JackGetClientNameRequest(const char* uuid) : JackRequest(JackRequest::kGetClientByUUID) { - strncpy(fUUID, uuid, sizeof(fUUID)); + strncpy(fUUID, uuid, sizeof(fUUID)); } int Read(JackChannelTransaction* trans) @@ -1349,8 +1349,8 @@ struct JackReserveNameRequest : public JackRequest JackReserveNameRequest(int refnum, const char *name, const char* uuid) : JackRequest(JackRequest::kReserveClientName), fRefNum(refnum) { - strncpy(fName, name, sizeof(fName)); - strncpy(fUUID, uuid, sizeof(fUUID)); + strncpy(fName, name, sizeof(fName)); + strncpy(fUUID, uuid, sizeof(fUUID)); } int Read(JackChannelTransaction* trans) diff --git a/common/JackServerAPI.cpp b/common/JackServerAPI.cpp index 20320526..34b7283d 100644 --- a/common/JackServerAPI.cpp +++ b/common/JackServerAPI.cpp @@ -53,7 +53,7 @@ using namespace Jack; jack_client_t* jack_client_new_aux(const char* client_name, jack_options_t options, jack_status_t* status) { - jack_varargs_t va; /* variable arguments */ + jack_varargs_t va; /* variable arguments */ jack_status_t my_status; JackClient* client; @@ -64,8 +64,8 @@ jack_client_t* jack_client_new_aux(const char* client_name, jack_options_t optio jack_log("jack_client_new %s", client_name); - if (status == NULL) /* no status from caller? */ - status = &my_status; /* use local status word */ + if (status == NULL) /* no status from caller? */ + status = &my_status; /* use local status word */ *status = (jack_status_t)0; /* validate parameters */ @@ -191,7 +191,7 @@ EXPORT int jack_client_close(jack_client_t* ext_client) } else { res = client->Close(); delete client; - JackServerGlobals::Destroy(); // jack server destruction + JackServerGlobals::Destroy(); // jack server destruction jack_log("jack_client_close res = %d", res); } JackGlobals::fOpenMutex->Unlock(); diff --git a/common/JackThread.h b/common/JackThread.h index b8f5d3c0..34dd798c 100644 --- a/common/JackThread.h +++ b/common/JackThread.h @@ -106,7 +106,7 @@ class SERVER_EXPORT JackThreadInterface int DropSelfRealTime(); // Used when called from thread itself pthread_t GetThreadID(); - bool IsThread(); + bool IsThread(); static int AcquireRealTimeImp(pthread_t thread, int priority); static int AcquireRealTimeImp(pthread_t thread, int priority, UInt64 period, UInt64 computation, UInt64 constraint); diff --git a/common/jack/session.h b/common/jack/session.h index 8c13bfa9..f44048c0 100644 --- a/common/jack/session.h +++ b/common/jack/session.h @@ -133,8 +133,8 @@ typedef void (*JackSessionCallback)(jack_session_event_t *event, void *arg); * @return 0 on success, otherwise a non-zero error code */ int jack_set_session_callback(jack_client_t *client, - JackSessionCallback session_callback, - void *arg) JACK_WEAK_EXPORT; + JackSessionCallback session_callback, + void *arg) JACK_WEAK_EXPORT; /** * reply to a session_event @@ -162,18 +162,18 @@ void jack_session_event_free (jack_session_event_t *event); /** * @defgroup JackSessionManagerAPI this API is intended for a sessionmanager. - * this API could be server specific. if we dont reach consensus here, - * we can just drop it. - * i know its a bit clumsy. - * but this api isnt required to be as stable as the client api. + * this API could be server specific. if we dont reach consensus here, + * we can just drop it. + * i know its a bit clumsy. + * but this api isnt required to be as stable as the client api. * @{ */ typedef struct { - const char *uuid; - const char *client_name; - const char *command; - jack_session_flags_t flags; + const char *uuid; + const char *client_name; + const char *command; + jack_session_flags_t flags; } jack_session_command_t; /** @@ -185,9 +185,9 @@ typedef struct { */ jack_session_command_t *jack_session_notify (jack_client_t* client, - const char *target, - jack_session_event_type_t type, - const char *path ) JACK_WEAK_EXPORT; + const char *target, + jack_session_event_type_t type, + const char *path ) JACK_WEAK_EXPORT; /** * free the memory allocated by a session command. diff --git a/common/jack/types.h b/common/jack/types.h index 9cd1ca97..7ca49e7d 100644 --- a/common/jack/types.h +++ b/common/jack/types.h @@ -29,12 +29,12 @@ typedef int32_t jack_shmsize_t; /** * Type used to represent sample frame counts. */ -typedef uint32_t jack_nframes_t; +typedef uint32_t jack_nframes_t; /** * Maximum value that can be stored in jack_nframes_t */ -#define JACK_MAX_FRAMES (4294967295U) /* This should be UINT32_MAX, but C++ has a problem with that. */ +#define JACK_MAX_FRAMES (4294967295U) /* This should be UINT32_MAX, but C++ has a problem with that. */ /** * Type used to represent the value of free running @@ -284,9 +284,9 @@ enum JackPortFlags { /** * JackPortIsTerminal means: * - * for an input port: the data received by the port + * for an input port: the data received by the port * will not be passed on or made - * available at any other port + * available at any other port * * for an output port: the data available at the port * does not originate from any other port @@ -461,20 +461,20 @@ typedef enum { JackTransportRolling = 1, /**< Transport playing */ JackTransportLooping = 2, /**< For OLD_TRANSPORT, now ignored */ JackTransportStarting = 3, /**< Waiting for sync ready */ - JackTransportNetStarting = 4, /**< Waiting for sync ready on the network*/ + JackTransportNetStarting = 4, /**< Waiting for sync ready on the network*/ } jack_transport_state_t; -typedef uint64_t jack_unique_t; /**< Unique ID (opaque) */ +typedef uint64_t jack_unique_t; /**< Unique ID (opaque) */ /** * Optional struct jack_position_t fields. */ typedef enum { - JackPositionBBT = 0x10, /**< Bar, Beat, Tick */ - JackPositionTimecode = 0x20, /**< External timecode */ - JackBBTFrameOffset = 0x40, /**< Frame offset of BBT information */ + JackPositionBBT = 0x10, /**< Bar, Beat, Tick */ + JackPositionTimecode = 0x20, /**< External timecode */ + JackBBTFrameOffset = 0x40, /**< Frame offset of BBT information */ JackAudioVideoRatio = 0x80, /**< audio frames per video frame */ JackVideoFrameOffset = 0x100 /**< frame offset of first video frame */ @@ -487,31 +487,31 @@ typedef enum { typedef struct { /* these four cannot be set from clients: the server sets them */ - jack_unique_t unique_1; /**< unique ID */ - jack_time_t usecs; /**< monotonic, free-rolling */ - jack_nframes_t frame_rate; /**< current frame rate (per second) */ - jack_nframes_t frame; /**< frame number, always present */ + jack_unique_t unique_1; /**< unique ID */ + jack_time_t usecs; /**< monotonic, free-rolling */ + jack_nframes_t frame_rate; /**< current frame rate (per second) */ + jack_nframes_t frame; /**< frame number, always present */ - jack_position_bits_t valid; /**< which other fields are valid */ + jack_position_bits_t valid; /**< which other fields are valid */ /* JackPositionBBT fields: */ - int32_t bar; /**< current bar */ - int32_t beat; /**< current beat-within-bar */ - int32_t tick; /**< current tick-within-beat */ - double bar_start_tick; - - float beats_per_bar; /**< time signature "numerator" */ - float beat_type; /**< time signature "denominator" */ - double ticks_per_beat; - double beats_per_minute; - - /* JackPositionTimecode fields: (EXPERIMENTAL: could change) */ - double frame_time; /**< current time in seconds */ - double next_time; /**< next sequential frame_time + int32_t bar; /**< current bar */ + int32_t beat; /**< current beat-within-bar */ + int32_t tick; /**< current tick-within-beat */ + double bar_start_tick; + + float beats_per_bar; /**< time signature "numerator" */ + float beat_type; /**< time signature "denominator" */ + double ticks_per_beat; + double beats_per_minute; + + /* JackPositionTimecode fields: (EXPERIMENTAL: could change) */ + double frame_time; /**< current time in seconds */ + double next_time; /**< next sequential frame_time (unless repositioned) */ /* JackBBTFrameOffset fields: */ - jack_nframes_t bbt_offset; /**< frame offset for the BBT fields + jack_nframes_t bbt_offset; /**< frame offset for the BBT fields (the given bar, beat, and tick values actually refer to a time frame_offset frames before the @@ -545,10 +545,10 @@ typedef struct { /* For binary compatibility, new fields should be allocated from * this padding area with new valid bits controlling access, so * the existing structure size and offsets are preserved. */ - int32_t padding[7]; + int32_t padding[7]; /* When (unique_1 == unique_2) the contents are consistent. */ - jack_unique_t unique_2; /**< unique ID */ + jack_unique_t unique_2; /**< unique ID */ } jack_position_t; @@ -625,11 +625,11 @@ typedef void (*JackTimebaseCallback)(jack_transport_state_t state, */ typedef enum { - JackTransportState = 0x1, /**< Transport state */ - JackTransportPosition = 0x2, /**< Frame number */ - JackTransportLoop = 0x4, /**< Loop boundaries (ignored) */ - JackTransportSMPTE = 0x8, /**< SMPTE (ignored) */ - JackTransportBBT = 0x10 /**< Bar, Beat, Tick */ + JackTransportState = 0x1, /**< Transport state */ + JackTransportPosition = 0x2, /**< Frame number */ + JackTransportLoop = 0x4, /**< Loop boundaries (ignored) */ + JackTransportSMPTE = 0x8, /**< SMPTE (ignored) */ + JackTransportBBT = 0x10 /**< Bar, Beat, Tick */ } jack_transport_bits_t; @@ -643,17 +643,17 @@ typedef struct { /* these two cannot be set from clients: the server sets them */ - jack_nframes_t frame_rate; /**< current frame rate (per second) */ - jack_time_t usecs; /**< monotonic, free-rolling */ + jack_nframes_t frame_rate; /**< current frame rate (per second) */ + jack_time_t usecs; /**< monotonic, free-rolling */ - jack_transport_bits_t valid; /**< which fields are legal to read */ + jack_transport_bits_t valid; /**< which fields are legal to read */ jack_transport_state_t transport_state; jack_nframes_t frame; jack_nframes_t loop_start; jack_nframes_t loop_end; - long smpte_offset; /**< SMPTE offset (from frame 0) */ - float smpte_frame_rate; /**< 29.97, 30, 24 etc. */ + long smpte_offset; /**< SMPTE offset (from frame 0) */ + float smpte_frame_rate; /**< 29.97, 30, 24 etc. */ int bar; int beat; diff --git a/common/varargs.h b/common/varargs.h index 56f6a606..2d8a0493 100644 --- a/common/varargs.h +++ b/common/varargs.h @@ -32,15 +32,15 @@ extern "C" /* variable argument structure */ typedef struct { - char *server_name; /* server name */ - char *load_name; /* load module name */ - char *load_init; /* initialization string */ - int session_id; /* requested session_id */ + char *server_name; /* server name */ + char *load_name; /* load module name */ + char *load_init; /* initialization string */ + int session_id; /* requested session_id */ } jack_varargs_t; static const char* jack_default_server_name (void) - { + { const char *server_name; if ((server_name = getenv("JACK_DEFAULT_SERVER")) == NULL) server_name = "default"; @@ -48,14 +48,14 @@ extern "C" } static inline void jack_varargs_init (jack_varargs_t *va) - { + { memset (va, 0, sizeof(jack_varargs_t)); va->server_name = (char*)jack_default_server_name(); - va->session_id = -1; + va->session_id = -1; } static inline void jack_varargs_parse (jack_options_t options, va_list ap, jack_varargs_t *va) - { + { // initialize default settings jack_varargs_init (va); diff --git a/example-clients/session_notify.c b/example-clients/session_notify.c index 7bc4fc02..e8a6d517 100644 --- a/example-clients/session_notify.c +++ b/example-clients/session_notify.c @@ -30,7 +30,7 @@ #include #include -char *package; /* program name */ +char *package; /* program name */ jack_client_t *client; jack_session_event_type_t notify_type; @@ -38,147 +38,147 @@ char *save_path = NULL; void jack_shutdown(void *arg) { - fprintf(stderr, "JACK shut down, exiting ...\n"); - exit(1); + fprintf(stderr, "JACK shut down, exiting ...\n"); + exit(1); } void signal_handler(int sig) { - jack_client_close(client); - fprintf(stderr, "signal received, exiting ...\n"); - exit(0); + jack_client_close(client); + fprintf(stderr, "signal received, exiting ...\n"); + exit(0); } void parse_arguments(int argc, char *argv[]) { - /* basename $0 */ - package = strrchr(argv[0], '/'); - if (package == 0) - package = argv[0]; - else - package++; - - if (argc==2) { - if( !strcmp( argv[1], "quit" ) ) { - notify_type = JackSessionSaveAndQuit; - return; - } - } - if (argc==3) { - if( !strcmp( argv[1], "save" ) ) { - notify_type = JackSessionSave; - save_path = argv[2]; - return; - } - - } - fprintf(stderr, "usage: %s quit|save [path]\n", package); - exit(9); + /* basename $0 */ + package = strrchr(argv[0], '/'); + if (package == 0) + package = argv[0]; + else + package++; + + if (argc==2) { + if( !strcmp( argv[1], "quit" ) ) { + notify_type = JackSessionSaveAndQuit; + return; + } + } + if (argc==3) { + if( !strcmp( argv[1], "save" ) ) { + notify_type = JackSessionSave; + save_path = argv[2]; + return; + } + + } + fprintf(stderr, "usage: %s quit|save [path]\n", package); + exit(9); } typedef struct { - char name[32]; - char uuid[16]; + char name[32]; + char uuid[16]; } uuid_map_t; JSList *uuid_map = NULL; void add_uuid_mapping( const char *uuid ) { - char *clientname = jack_get_client_name_by_uuid( client, uuid ); - if( !clientname ) { - printf( "error... cant find client for uuid %s", uuid ); + char *clientname = jack_get_client_name_by_uuid( client, uuid ); + if( !clientname ) { + printf( "error... cant find client for uuid %s", uuid ); - return; - } + return; + } - uuid_map_t *mapping = malloc( sizeof(uuid_map_t) ); - snprintf( mapping->uuid, sizeof(mapping->uuid), "%s", uuid ); - snprintf( mapping->name, sizeof(mapping->name), "%s", clientname ); - uuid_map = jack_slist_append( uuid_map, mapping ); + uuid_map_t *mapping = malloc( sizeof(uuid_map_t) ); + snprintf( mapping->uuid, sizeof(mapping->uuid), "%s", uuid ); + snprintf( mapping->name, sizeof(mapping->name), "%s", clientname ); + uuid_map = jack_slist_append( uuid_map, mapping ); } char *map_port_name_to_uuid_port( const char *port_name ) { - JSList *node; - char retval[300]; - char *port_component = strchr( port_name,':' ); - char *client_component = strdup( port_name ); - strchr( client_component, ':' )[0] = '\0'; - - sprintf( retval, "%s", port_name ); - - for( node=uuid_map; node; node=jack_slist_next(node) ) { - uuid_map_t *mapping = node->data; - if( !strcmp( mapping->name, client_component ) ) { - sprintf( retval, "%s%s", mapping->uuid, port_component ); - break; - } - } - - return strdup(retval); + JSList *node; + char retval[300]; + char *port_component = strchr( port_name,':' ); + char *client_component = strdup( port_name ); + strchr( client_component, ':' )[0] = '\0'; + + sprintf( retval, "%s", port_name ); + + for( node=uuid_map; node; node=jack_slist_next(node) ) { + uuid_map_t *mapping = node->data; + if( !strcmp( mapping->name, client_component ) ) { + sprintf( retval, "%s%s", mapping->uuid, port_component ); + break; + } + } + + return strdup(retval); } int main(int argc, char *argv[]) { - parse_arguments(argc, argv); - jack_session_command_t *retval; - int k,i,j; - - - /* become a JACK client */ - if ((client = jack_client_open(package, JackNullOption, NULL)) == 0) { - fprintf(stderr, "JACK server not running?\n"); - exit(1); - } - - signal(SIGQUIT, signal_handler); - signal(SIGTERM, signal_handler); - signal(SIGHUP, signal_handler); - signal(SIGINT, signal_handler); - - jack_on_shutdown(client, jack_shutdown, 0); - - jack_activate(client); - - - retval = jack_session_notify( client, NULL, notify_type, save_path ); - printf( "retval = %p\n", retval ); - for(i=0; retval[i].uuid; i++ ) { - printf( "export SESSION_DIR=\"%s%s/\"\n", save_path, retval[i].client_name ); - printf( "%s &\n", retval[i].command ); - add_uuid_mapping(retval[i].uuid); - } - - printf( "sleep 10\n" ); - - for(k=0; retval[k].uuid; k++ ) { - - char* port_regexp = alloca( jack_client_name_size()+3 ); - char* client_name = jack_get_client_name_by_uuid( client, retval[k].uuid ); - snprintf( port_regexp, jack_client_name_size()+3, "%s:.*", client_name ); - jack_free(client_name); - const char **ports = jack_get_ports( client, port_regexp, NULL, 0 ); - if( !ports ) { - continue; - } - for (i = 0; ports[i]; ++i) { - const char **connections; - if ((connections = jack_port_get_all_connections (client, jack_port_by_name(client, ports[i]))) != 0) { - for (j = 0; connections[j]; j++) { - char *src = map_port_name_to_uuid_port( ports[i] ); - char *dst = map_port_name_to_uuid_port( connections[j] ); - printf( "jack_connect -u \"%s\" \"%s\"\n", src, dst ); - } - jack_free (connections); - } - } - jack_free(ports); - - } - jack_session_commands_free(retval); - - jack_client_close(client); - - return 0; + parse_arguments(argc, argv); + jack_session_command_t *retval; + int k,i,j; + + + /* become a JACK client */ + if ((client = jack_client_open(package, JackNullOption, NULL)) == 0) { + fprintf(stderr, "JACK server not running?\n"); + exit(1); + } + + signal(SIGQUIT, signal_handler); + signal(SIGTERM, signal_handler); + signal(SIGHUP, signal_handler); + signal(SIGINT, signal_handler); + + jack_on_shutdown(client, jack_shutdown, 0); + + jack_activate(client); + + + retval = jack_session_notify( client, NULL, notify_type, save_path ); + printf( "retval = %p\n", retval ); + for(i=0; retval[i].uuid; i++ ) { + printf( "export SESSION_DIR=\"%s%s/\"\n", save_path, retval[i].client_name ); + printf( "%s &\n", retval[i].command ); + add_uuid_mapping(retval[i].uuid); + } + + printf( "sleep 10\n" ); + + for(k=0; retval[k].uuid; k++ ) { + + char* port_regexp = alloca( jack_client_name_size()+3 ); + char* client_name = jack_get_client_name_by_uuid( client, retval[k].uuid ); + snprintf( port_regexp, jack_client_name_size()+3, "%s:.*", client_name ); + jack_free(client_name); + const char **ports = jack_get_ports( client, port_regexp, NULL, 0 ); + if( !ports ) { + continue; + } + for (i = 0; ports[i]; ++i) { + const char **connections; + if ((connections = jack_port_get_all_connections (client, jack_port_by_name(client, ports[i]))) != 0) { + for (j = 0; connections[j]; j++) { + char *src = map_port_name_to_uuid_port( ports[i] ); + char *dst = map_port_name_to_uuid_port( connections[j] ); + printf( "jack_connect -u \"%s\" \"%s\"\n", src, dst ); + } + jack_free (connections); + } + } + jack_free(ports); + + } + jack_session_commands_free(retval); + + jack_client_close(client); + + return 0; } diff --git a/example-clients/simple_session_client.c b/example-clients/simple_session_client.c index 2400674d..8d06127c 100644 --- a/example-clients/simple_session_client.c +++ b/example-clients/simple_session_client.c @@ -32,34 +32,34 @@ int simple_quit = 0; int process (jack_nframes_t nframes, void *arg) { - jack_default_audio_sample_t *in, *out; + jack_default_audio_sample_t *in, *out; - in = jack_port_get_buffer (input_port, nframes); - out = jack_port_get_buffer (output_port, nframes); - memcpy (out, in, - sizeof (jack_default_audio_sample_t) * nframes); + in = jack_port_get_buffer (input_port, nframes); + out = jack_port_get_buffer (output_port, nframes); + memcpy (out, in, + sizeof (jack_default_audio_sample_t) * nframes); - return 0; + return 0; } void session_callback (jack_session_event_t *event, void *arg) { - char retval[100]; - printf ("session notification\n"); - printf ("path %s, uuid %s, type: %s\n", event->session_dir, event->client_uuid, event->type == JackSessionSave ? "save" : "quit"); + char retval[100]; + printf ("session notification\n"); + printf ("path %s, uuid %s, type: %s\n", event->session_dir, event->client_uuid, event->type == JackSessionSave ? "save" : "quit"); - snprintf (retval, 100, "jack_simple_session_client %s", event->client_uuid); - event->command_line = strdup (retval); + snprintf (retval, 100, "jack_simple_session_client %s", event->client_uuid); + event->command_line = strdup (retval); - jack_session_reply( client, event ); + jack_session_reply( client, event ); - if (event->type == JackSessionSaveAndQuit) { - simple_quit = 1; - } + if (event->type == JackSessionSaveAndQuit) { + simple_quit = 1; + } - jack_session_event_free (event); + jack_session_event_free (event); } /** @@ -69,134 +69,134 @@ session_callback (jack_session_event_t *event, void *arg) void jack_shutdown (void *arg) { - exit (1); + exit (1); } int main (int argc, char *argv[]) { - const char **ports; - const char *client_name = "simple"; - jack_status_t status; - - /* open a client connection to the JACK server */ - - if( argc == 1 ) - client = jack_client_open (client_name, JackNullOption, &status ); - else if( argc == 2 ) - client = jack_client_open (client_name, JackSessionID, &status, argv[1] ); - - if (client == NULL) { - fprintf (stderr, "jack_client_open() failed, " - "status = 0x%2.0x\n", status); - if (status & JackServerFailed) { - fprintf (stderr, "Unable to connect to JACK server\n"); - } - exit (1); - } - if (status & JackServerStarted) { - fprintf (stderr, "JACK server started\n"); - } - if (status & JackNameNotUnique) { - client_name = jack_get_client_name(client); - fprintf (stderr, "unique name `%s' assigned\n", client_name); - } - - /* tell the JACK server to call `process()' whenever - there is work to be done. - */ - - jack_set_process_callback (client, process, 0); - - /* tell the JACK server to call `jack_shutdown()' if - it ever shuts down, either entirely, or if it - just decides to stop calling us. - */ - - jack_on_shutdown (client, jack_shutdown, 0); - - /* tell the JACK server to call `session_callback()' if - the session is saved. - */ - - jack_set_session_callback (client, session_callback, NULL); - - /* display the current sample rate. - */ - - printf ("engine sample rate: %" PRIu32 "\n", - jack_get_sample_rate (client)); - - /* create two ports */ - - input_port = jack_port_register (client, "input", - JACK_DEFAULT_AUDIO_TYPE, - JackPortIsInput, 0); - output_port = jack_port_register (client, "output", - JACK_DEFAULT_AUDIO_TYPE, - JackPortIsOutput, 0); - - if ((input_port == NULL) || (output_port == NULL)) { - fprintf(stderr, "no more JACK ports available\n"); - exit (1); - } - - /* Tell the JACK server that we are ready to roll. Our - * process() callback will start running now. */ - - if (jack_activate (client)) { - fprintf (stderr, "cannot activate client"); - exit (1); - } - - /* Connect the ports. You can't do this before the client is - * activated, because we can't make connections to clients - * that aren't running. Note the confusing (but necessary) - * orientation of the driver backend ports: playback ports are - * "input" to the backend, and capture ports are "output" from - * it. - */ - - - /* only do the autoconnect when not reloading from a session. - * in case of a session reload, the SM will restore our connections - */ - - if (argc==1) { - - ports = jack_get_ports (client, NULL, NULL, - JackPortIsPhysical|JackPortIsOutput); - if (ports == NULL) { - fprintf(stderr, "no physical capture ports\n"); - exit (1); - } - - if (jack_connect (client, ports[0], jack_port_name (input_port))) { - fprintf (stderr, "cannot connect input ports\n"); - } - - free (ports); - - ports = jack_get_ports (client, NULL, NULL, - JackPortIsPhysical|JackPortIsInput); - if (ports == NULL) { - fprintf(stderr, "no physical playback ports\n"); - exit (1); - } - - if (jack_connect (client, jack_port_name (output_port), ports[0])) { - fprintf (stderr, "cannot connect output ports\n"); - } - - free (ports); - } - - /* keep running until until we get a quit event */ + const char **ports; + const char *client_name = "simple"; + jack_status_t status; + + /* open a client connection to the JACK server */ + + if( argc == 1 ) + client = jack_client_open (client_name, JackNullOption, &status ); + else if( argc == 2 ) + client = jack_client_open (client_name, JackSessionID, &status, argv[1] ); + + if (client == NULL) { + fprintf (stderr, "jack_client_open() failed, " + "status = 0x%2.0x\n", status); + if (status & JackServerFailed) { + fprintf (stderr, "Unable to connect to JACK server\n"); + } + exit (1); + } + if (status & JackServerStarted) { + fprintf (stderr, "JACK server started\n"); + } + if (status & JackNameNotUnique) { + client_name = jack_get_client_name(client); + fprintf (stderr, "unique name `%s' assigned\n", client_name); + } + + /* tell the JACK server to call `process()' whenever + there is work to be done. + */ + + jack_set_process_callback (client, process, 0); + + /* tell the JACK server to call `jack_shutdown()' if + it ever shuts down, either entirely, or if it + just decides to stop calling us. + */ + + jack_on_shutdown (client, jack_shutdown, 0); + + /* tell the JACK server to call `session_callback()' if + the session is saved. + */ + + jack_set_session_callback (client, session_callback, NULL); + + /* display the current sample rate. + */ + + printf ("engine sample rate: %" PRIu32 "\n", + jack_get_sample_rate (client)); + + /* create two ports */ + + input_port = jack_port_register (client, "input", + JACK_DEFAULT_AUDIO_TYPE, + JackPortIsInput, 0); + output_port = jack_port_register (client, "output", + JACK_DEFAULT_AUDIO_TYPE, + JackPortIsOutput, 0); + + if ((input_port == NULL) || (output_port == NULL)) { + fprintf(stderr, "no more JACK ports available\n"); + exit (1); + } + + /* Tell the JACK server that we are ready to roll. Our + * process() callback will start running now. */ + + if (jack_activate (client)) { + fprintf (stderr, "cannot activate client"); + exit (1); + } + + /* Connect the ports. You can't do this before the client is + * activated, because we can't make connections to clients + * that aren't running. Note the confusing (but necessary) + * orientation of the driver backend ports: playback ports are + * "input" to the backend, and capture ports are "output" from + * it. + */ + + + /* only do the autoconnect when not reloading from a session. + * in case of a session reload, the SM will restore our connections + */ + + if (argc==1) { + + ports = jack_get_ports (client, NULL, NULL, + JackPortIsPhysical|JackPortIsOutput); + if (ports == NULL) { + fprintf(stderr, "no physical capture ports\n"); + exit (1); + } + + if (jack_connect (client, ports[0], jack_port_name (input_port))) { + fprintf (stderr, "cannot connect input ports\n"); + } + + free (ports); + + ports = jack_get_ports (client, NULL, NULL, + JackPortIsPhysical|JackPortIsInput); + if (ports == NULL) { + fprintf(stderr, "no physical playback ports\n"); + exit (1); + } + + if (jack_connect (client, jack_port_name (output_port), ports[0])) { + fprintf (stderr, "cannot connect output ports\n"); + } + + free (ports); + } + + /* keep running until until we get a quit event */ - while (!simple_quit) - sleep(1); - + while (!simple_quit) + sleep(1); + - jack_client_close (client); - exit (0); + jack_client_close (client); + exit (0); } diff --git a/posix/JackPosixThread.cpp b/posix/JackPosixThread.cpp index b068e846..4b4315db 100644 --- a/posix/JackPosixThread.cpp +++ b/posix/JackPosixThread.cpp @@ -117,7 +117,7 @@ int JackPosixThread::StartImp(pthread_t* thread, int priority, int realtime, voi if ((res = pthread_attr_setinheritsched(&attributes, PTHREAD_EXPLICIT_SCHED))) { jack_error("Cannot request explicit scheduling for RT thread res = %d", res); return -1; - } + } if ((res = pthread_attr_setschedpolicy(&attributes, JACK_SCHED_POLICY))) { jack_error("Cannot set RR scheduling class for RT thread res = %d", res); diff --git a/posix/JackPosixThread.h b/posix/JackPosixThread.h index 089e4c28..d38c573c 100644 --- a/posix/JackPosixThread.h +++ b/posix/JackPosixThread.h @@ -68,11 +68,11 @@ class SERVER_EXPORT JackPosixThread : public detail::JackThreadInterface int DropSelfRealTime(); // Used when called from thread itself pthread_t GetThreadID(); - bool IsThread(); + bool IsThread(); static int AcquireRealTimeImp(pthread_t thread, int priority); static int AcquireRealTimeImp(pthread_t thread, int priority, UInt64 period, UInt64 computation, UInt64 constraint) - { return JackPosixThread::AcquireRealTimeImp(thread, priority); } + { return JackPosixThread::AcquireRealTimeImp(thread, priority); } static int DropRealTimeImp(pthread_t thread); static int StartImp(pthread_t* thread, int priority, int realtime, void*(*start_routine)(void*), void* arg); static int StopImp(pthread_t thread); diff --git a/posix/JackSocketClientChannel.h b/posix/JackSocketClientChannel.h index cc4c3251..d3721bb2 100644 --- a/posix/JackSocketClientChannel.h +++ b/posix/JackSocketClientChannel.h @@ -38,11 +38,11 @@ class JackSocketClientChannel : public detail::JackClientChannelInterface, publi private: - JackClientSocket fRequestSocket; // Socket to communicate with the server - JackServerSocket fNotificationListenSocket; // Socket listener for server notification - JackClientSocket* fNotificationSocket; // Socket for server notification + JackClientSocket fRequestSocket; // Socket to communicate with the server + JackServerSocket fNotificationListenSocket; // Socket listener for server notification + JackClientSocket* fNotificationSocket; // Socket for server notification JackThread fThread; // Thread to execute the event loop - JackClient* fClient; + JackClient* fClient; void ServerSyncCall(JackRequest* req, JackResult* res, int* result); void ServerAsyncCall(JackRequest* req, JackResult* res, int* result); @@ -91,19 +91,19 @@ class JackSocketClientChannel : public detail::JackClientChannelInterface, publi void InternalClientLoad(int refnum, const char* client_name, const char* so_name, const char* objet_data, int options, int* status, int* int_ref, int* result, int uuid); void InternalClientUnload(int refnum, int int_ref, int* status, int* result); - // Session Stuff - void SessionNotify(int refnum, const char* target, jack_session_event_type_t type, const char* path, jack_session_command_t** result); - void SessionReply(int refnum, int* result); - void GetUUIDForClientName( int refnum, const char *client_name, char *uuid_res, int *result ); - void GetClientNameForUUID( int refnum, const char *uuid, char *name_res, int *result ); - void ReserveClientName( int refnum, const char *client_name, const char *uuid, int *result ); + // Session Stuff + void SessionNotify(int refnum, const char* target, jack_session_event_type_t type, const char* path, jack_session_command_t** result); + void SessionReply(int refnum, int* result); + void GetUUIDForClientName( int refnum, const char *client_name, char *uuid_res, int *result ); + void GetClientNameForUUID( int refnum, const char *uuid, char *name_res, int *result ); + void ReserveClientName( int refnum, const char *client_name, const char *uuid, int *result ); // JackRunnableInterface interface bool Init(); bool Execute(); - bool IsChannelThread() { return fThread.IsThread(); } + bool IsChannelThread() { return fThread.IsThread(); } }; } // end of namespace diff --git a/posix/JackSocketServerChannel.cpp b/posix/JackSocketServerChannel.cpp index 8dc62561..e94f42eb 100644 --- a/posix/JackSocketServerChannel.cpp +++ b/posix/JackSocketServerChannel.cpp @@ -405,7 +405,7 @@ bool JackSocketServerChannel::HandleRequest(int fd) JackSessionNotifyRequest req; JackSessionNotifyResult res; if (req.Read(socket) == 0) { - fServer->GetEngine()->SessionNotify(req.fRefNum, req.fDst, req.fEventType, req.fPath, socket); + fServer->GetEngine()->SessionNotify(req.fRefNum, req.fDst, req.fEventType, req.fPath, socket); } break; } @@ -415,8 +415,8 @@ bool JackSocketServerChannel::HandleRequest(int fd) JackSessionReplyRequest req; JackResult res; if (req.Read(socket) == 0) { - fServer->GetEngine()->SessionReply(req.fRefNum); - res.fResult = 0; + fServer->GetEngine()->SessionReply(req.fRefNum); + res.fResult = 0; } break; } @@ -426,7 +426,7 @@ bool JackSocketServerChannel::HandleRequest(int fd) JackGetClientNameRequest req; JackClientNameResult res; if (req.Read(socket) == 0) { - fServer->GetEngine()->GetClientNameForUUID(req.fUUID, res.fName, &res.fResult); + fServer->GetEngine()->GetClientNameForUUID(req.fUUID, res.fName, &res.fResult); } if (res.Write(socket) < 0) jack_error("JackRequest::GetClientNameForUUID write error"); @@ -438,8 +438,8 @@ bool JackSocketServerChannel::HandleRequest(int fd) JackGetUUIDRequest req; JackUUIDResult res; if (req.Read(socket) == 0) { - fServer->GetEngine()->GetUUIDForClientName(req.fName, res.fUUID, &res.fResult); - res.fResult = 0; + fServer->GetEngine()->GetUUIDForClientName(req.fName, res.fUUID, &res.fResult); + res.fResult = 0; } if (res.Write(socket) < 0) jack_error("JackRequest::GetUUIDForClientName write error"); @@ -451,8 +451,8 @@ bool JackSocketServerChannel::HandleRequest(int fd) JackReserveNameRequest req; JackResult res; if (req.Read(socket) == 0) { - fServer->GetEngine()->ReserveClientName(req.fName, req.fUUID, &res.fResult); - res.fResult = 0; + fServer->GetEngine()->ReserveClientName(req.fName, req.fUUID, &res.fResult); + res.fResult = 0; } if (res.Write(socket) < 0) jack_error("JackRequest::ReserveClientName write error"); diff --git a/posix/JackSocketServerChannel.h b/posix/JackSocketServerChannel.h index d45e03c4..59c1a0d0 100644 --- a/posix/JackSocketServerChannel.h +++ b/posix/JackSocketServerChannel.h @@ -39,10 +39,10 @@ class JackSocketServerChannel : public JackRunnableInterface private: - JackServerSocket fRequestListenSocket; // Socket to create request socket for the client + JackServerSocket fRequestListenSocket; // Socket to create request socket for the client JackThread fThread; // Thread to execute the event loop - JackServer* fServer; - pollfd* fPollTable; + JackServer* fServer; + pollfd* fPollTable; bool fRebuild; std::map > fSocketTable; diff --git a/windows/JackWinNamedPipeServerChannel.cpp b/windows/JackWinNamedPipeServerChannel.cpp index 730ae61b..ab508aa0 100644 --- a/windows/JackWinNamedPipeServerChannel.cpp +++ b/windows/JackWinNamedPipeServerChannel.cpp @@ -53,7 +53,7 @@ JackClientPipeThread::~JackClientPipeThread() delete fPipe; } -int JackClientPipeThread::Open(JackServer* server) // Open the Server/Client connection +int JackClientPipeThread::Open(JackServer* server) // Open the Server/Client connection { // Start listening if (fThread.Start() != 0) { @@ -65,13 +65,13 @@ int JackClientPipeThread::Open(JackServer* server) // Open the Server/Client con return 0; } -void JackClientPipeThread::Close() // Close the Server/Client connection +void JackClientPipeThread::Close() // Close the Server/Client connection { jack_log("JackClientPipeThread::Close %x %ld", this, fRefNum); /* - TODO : solve WIN32 thread Kill issue - This would hang.. since Close will be followed by a delete, - all ressources will be desallocated at the end. + TODO : solve WIN32 thread Kill issue + This would hang.. since Close will be followed by a delete, + all ressources will be desallocated at the end. */ fThread.Kill(); @@ -326,16 +326,16 @@ bool JackClientPipeThread::HandleRequest() break; } - case JackRequest::kSessionNotify: { - jack_log("JackRequest::SessionNotify"); - JackSessionNotifyRequest req; - JackSessionNotifyResult res; - if (req.Read(fPipe) == 0) { - fServer->GetEngine()->SessionNotify(req.fRefNum, req.fDst, req.fEventType, req.fPath); - } - res.Write(fPipe); - break; - } + case JackRequest::kSessionNotify: { + jack_log("JackRequest::SessionNotify"); + JackSessionNotifyRequest req; + JackSessionNotifyResult res; + if (req.Read(fPipe) == 0) { + fServer->GetEngine()->SessionNotify(req.fRefNum, req.fDst, req.fEventType, req.fPath); + } + res.Write(fPipe); + break; + } default: jack_log("Unknown request %ld", header.fType); @@ -369,7 +369,7 @@ void JackClientPipeThread::ClientKill() { jack_log("JackClientPipeThread::ClientKill ref = %d", fRefNum); - if (fRefNum == -1) { // Correspond to an already removed client. + if (fRefNum == -1) { // Correspond to an already removed client. jack_log("Kill a closed client"); } else if (fRefNum == 0) { // Correspond to a still not opened client. jack_log("Kill a not opened client"); @@ -412,10 +412,10 @@ int JackWinNamedPipeServerChannel::Open(const char* server_name, JackServer* ser void JackWinNamedPipeServerChannel::Close() { /* TODO : solve WIN32 thread Kill issue - This would hang the server... since we are quitting it, its not really problematic, - all ressources will be desallocated at the end. + This would hang the server... since we are quitting it, its not really problematic, + all ressources will be desallocated at the end. - fRequestListenPipe.Close(); + fRequestListenPipe.Close(); fThread.Stop(); */