git-svn-id: http://subversion.jackaudio.org/jack/jack2/trunk/jackmp@4646 0c269be4-1314-0410-8aa9-9f06e86f4224tags/1.9.8
| @@ -270,7 +270,7 @@ void JackAudioDriver::ProcessGraphAsyncMaster() | |||||
| jack_error("JackAudioDriver::ProcessGraphAsyncMaster: Process error"); | jack_error("JackAudioDriver::ProcessGraphAsyncMaster: Process error"); | ||||
| } | } | ||||
| if (fGraphManager->ResumeRefNum(&fClientControl, fSynchroTable) < 0) { | |||||
| if (ResumeRefNum() < 0) { | |||||
| jack_error("JackAudioDriver::ProcessGraphAsyncMaster: ResumeRefNum error"); | jack_error("JackAudioDriver::ProcessGraphAsyncMaster: ResumeRefNum error"); | ||||
| } | } | ||||
| @@ -287,8 +287,9 @@ void JackAudioDriver::ProcessGraphAsyncMaster() | |||||
| void JackAudioDriver::ProcessGraphAsyncSlave() | void JackAudioDriver::ProcessGraphAsyncSlave() | ||||
| { | { | ||||
| if (fGraphManager->ResumeRefNum(&fClientControl, fSynchroTable) < 0) | |||||
| if (ResumeRefNum() < 0) { | |||||
| jack_error("JackAudioDriver::ProcessGraphAsyncSlave: ResumeRefNum error"); | jack_error("JackAudioDriver::ProcessGraphAsyncSlave: ResumeRefNum error"); | ||||
| } | |||||
| } | } | ||||
| /* | /* | ||||
| @@ -333,7 +334,7 @@ void JackAudioDriver::ProcessGraphSyncMaster() | |||||
| // fBeginDateUst is set in the "low level" layer, fEndDateUst is from previous cycle | // fBeginDateUst is set in the "low level" layer, fEndDateUst is from previous cycle | ||||
| if (fEngine->Process(fBeginDateUst, fEndDateUst)) { | if (fEngine->Process(fBeginDateUst, fEndDateUst)) { | ||||
| if (fGraphManager->ResumeRefNum(&fClientControl, fSynchroTable) < 0) { | |||||
| if (ResumeRefNum() < 0) { | |||||
| jack_error("JackAudioDriver::ProcessGraphSyncMaster: ResumeRefNum error"); | jack_error("JackAudioDriver::ProcessGraphSyncMaster: ResumeRefNum error"); | ||||
| } | } | ||||
| @@ -346,7 +347,7 @@ void JackAudioDriver::ProcessGraphSyncMaster() | |||||
| } | } | ||||
| // Waits for graph execution end | // Waits for graph execution end | ||||
| if (fGraphManager->SuspendRefNum(&fClientControl, fSynchroTable, DRIVER_TIMEOUT_FACTOR * fEngineControl->fTimeOutUsecs) < 0) { | |||||
| if (SuspendRefNum() < 0) { | |||||
| jack_error("JackAudioDriver::ProcessGraphSync: SuspendRefNum error, engine may now behave abnormally!!"); | jack_error("JackAudioDriver::ProcessGraphSync: SuspendRefNum error, engine may now behave abnormally!!"); | ||||
| } | } | ||||
| @@ -357,7 +358,7 @@ void JackAudioDriver::ProcessGraphSyncMaster() | |||||
| void JackAudioDriver::ProcessGraphSyncSlave() | void JackAudioDriver::ProcessGraphSyncSlave() | ||||
| { | { | ||||
| if (fGraphManager->ResumeRefNum(&fClientControl, fSynchroTable) < 0) { | |||||
| if (ResumeRefNum() < 0) { | |||||
| jack_error("JackAudioDriver::ProcessGraphSyncSlave: ResumeRefNum error"); | jack_error("JackAudioDriver::ProcessGraphSyncSlave: ResumeRefNum error"); | ||||
| } | } | ||||
| } | } | ||||
| @@ -530,4 +530,15 @@ void JackDriver::RestoreConnections() | |||||
| } | } | ||||
| } | } | ||||
| int JackDriver::ResumeRefNum() | |||||
| { | |||||
| return fGraphManager->ResumeRefNum(&fClientControl, fSynchroTable); | |||||
| } | |||||
| int JackDriver::SuspendRefNum() | |||||
| { | |||||
| return fGraphManager->SuspendRefNum(&fClientControl, fSynchroTable, DRIVER_TIMEOUT_FACTOR * fEngineControl->fTimeOutUsecs); | |||||
| } | |||||
| } // end of namespace | } // end of namespace | ||||
| @@ -186,6 +186,9 @@ class SERVER_EXPORT JackDriver : public JackDriverClientInterface | |||||
| virtual int StartSlaves(); | virtual int StartSlaves(); | ||||
| virtual int StopSlaves(); | virtual int StopSlaves(); | ||||
| virtual int ResumeRefNum(); | |||||
| virtual int SuspendRefNum(); | |||||
| public: | public: | ||||
| JackDriver(const char* name, const char* alias, JackLockedEngine* engine, JackSynchro* table); | JackDriver(const char* name, const char* alias, JackLockedEngine* engine, JackSynchro* table); | ||||
| @@ -37,12 +37,13 @@ int JackFreewheelDriver::Process() | |||||
| if (fEngine->Process(fBeginDateUst, fEndDateUst)) { | if (fEngine->Process(fBeginDateUst, fEndDateUst)) { | ||||
| if (fGraphManager->ResumeRefNum(&fClientControl, fSynchroTable)) { // Signal all clients | |||||
| if (ResumeRefNum()) { // Signal all clients | |||||
| jack_error("JackFreewheelDriver::Process: ResumeRefNum error"); | jack_error("JackFreewheelDriver::Process: ResumeRefNum error"); | ||||
| res = -1; | res = -1; | ||||
| } | } | ||||
| if (fGraphManager->SuspendRefNum(&fClientControl, fSynchroTable, FREEWHEEL_DRIVER_TIMEOUT * 1000000) < 0) { // Wait for all clients to finish for 10 sec | |||||
| // Special "SuspendRefNum" with longer timeout | |||||
| if (SuspendRefNum() < 0) { // Wait for all clients to finish for 10 sec | |||||
| jack_error("JackFreewheelDriver::ProcessSync: SuspendRefNum error"); | jack_error("JackFreewheelDriver::ProcessSync: SuspendRefNum error"); | ||||
| /* We have a client time-out error, but still continue to process, until a better recovery strategy is chosen */ | /* We have a client time-out error, but still continue to process, until a better recovery strategy is chosen */ | ||||
| return 0; | return 0; | ||||
| @@ -60,7 +61,7 @@ int JackFreewheelDriver::Process() | |||||
| int JackFreewheelDriver::ProcessReadSync() | int JackFreewheelDriver::ProcessReadSync() | ||||
| { | { | ||||
| if (fGraphManager->ResumeRefNum(&fClientControl, fSynchroTable) < 0) { // Signal all clients | |||||
| if (ResumeRefNum() < 0) { // Signal all clients | |||||
| jack_error("JackFreewheelDriver::ProcessReadSync: ResumeRefNum error"); | jack_error("JackFreewheelDriver::ProcessReadSync: ResumeRefNum error"); | ||||
| return -1; | return -1; | ||||
| } | } | ||||
| @@ -69,7 +70,8 @@ int JackFreewheelDriver::ProcessReadSync() | |||||
| int JackFreewheelDriver::ProcessWriteSync() | int JackFreewheelDriver::ProcessWriteSync() | ||||
| { | { | ||||
| if (fGraphManager->SuspendRefNum(&fClientControl, fSynchroTable, DRIVER_TIMEOUT_FACTOR * fEngineControl->fTimeOutUsecs) < 0) { | |||||
| // Generic "SuspendRefNum" here | |||||
| if (JackDriver::SuspendRefNum() < 0) { | |||||
| jack_error("JackFreewheelDriver::ProcessSync SuspendRefNum error"); | jack_error("JackFreewheelDriver::ProcessSync SuspendRefNum error"); | ||||
| return -1; | return -1; | ||||
| } | } | ||||
| @@ -78,7 +80,7 @@ int JackFreewheelDriver::ProcessWriteSync() | |||||
| int JackFreewheelDriver::ProcessReadAsync() | int JackFreewheelDriver::ProcessReadAsync() | ||||
| { | { | ||||
| if (fGraphManager->ResumeRefNum(&fClientControl, fSynchroTable) < 0) { // Signal all clients | |||||
| if (ResumeRefNum() < 0) { // Signal all clients | |||||
| jack_error("JackFreewheelDriver::ProcessReadAsync: ResumeRefNum error"); | jack_error("JackFreewheelDriver::ProcessReadAsync: ResumeRefNum error"); | ||||
| return -1; | return -1; | ||||
| } | } | ||||
| @@ -90,4 +92,9 @@ int JackFreewheelDriver::ProcessWriteAsync() | |||||
| return 0; | return 0; | ||||
| } | } | ||||
| int JackFreewheelDriver::SuspendRefNum() | |||||
| { | |||||
| return fGraphManager->SuspendRefNum(&fClientControl, fSynchroTable, FREEWHEEL_DRIVER_TIMEOUT * 1000000); | |||||
| } | |||||
| } // end of namespace | } // end of namespace | ||||
| @@ -32,6 +32,9 @@ namespace Jack | |||||
| class JackFreewheelDriver : public JackDriver | class JackFreewheelDriver : public JackDriver | ||||
| { | { | ||||
| protected: | |||||
| int SuspendRefNum(); | |||||
| public: | public: | ||||
| @@ -41,7 +41,7 @@ int JackLoopbackDriver::ProcessReadSync() | |||||
| memcpy(GetInputBuffer(i), GetOutputBuffer(i), sizeof(jack_default_audio_sample_t) * fEngineControl->fBufferSize); | memcpy(GetInputBuffer(i), GetOutputBuffer(i), sizeof(jack_default_audio_sample_t) * fEngineControl->fBufferSize); | ||||
| } | } | ||||
| if (fGraphManager->ResumeRefNum(&fClientControl, fSynchroTable) < 0) { | |||||
| if (ResumeRefNum() < 0) { | |||||
| jack_error("JackLoopbackDriver::ProcessReadSync - ResumeRefNum error"); | jack_error("JackLoopbackDriver::ProcessReadSync - ResumeRefNum error"); | ||||
| res = -1; | res = -1; | ||||
| } | } | ||||
| @@ -51,7 +51,7 @@ int JackLoopbackDriver::ProcessReadSync() | |||||
| int JackLoopbackDriver::ProcessWriteSync() | int JackLoopbackDriver::ProcessWriteSync() | ||||
| { | { | ||||
| if (fGraphManager->SuspendRefNum(&fClientControl, fSynchroTable, DRIVER_TIMEOUT_FACTOR * fEngineControl->fTimeOutUsecs) < 0) { | |||||
| if (SuspendRefNum() < 0) { | |||||
| jack_error("JackLoopbackDriver::ProcessWriteSync SuspendRefNum error"); | jack_error("JackLoopbackDriver::ProcessWriteSync SuspendRefNum error"); | ||||
| return -1; | return -1; | ||||
| } | } | ||||
| @@ -67,7 +67,7 @@ int JackLoopbackDriver::ProcessReadAsync() | |||||
| memcpy(GetInputBuffer(i), GetOutputBuffer(i), sizeof(jack_default_audio_sample_t) * fEngineControl->fBufferSize); | memcpy(GetInputBuffer(i), GetOutputBuffer(i), sizeof(jack_default_audio_sample_t) * fEngineControl->fBufferSize); | ||||
| } | } | ||||
| if (fGraphManager->ResumeRefNum(&fClientControl, fSynchroTable) < 0) { | |||||
| if (ResumeRefNum() < 0) { | |||||
| jack_error("JackLoopbackDriver::ProcessReadAsync - ResumeRefNum error"); | jack_error("JackLoopbackDriver::ProcessReadAsync - ResumeRefNum error"); | ||||
| res = -1; | res = -1; | ||||
| } | } | ||||
| @@ -143,7 +143,7 @@ int JackMidiDriver::ProcessReadSync() | |||||
| res = -1; | res = -1; | ||||
| } | } | ||||
| if (fGraphManager->ResumeRefNum(&fClientControl, fSynchroTable) < 0) { | |||||
| if (ResumeRefNum() < 0) { | |||||
| jack_error("JackMidiDriver::ProcessReadSync: ResumeRefNum error"); | jack_error("JackMidiDriver::ProcessReadSync: ResumeRefNum error"); | ||||
| res = -1; | res = -1; | ||||
| } | } | ||||
| @@ -155,9 +155,7 @@ int JackMidiDriver::ProcessWriteSync() | |||||
| { | { | ||||
| int res = 0; | int res = 0; | ||||
| if (fGraphManager->SuspendRefNum(&fClientControl, fSynchroTable, | |||||
| DRIVER_TIMEOUT_FACTOR * | |||||
| fEngineControl->fTimeOutUsecs) < 0) { | |||||
| if (SuspendRefNum() < 0) { | |||||
| jack_error("JackMidiDriver::ProcessWriteSync: SuspendRefNum error"); | jack_error("JackMidiDriver::ProcessWriteSync: SuspendRefNum error"); | ||||
| res = -1; | res = -1; | ||||
| } | } | ||||
| @@ -187,7 +185,7 @@ int JackMidiDriver::ProcessReadAsync() | |||||
| res = -1; | res = -1; | ||||
| } | } | ||||
| if (fGraphManager->ResumeRefNum(&fClientControl, fSynchroTable) < 0) { | |||||
| if (ResumeRefNum() < 0) { | |||||
| jack_error("JackMidiDriver::ProcessReadAsync: ResumeRefNum error"); | jack_error("JackMidiDriver::ProcessReadAsync: ResumeRefNum error"); | ||||
| res = -1; | res = -1; | ||||
| } | } | ||||