Skip to content
Snippets Groups Projects
Commit 23f85f98 authored by sletz's avatar sletz
Browse files

Fix transport callback (timebase master, sync) issue when used after...

Fix transport callback (timebase master, sync) issue when used after jack_activate (RT thread was not running).

git-svn-id: http://subversion.jackaudio.org/jack/jack2/trunk/jackmp@3527 0c269be4-1314-0410-8aa9-9f06e86f4224
parent 8146837a
No related branches found
No related tags found
No related merge requests found
......@@ -25,6 +25,10 @@ Paul Davis
Jackdmp changes log
---------------------------
2009-05-06 Stephane Letz <letz@grame.fr>
* Fix transport callback (timebase master, sync) issue when used after jack_activate (RT thread was not running).
2009-05-05 Stephane Letz <letz@grame.fr>
* First working version of native MIDI backend (JackCoreMidiDriver, JackWinMMEDriver).
......
......@@ -337,7 +337,7 @@ int JackClient::StartThread()
// Will do "something" on OSX only...
fThread.SetParams(GetEngineControl()->fPeriod, GetEngineControl()->fComputation, GetEngineControl()->fConstraint);
if (fThread.Start() < 0) {
if (fThread.StartSync() < 0) {
jack_error("Start thread error");
return -1;
}
......@@ -592,6 +592,27 @@ void JackClient::ShutDown()
// Transport management
//----------------------
inline int JackClient::ActivateAux()
{
// If activated without RT thread...
if (IsActive() && fThread.GetStatus() != JackThread::kRunning) {
jack_log("ActivateAux");
// RT thread is started
if (StartThread() < 0)
return -1;
int result = -1;
GetClientControl()->fCallback[kRealTimeCallback] = IsRealTime();
fChannel->ClientActivate(GetClientControl()->fRefNum, IsRealTime(), &result);
return result;
} else {
return 0;
}
}
int JackClient::ReleaseTimebase()
{
int result = -1;
......@@ -610,29 +631,30 @@ int JackClient::SetSyncCallback(JackSyncCallback sync_callback, void* arg)
GetClientControl()->fTransportSync = (fSync != NULL);
fSyncArg = arg;
fSync = sync_callback;
return 0;
}
int JackClient::SetSyncTimeout(jack_time_t timeout)
{
GetEngineControl()->fTransport.SetSyncTimeout(timeout);
return 0;
return ActivateAux();
}
int JackClient::SetTimebaseCallback(int conditional, JackTimebaseCallback timebase_callback, void* arg)
{
int result = -1;
fChannel->SetTimebaseCallback(GetClientControl()->fRefNum, conditional, &result);
jack_log("SetTimebaseCallback result = %ld", result);
if (result == 0) {
GetClientControl()->fTransportTimebase = true;
fTimebase = timebase_callback;
fTimebaseArg = arg;
return ActivateAux();
} else {
fTimebase = NULL;
fTimebaseArg = NULL;
return -1;
}
return result;
}
int JackClient::SetSyncTimeout(jack_time_t timeout)
{
GetEngineControl()->fTransport.SetSyncTimeout(timeout);
return 0;
}
// Must be RT safe
......
......@@ -108,6 +108,7 @@ class JackClient : public JackClientInterface, public JackRunnableInterface
inline void CycleSignalAux(int status);
inline void CallSyncCallbackAux();
inline void CallTimebaseCallbackAux();
inline int ActivateAux();
public:
......
......@@ -56,14 +56,6 @@ bool JackConnectionManager::IsLoopPathAux(int ref1, int ref2) const
{
jack_log("JackConnectionManager::IsLoopPathAux ref1 = %ld ref2 = %ld", ref1, ref2);
/*
if (ref1 == AUDIO_DRIVER_REFNUM // Driver is reached
|| ref2 == AUDIO_DRIVER_REFNUM
|| ref1 == FREEWHEEL_DRIVER_REFNUM
|| ref2 == FREEWHEEL_DRIVER_REFNUM
|| ref1 == MIDI_DRIVER_REFNUM
|| ref2 == MIDI_DRIVER_REFNUM) {
*/
if (ref1 < GetEngineControl()->fDriverNum || ref2 < GetEngineControl()->fDriverNum) {
return false;
} else if (ref1 == ref2) { // Same refnum
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment