21 #ifndef __JackEngineControl__ 22 #define __JackEngineControl__ 24 #include "JackShmMem.h" 25 #include "JackFrameTimer.h" 26 #include "JackTransportEngine.h" 27 #include "JackConstants.h" 32 #include "JackEngineProfiling.h" 38 class JackClientInterface;
39 class JackGraphManager;
41 #define JACK_ENGINE_ROLLING_COUNT 32 42 #define JACK_ENGINE_ROLLING_INTERVAL 1024 52 jack_nframes_t fBufferSize;
53 jack_nframes_t fSampleRate;
56 jack_time_t fPeriodUsecs;
57 jack_time_t fTimeOutUsecs;
58 float fMaxDelayedUsecs;
59 float fXrunDelayedUsecs;
65 int fMaxClientPriority;
66 char fServerName[JACK_SERVER_NAME_SIZE];
68 jack_timer_type_t fClockSource;
73 jack_time_t fPrevCycleTime;
74 jack_time_t fCurCycleTime;
75 jack_time_t fSpareUsecs;
76 jack_time_t fMaxUsecs;
77 jack_time_t fRollingClientUsecs[JACK_ENGINE_ROLLING_COUNT];
78 unsigned int fRollingClientUsecsCnt;
79 int fRollingClientUsecsIndex;
95 JackEngineControl(
bool sync,
bool temporary,
long timeout,
bool rt,
long priority,
bool verbose, jack_timer_type_t clock,
const char* server_name)
99 fPeriodUsecs = jack_time_t(1000000.f / fSampleRate * fBufferSize);
101 fTemporary = temporary;
102 fTimeOut = (timeout > 0);
103 fTimeOutUsecs = timeout * 1000;
105 fSavedRealTime =
false;
106 fServerPriority = priority;
107 fClientPriority = (rt) ? priority - 5 : 0;
108 fMaxClientPriority = (rt) ? priority - 1 : 0;
115 strncpy(fServerName, server_name,
sizeof(fServerName));
120 fMaxDelayedUsecs = 0.f;
121 fXrunDelayedUsecs = 0.f;
122 fClockSource = clock;
131 fPeriodUsecs = jack_time_t(1000000.f / fSampleRate * fBufferSize);
132 if (!(fTimeOut && fTimeOutUsecs > 2 * fPeriodUsecs)) {
133 fTimeOutUsecs = 2 * fPeriodUsecs;
138 void CycleIncTime(jack_time_t callback_usecs)
141 fFrameTimer.IncFrameTime(fBufferSize, callback_usecs, fPeriodUsecs);
146 fTransport.CycleBegin(fSampleRate, cur_cycle_begin);
147 CalcCPULoad(table, manager, cur_cycle_begin, prev_cycle_end);
149 fProfiler.Profile(table, manager, fPeriodUsecs, cur_cycle_begin, prev_cycle_end);
155 fTransport.CycleEnd(table, fSampleRate, fBufferSize);
161 fFrameTimer.InitFrameTime();
164 void ResetFrameTime(jack_time_t callback_usecs)
166 fFrameTimer.ResetFrameTime(callback_usecs);
171 fFrameTimer.ReadFrameTime(timer);
175 void NotifyXRun(jack_time_t callback_usecs,
float delayed_usecs);
178 fMaxDelayedUsecs = 0.f;
183 void ResetRollingUsecs();
185 } POST_PACKED_STRUCTURE;
A structure used for time management.
Graph manager: contains the connection manager and the port array.
A class using the JackAtomicState to manage jack time.
Engine control in shared memory.
The base class for shared memory management.