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_CONTROL_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));
119 fMaxDelayedUsecs = 0.f;
120 fXrunDelayedUsecs = 0.f;
121 fClockSource = clock;
130 fPeriodUsecs = jack_time_t(1000000.f / fSampleRate * fBufferSize);
131 if (!(fTimeOut && fTimeOutUsecs > 2 * fPeriodUsecs)) {
132 fTimeOutUsecs = 2 * fPeriodUsecs;
137 void CycleIncTime(jack_time_t callback_usecs)
140 fFrameTimer.IncFrameTime(fBufferSize, callback_usecs, fPeriodUsecs);
145 fTransport.CycleBegin(fSampleRate, cur_cycle_begin);
146 CalcCPULoad(table, manager, cur_cycle_begin, prev_cycle_end);
148 fProfiler.Profile(table, manager, fPeriodUsecs, cur_cycle_begin, prev_cycle_end);
154 fTransport.CycleEnd(table, fSampleRate, fBufferSize);
160 fFrameTimer.InitFrameTime();
163 void ResetFrameTime(jack_time_t callback_usecs)
165 fFrameTimer.ResetFrameTime(callback_usecs);
170 fFrameTimer.ReadFrameTime(timer);
174 void NotifyXRun(jack_time_t callback_usecs,
float delayed_usecs);
177 fMaxDelayedUsecs = 0.f;
182 void ResetRollingUsecs();
184 } 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.