From 73bd4aa40d1dee6dc3752bca09c9d4bbd1908bc1 Mon Sep 17 00:00:00 2001 From: sletz Date: Mon, 18 Dec 2006 16:22:32 +0000 Subject: [PATCH] Cleanup git-svn-id: http://subversion.jackaudio.org/jack/jack2/trunk/jackmp@1321 0c269be4-1314-0410-8aa9-9f06e86f4224 --- common/JackAPI.cpp | 9 ++++++--- common/JackEngine.cpp | 15 ++++++++++----- common/JackEngineControl.h | 26 ++++++++++++++++++++++++++ 3 files changed, 42 insertions(+), 8 deletions(-) diff --git a/common/JackAPI.cpp b/common/JackAPI.cpp index 421e5bde..0cb72cd2 100644 --- a/common/JackAPI.cpp +++ b/common/JackAPI.cpp @@ -851,7 +851,8 @@ EXPORT int jack_engine_takeover_timebase(jack_client_t* ext_client) EXPORT jack_nframes_t jack_frames_since_cycle_start(const jack_client_t* ext_client) { JackTimer timer; - GetEngineControl()->fFrameTimer.ReadFrameTime(&timer); + //GetEngineControl()->fFrameTimer.ReadFrameTime(&timer); + GetEngineControl()->ReadFrameTime(&timer); return (jack_nframes_t) floor((((float)GetEngineControl()->fSampleRate) / 1000000.0f) * (GetMicroSeconds() - timer.fCurrentCallback)); } @@ -863,7 +864,8 @@ EXPORT jack_nframes_t jack_frame_time(const jack_client_t* ext_client) return 0; } else { JackTimer timer; - GetEngineControl()->fFrameTimer.ReadFrameTime(&timer); + //GetEngineControl()->fFrameTimer.ReadFrameTime(&timer); + GetEngineControl()->ReadFrameTime(&timer); if (timer.fInitialized) { return timer.fFrames + (long) rint(((double) ((jack_time_t)(GetMicroSeconds() - timer.fCurrentWakeup)) / @@ -877,7 +879,8 @@ EXPORT jack_nframes_t jack_frame_time(const jack_client_t* ext_client) EXPORT jack_nframes_t jack_last_frame_time(const jack_client_t* ext_client) { JackTimer timer; - GetEngineControl()->fFrameTimer.ReadFrameTime(&timer); + //GetEngineControl()->fFrameTimer.ReadFrameTime(&timer); + GetEngineControl()->ReadFrameTime(&timer); return timer.fFrames; } diff --git a/common/JackEngine.cpp b/common/JackEngine.cpp index 858a8faa..38a66f97 100644 --- a/common/JackEngine.cpp +++ b/common/JackEngine.cpp @@ -112,12 +112,15 @@ int JackEngine::Allocate() bool JackEngine::Process(jack_time_t callback_usecs) { - // Transport - fEngineControl->fTransport.CycleBegin(fEngineControl->fSampleRate, callback_usecs); bool res = true; + + // Transport + //fEngineControl->fTransport.CycleBegin(fEngineControl->fSampleRate, callback_usecs); + fEngineControl->CycleBegin(callback_usecs); // Timing - fEngineControl->fFrameTimer.IncFrameTime(fEngineControl->fBufferSize, callback_usecs, fEngineControl->fPeriodUsecs); + //fEngineControl->fFrameTimer.IncFrameTime(fEngineControl->fBufferSize, callback_usecs, fEngineControl->fPeriodUsecs); + fEngineControl->IncFrameTime(callback_usecs); fEngineTiming->UpdateTiming(callback_usecs); // Graph @@ -147,7 +150,8 @@ bool JackEngine::Process(jack_time_t callback_usecs) } // Transport - fEngineControl->fTransport.CycleEnd(fClientTable, fEngineControl->fSampleRate, fEngineControl->fBufferSize); + //fEngineControl->fTransport.CycleEnd(fClientTable, fEngineControl->fSampleRate, fEngineControl->fBufferSize); + fEngineControl->CycleEnd(fClientTable); return res; } @@ -288,7 +292,8 @@ void JackEngine::NotifyRemoveClient(const char* name, int refnum) void JackEngine::NotifyXRun(jack_time_t callback_usecs) { // Use the audio thread => request thread communication channel - fEngineControl->fFrameTimer.ResetFrameTime(fEngineControl->fSampleRate, callback_usecs, fEngineControl->fPeriodUsecs); + //fEngineControl->fFrameTimer.ResetFrameTime(fEngineControl->fSampleRate, callback_usecs, fEngineControl->fPeriodUsecs); + fEngineControl->ResetFrameTime(callback_usecs); fChannel->ClientNotify(ALL_CLIENTS, JackNotifyChannelInterface::kXRunCallback, 0); } diff --git a/common/JackEngineControl.h b/common/JackEngineControl.h index 975a888a..89b86d93 100644 --- a/common/JackEngineControl.h +++ b/common/JackEngineControl.h @@ -49,6 +49,32 @@ struct JackEngineControl : public JackShmMem JackTransportEngine fTransport; bool fSyncMode; bool fVerbose; + + void IncFrameTime(jack_time_t callback_usecs) + { + fFrameTimer.IncFrameTime(fBufferSize, callback_usecs, fPeriodUsecs); + } + + void ResetFrameTime(jack_time_t callback_usecs) + { + fFrameTimer.ResetFrameTime(fSampleRate, callback_usecs, fPeriodUsecs); + } + + void ReadFrameTime(JackTimer* timer) + { + fFrameTimer.ReadFrameTime(timer); + } + + void CycleBegin(jack_time_t callback_usecs) + { + fTransport.CycleBegin(fSampleRate, callback_usecs); + } + + void CycleEnd(JackClientInterface** table) + { + fTransport.CycleEnd(table, fSampleRate, fBufferSize); + } + };