jack2 codebase
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

643 lines
21KB

  1. /*
  2. Copyright (C) 2004-2006 Grame
  3. This program is free software; you can redistribute it and/or modify
  4. it under the terms of the GNU General Public License as published by
  5. the Free Software Foundation; either version 2 of the License, or
  6. (at your option) any later version.
  7. This program is distributed in the hope that it will be useful,
  8. but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  10. GNU General Public License for more details.
  11. You should have received a copy of the GNU General Public License
  12. along with this program; if not, write to the Free Software
  13. Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  14. */
  15. #include <iostream>
  16. #include <fstream>
  17. #include <assert.h>
  18. #include "JackEngine.h"
  19. #include "JackExternalClient.h"
  20. #include "JackEngineControl.h"
  21. #include "JackClientControl.h"
  22. #include "JackEngineTiming.h"
  23. #include "JackGlobals.h"
  24. #include "JackChannel.h"
  25. #include "JackSyncInterface.h"
  26. namespace Jack
  27. {
  28. JackEngine::JackEngine(JackGraphManager* manager, JackSynchro** table, JackEngineControl* control, JackSyncInterface* signal, bool sync, long time_out_ms, bool rt, long priority, bool ve)
  29. {
  30. fGraphManager = manager;
  31. fSynchroTable = table;
  32. fEngineControl = control;
  33. fEngineControl->fSyncMode = sync;
  34. fEngineControl->fTimeOutUsecs = time_out_ms * 1000;
  35. fEngineControl->fRealTime = rt;
  36. fEngineControl->fPriority = priority;
  37. fEngineControl->fVerbose = ve;
  38. fChannel = JackGlobals::MakeServerNotifyChannel();
  39. fTiming = new JackEngineTiming(fClientTable, fGraphManager, fEngineControl);
  40. fSignal = signal;
  41. for (int i = 0; i < CLIENT_NUM; i++)
  42. fClientTable[i] = 0;
  43. fTiming->ClearTimeMeasures();
  44. fTiming->ResetRollingUsecs();
  45. }
  46. JackEngine::~JackEngine()
  47. {
  48. delete fChannel;
  49. delete fTiming;
  50. }
  51. //-------------------
  52. // Client management
  53. //-------------------
  54. int JackEngine::Open()
  55. {
  56. JackLog("JackEngine::Open\n");
  57. // Open audio thread => request thread communication channel
  58. if (fChannel->Open() < 0) {
  59. jack_error("Cannot connect to server");
  60. return -1;
  61. } else {
  62. return 0;
  63. }
  64. }
  65. int JackEngine::Close()
  66. {
  67. JackLog("JackEngine::Close\n");
  68. fChannel->Close();
  69. // Close (possibly) remaining clients (RT is stopped)
  70. for (int i = 0; i < CLIENT_NUM; i++) {
  71. JackClientInterface* client = fClientTable[i];
  72. if (client) {
  73. JackLog("JackEngine::Close remaining client %ld\n", i);
  74. ClientCloseAux(i, client, false);
  75. client->Close();
  76. delete client;
  77. }
  78. }
  79. return 0;
  80. }
  81. //------------------
  82. // Graph management
  83. //------------------
  84. void JackEngine::Process(jack_time_t callback_usecs)
  85. {
  86. // Transport
  87. fEngineControl->fTransport.CycleBegin(fEngineControl->fSampleRate, callback_usecs);
  88. //JackLog("Process: callback_usecs %lld\n",callback_usecs/1000);
  89. // Timing
  90. fEngineControl->fFrameTimer.IncFrameTime(fEngineControl->fBufferSize, callback_usecs, fEngineControl->fPeriodUsecs);
  91. fTiming->UpdateTiming(callback_usecs);
  92. // Graph
  93. if (fGraphManager->IsFinishedGraph()) {
  94. fLastSwitchUsecs = callback_usecs;
  95. if (fGraphManager->RunNextGraph()) // True if the graph actually switched to a new state
  96. fChannel->ClientNotify(ALL_CLIENTS, JackNotifyChannelInterface::kGraphOrderCallback, 0);
  97. fSignal->SignalAll(); // Signal for threads waiting for next cycle
  98. } else {
  99. JackLog("Process: graph not finished!\n");
  100. if (callback_usecs > fLastSwitchUsecs + fEngineControl->fTimeOutUsecs) {
  101. JackLog("Process: switch to next state %ld\n", long(callback_usecs - fLastSwitchUsecs));
  102. //RemoveZombifiedClients(callback_usecs); TODO
  103. fLastSwitchUsecs = callback_usecs;
  104. if (fGraphManager->RunNextGraph())
  105. fChannel->ClientNotify(ALL_CLIENTS, JackNotifyChannelInterface::kGraphOrderCallback, 0);
  106. fSignal->SignalAll(); // Signal for threads waiting for next cycle
  107. } else {
  108. JackLog("Process: waiting to switch %ld\n", long(callback_usecs - fLastSwitchUsecs));
  109. if (callback_usecs < fLastSwitchUsecs + 2 * fEngineControl->fPeriodUsecs) // Signal XRun only for the first failling cycle
  110. CheckXRun(callback_usecs);
  111. fGraphManager->RunCurrentGraph();
  112. }
  113. }
  114. // Transport
  115. fEngineControl->fTransport.CycleEnd(fClientTable, fEngineControl->fSampleRate, fEngineControl->fBufferSize);
  116. }
  117. /*
  118. Client that finish *after* the callback date are considered late even if their output buffers may have been
  119. correctly mixed in the time window: callbackUsecs <==> Read <==> Write.
  120. */
  121. void JackEngine::CheckXRun(jack_time_t callback_usecs) // REVOIR les conditions de fin
  122. {
  123. for (int i = REAL_REFNUM; i < CLIENT_NUM; i++) {
  124. JackClientInterface* client = fClientTable[i];
  125. if (client && client->GetClientControl()->fActive) {
  126. JackClientTiming* timing = fGraphManager->GetClientTiming(i);
  127. jack_client_state_t status = timing->fStatus;
  128. jack_time_t finished_date = timing->fFinishedAt;
  129. if (status != NotTriggered && status != Finished) {
  130. jack_error("JackEngine::XRun: client = %s was not runned: state = %ld", client->GetClientControl()->fName, status);
  131. //fChannel->ClientNotify(i, kXRunCallback, 0); // Notify the failing client
  132. fChannel->ClientNotify(ALL_CLIENTS, JackNotifyChannelInterface::kXRunCallback, 0); // Notify all clients
  133. }
  134. if (status == Finished && (long)(finished_date - callback_usecs) > 0) {
  135. jack_error("JackEngine::XRun: client %s finished after current callback", client->GetClientControl()->fName);
  136. //fChannel->ClientNotify(i, kXRunCallback, 0); // Notify the failing client
  137. fChannel->ClientNotify(ALL_CLIENTS, JackNotifyChannelInterface::kXRunCallback, 0); // Notify all clients
  138. }
  139. }
  140. }
  141. }
  142. //---------------
  143. // Zombification
  144. //---------------
  145. bool JackEngine::IsZombie(JackClientInterface* client, jack_time_t current_time)
  146. {
  147. return ((current_time - fGraphManager->GetClientTiming(client->GetClientControl()->fRefNum)->fFinishedAt) > 2 * fEngineControl->fTimeOutUsecs); // A VERIFIER
  148. }
  149. // TODO : check what happens with looped sub-graph....
  150. void JackEngine::GetZombifiedClients(bool zombi_clients[CLIENT_NUM], jack_time_t current_time)
  151. {
  152. for (int i = REAL_REFNUM; i < CLIENT_NUM; i++) {
  153. JackClientInterface* client1 = fClientTable[i];
  154. if (client1 && IsZombie(client1, current_time)) {
  155. JackLog("JackEngine::GetZombifiedClients: %s\n", client1->GetClientControl()->fName);
  156. zombi_clients[i] = true; // Assume client is dead
  157. // If another dead client is connected to the scanned one, then the scanned one is not the first of the dead subgraph
  158. for (int j = REAL_REFNUM; j < CLIENT_NUM; j++) {
  159. JackClientInterface* client2 = fClientTable[j];
  160. if (client2 && IsZombie(client2, current_time) && fGraphManager->IsDirectConnection(j, i)) {
  161. zombi_clients[i] = false;
  162. break;
  163. }
  164. }
  165. } else {
  166. zombi_clients[i] = false;
  167. }
  168. }
  169. }
  170. void JackEngine::RemoveZombifiedClients(jack_time_t current_time)
  171. {
  172. bool zombi_clients[CLIENT_NUM];
  173. GetZombifiedClients(zombi_clients, current_time);
  174. for (int i = REAL_REFNUM; i < CLIENT_NUM; i++) {
  175. if (zombi_clients[i] && !fClientTable[i]->GetClientControl()->fZombie) {
  176. fClientTable[i]->GetClientControl()->fZombie = true;
  177. JackLog("RemoveZombifiedCients: name = %s\n", fClientTable[i]->GetClientControl()->fName);
  178. fGraphManager->DirectDisconnect(FREEWHEEL_DRIVER_REFNUM, i);
  179. fGraphManager->DirectDisconnect(i, FREEWHEEL_DRIVER_REFNUM);
  180. fGraphManager->DisconnectAllPorts(i);
  181. fChannel->ClientNotify(i, JackNotifyChannelInterface::kZombifyClient, 0); // Signal engine
  182. }
  183. }
  184. }
  185. void JackEngine::ZombifyClient(int refnum)
  186. {
  187. NotifyClient(refnum, JackNotifyChannelInterface::kZombifyClient, false, 0);
  188. }
  189. //---------------
  190. // Notifications
  191. //---------------
  192. void JackEngine::NotifyClient(int refnum, int event, int sync, int value)
  193. {
  194. JackClientInterface* client = fClientTable[refnum];
  195. // The client may be notified by the RT thread while closing
  196. if (client && (client->ClientNotify(refnum, client->GetClientControl()->fName, event, sync, value) < 0)) {
  197. jack_error("NotifyClient fails name = %s event = %ld = val = %ld", client->GetClientControl()->fName, event, value);
  198. } else {
  199. JackLog("JackEngine::NotifyClient: client not available anymore\n");
  200. }
  201. }
  202. void JackEngine::NotifyClients(int event, int sync, int value)
  203. {
  204. for (int i = 0; i < CLIENT_NUM; i++) {
  205. JackClientInterface* client = fClientTable[i];
  206. if (client && (client->ClientNotify(i, client->GetClientControl()->fName, event, sync, value) < 0)) {
  207. jack_error("NotifyClient fails name = %s event = %ld = val = %ld", client->GetClientControl()->fName, event, value);
  208. }
  209. }
  210. }
  211. int JackEngine::NotifyAddClient(JackClientInterface* new_client, const char* name, int refnum)
  212. {
  213. // Notify existing clients of the new client and new client of existing clients.
  214. for (int i = 0; i < CLIENT_NUM; i++) {
  215. JackClientInterface* old_client = fClientTable[i];
  216. if (old_client) {
  217. if (old_client->ClientNotify(refnum, name, JackNotifyChannelInterface::kAddClient, true, 0) < 0)
  218. return -1;
  219. if (new_client->ClientNotify(i, old_client->GetClientControl()->fName, JackNotifyChannelInterface::kAddClient, true, 0) < 0)
  220. return -1;
  221. }
  222. }
  223. return 0;
  224. }
  225. void JackEngine::NotifyRemoveClient(const char* name, int refnum)
  226. {
  227. // Notify existing clients (including the one beeing suppressed) of the removed client
  228. for (int i = 0; i < CLIENT_NUM; i++) {
  229. JackClientInterface* client = fClientTable[i];
  230. if (client) {
  231. client->ClientNotify(refnum, name, JackNotifyChannelInterface::kRemoveClient, true, 0);
  232. }
  233. }
  234. }
  235. // Coming from the driver
  236. void JackEngine::NotifyXRun(jack_time_t callback_usecs)
  237. {
  238. // Use the audio thread => request thread communication channel
  239. fEngineControl->fFrameTimer.ResetFrameTime(fEngineControl->fSampleRate, callback_usecs, fEngineControl->fPeriodUsecs);
  240. fChannel->ClientNotify(ALL_CLIENTS, JackNotifyChannelInterface::kXRunCallback, 0);
  241. }
  242. void JackEngine::NotifyXRun(int refnum)
  243. {
  244. if (refnum == ALL_CLIENTS) {
  245. NotifyClients(JackNotifyChannelInterface::kXRunCallback, false, 0);
  246. } else {
  247. NotifyClient(refnum, JackNotifyChannelInterface::kXRunCallback, false, 0);
  248. }
  249. }
  250. void JackEngine::NotifyGraphReorder()
  251. {
  252. NotifyClients(JackNotifyChannelInterface::kGraphOrderCallback, false, 0);
  253. }
  254. void JackEngine::NotifyBufferSize(jack_nframes_t nframes)
  255. {
  256. NotifyClients(JackNotifyChannelInterface::kBufferSizeCallback, true, nframes);
  257. }
  258. void JackEngine::NotifyFreewheel(bool onoff)
  259. {
  260. fEngineControl->fRealTime = !onoff;
  261. NotifyClients((onoff ? JackNotifyChannelInterface::kStartFreewheel : JackNotifyChannelInterface::kStopFreewheel), true, 0);
  262. }
  263. void JackEngine::NotifyPortRegistation(jack_port_id_t port_index, bool onoff)
  264. {
  265. NotifyClients((onoff ? JackNotifyChannelInterface::kPortRegistrationOn : JackNotifyChannelInterface::kPortRegistrationOff), false, port_index);
  266. }
  267. //-------------------
  268. // Client management
  269. //-------------------
  270. bool JackEngine::ClientCheckName(const char* name)
  271. {
  272. for (int i = 0; i < CLIENT_NUM; i++) {
  273. JackClientInterface* client = fClientTable[i];
  274. if (client && (strcmp(client->GetClientControl()->fName, name) == 0))
  275. return true;
  276. }
  277. return false;
  278. }
  279. // Used for external clients
  280. int JackEngine::ClientNew(const char* name, int* ref, int* shared_engine, int* shared_client, int* shared_graph_manager)
  281. {
  282. if (ClientCheckName(name)) {
  283. jack_error("client %s already registered", name);
  284. return -1;
  285. }
  286. JackExternalClient* client = new JackExternalClient();
  287. if (ClientExternalNew(name, ref, shared_engine, shared_client, shared_graph_manager, client) < 0) {
  288. delete client;
  289. return -1;
  290. }
  291. return 0;
  292. }
  293. // Used for external clients
  294. int JackEngine::ClientExternalNew(const char* name, int* ref, int* shared_engine, int* shared_client, int* shared_graph_manager, JackExternalClient* client)
  295. {
  296. JackLog("JackEngine::ClientNew: name = %s \n", name);
  297. int refnum = fGraphManager->AllocateRefNum();
  298. if (refnum < 0) {
  299. jack_error("No more refnum available");
  300. return -1;
  301. }
  302. if (!fSynchroTable[refnum]->Allocate(name, 0)) {
  303. jack_error("Cannot allocate synchro");
  304. goto error;
  305. }
  306. if (client->Open(name, refnum, shared_client) < 0) {
  307. jack_error("Cannot open client");
  308. goto error;
  309. }
  310. if (!fSignal->TimedWait(5 * 1000000)) {
  311. // Failure if RT thread is not running (problem with the driver...)
  312. jack_error("Driver is not running");
  313. goto error;
  314. }
  315. if (NotifyAddClient(client, name, refnum) < 0) {
  316. jack_error("Cannot notify add client");
  317. goto error;
  318. }
  319. fClientTable[refnum] = client;
  320. fTiming->ResetRollingUsecs();
  321. *shared_engine = fEngineControl->GetShmIndex();
  322. *shared_graph_manager = fGraphManager->GetShmIndex();
  323. *ref = refnum;
  324. return 0;
  325. error:
  326. fGraphManager->ReleaseRefNum(refnum);
  327. ClientCloseAux(refnum, client, false);
  328. client->Close();
  329. return -1;
  330. }
  331. // Used for server driver clients
  332. int JackEngine::ClientInternalNew(const char* name, int* ref, JackEngineControl** shared_engine, JackGraphManager** shared_manager, JackClientInterface* client)
  333. {
  334. JackLog("JackEngine::ClientInternalNew: name = %s\n", name);
  335. int refnum = fGraphManager->AllocateRefNum();
  336. if (refnum < 0) {
  337. jack_error("No more refnum available");
  338. return -1;
  339. }
  340. if (!fSynchroTable[refnum]->Allocate(name, 0)) {
  341. jack_error("Cannot allocate synchro");
  342. goto error;
  343. }
  344. if (NotifyAddClient(client, name, refnum) < 0) {
  345. jack_error("Cannot notify add client");
  346. goto error;
  347. }
  348. fClientTable[refnum] = client;
  349. fTiming->ResetRollingUsecs();
  350. *shared_engine = fEngineControl;
  351. *shared_manager = fGraphManager;
  352. *ref = refnum;
  353. return 0;
  354. error:
  355. fGraphManager->ReleaseRefNum(refnum);
  356. return -1;
  357. }
  358. // Used for externall clients
  359. int JackEngine::ClientClose(int refnum)
  360. {
  361. JackClientInterface* client = fClientTable[refnum];
  362. if (client) {
  363. fEngineControl->fTransport.ResetTimebase(refnum);
  364. int res = ClientCloseAux(refnum, client, true);
  365. client->Close();
  366. delete client;
  367. return res;
  368. } else {
  369. return -1;
  370. }
  371. }
  372. // Used for server internal clients
  373. int JackEngine::ClientInternalClose(int refnum)
  374. {
  375. JackClientInterface* client = fClientTable[refnum];
  376. return (client) ? ClientCloseAux(refnum, client, true) : -1;
  377. }
  378. // Used for drivers that close when the RT thread is stopped
  379. int JackEngine::ClientInternalCloseIm(int refnum)
  380. {
  381. JackClientInterface* client = fClientTable[refnum];
  382. return (client) ? ClientCloseAux(refnum, client, false) : -1;
  383. }
  384. int JackEngine::ClientCloseAux(int refnum, JackClientInterface* client, bool wait)
  385. {
  386. JackLog("JackEngine::ClientCloseAux ref = %ld name = %s\n", refnum, client->GetClientControl()->fName);
  387. // Remove the client from the table
  388. fClientTable[refnum] = NULL;
  389. // Remove ports
  390. fGraphManager->RemoveAllPorts(refnum);
  391. // Wait until next cycle to be sure client is not used anymore
  392. if (wait) {
  393. if (!fSignal->TimedWait(fEngineControl->fTimeOutUsecs * 2)) { // Must wait at least until a switch occurs in Process, even in case of graph end failure
  394. JackLog("JackEngine::ClientCloseAux wait error ref = %ld \n", refnum);
  395. }
  396. }
  397. // Notify running clients
  398. NotifyRemoveClient(client->GetClientControl()->fName, client->GetClientControl()->fRefNum);
  399. // Cleanup...
  400. fSynchroTable[refnum]->Destroy();
  401. fGraphManager->ReleaseRefNum(refnum);
  402. fTiming->ResetRollingUsecs();
  403. return 0;
  404. }
  405. int JackEngine::ClientActivate(int refnum)
  406. {
  407. JackClientInterface* client = fClientTable[refnum];
  408. assert(fClientTable[refnum]);
  409. JackLog("JackEngine::ClientActivate ref = %ld name = %s\n", refnum, client->GetClientControl()->fName);
  410. // Wait for graph state change to be effective
  411. if (!fSignal->TimedWait(fEngineControl->fPeriodUsecs * 10)) {
  412. JackLog("JackEngine::ClientActivate wait error ref = %ld name = %s\n", refnum, client->GetClientControl()->fName);
  413. return -1;
  414. } else {
  415. return 0;
  416. }
  417. }
  418. // May be called without client
  419. int JackEngine::ClientDeactivate(int refnum)
  420. {
  421. JackClientInterface* client = fClientTable[refnum];
  422. if (client == NULL)
  423. return -1;
  424. JackLog("JackEngine::ClientDeactivate ref = %ld name = %s\n", refnum, client->GetClientControl()->fName);
  425. fGraphManager->DisconnectAllPorts(refnum);
  426. // Wait for graph state change to be effective
  427. if (!fSignal->TimedWait(fEngineControl->fPeriodUsecs * 10)) {
  428. JackLog("JackEngine::ClientDeactivate wait error ref = %ld name = %s\n", refnum, client->GetClientControl()->fName);
  429. return -1;
  430. } else {
  431. return 0;
  432. }
  433. }
  434. //-----------------
  435. // Port management
  436. //-----------------
  437. int JackEngine::PortRegister(int refnum, const char* name, unsigned int flags, unsigned int buffer_size, jack_port_id_t* port_index)
  438. {
  439. JackLog("JackEngine::PortRegister ref = %ld name = %s flags = %d buffer_size = %d\n", refnum, name, flags, buffer_size);
  440. assert(fClientTable[refnum]);
  441. *port_index = fGraphManager->AllocatePort(refnum, name, (JackPortFlags)flags);
  442. if (*port_index != NO_PORT) {
  443. NotifyPortRegistation(*port_index, true);
  444. return 0;
  445. } else {
  446. return -1;
  447. }
  448. }
  449. int JackEngine::PortUnRegister(int refnum, jack_port_id_t port_index)
  450. {
  451. JackLog("JackEngine::PortUnRegister ref = %ld port_index = %ld\n", refnum, port_index);
  452. assert(fClientTable[refnum]);
  453. if (fGraphManager->RemovePort(refnum, port_index) == 0) {
  454. fGraphManager->ReleasePort(port_index);
  455. NotifyPortRegistation(port_index, false);
  456. return 0;
  457. } else {
  458. return -1;
  459. }
  460. }
  461. int JackEngine::PortConnect(int refnum, const char* src, const char* dst)
  462. {
  463. JackLog("JackEngine::PortConnect src = %s dst = %s\n", src, dst);
  464. jack_port_id_t port_src, port_dst;
  465. return (fGraphManager->CheckPorts(src, dst, &port_src, &port_dst) < 0)
  466. ? -1
  467. : PortConnect(refnum, port_src, port_dst);
  468. }
  469. int JackEngine::PortDisconnect(int refnum, const char* src, const char* dst)
  470. {
  471. JackLog("JackEngine::PortDisconnect src = %s dst = %s\n", src, dst);
  472. jack_port_id_t port_src, port_dst;
  473. return (fGraphManager->CheckPorts(src, dst, &port_src, &port_dst) < 0)
  474. ? -1
  475. : fGraphManager->Disconnect(port_src, port_dst);
  476. }
  477. int JackEngine::PortConnect(int refnum, jack_port_id_t src, jack_port_id_t dst)
  478. {
  479. JackLog("JackEngine::PortConnect src = %d dst = %d\n", src, dst);
  480. JackClientInterface* client;
  481. int ref;
  482. if (fGraphManager->CheckPorts(src, dst) < 0)
  483. return -1;
  484. ref = fGraphManager->GetOutputRefNum(src);
  485. assert(ref >= 0);
  486. client = fClientTable[ref];
  487. assert(client);
  488. if (!client->GetClientControl()->fActive) {
  489. jack_error("Cannot connect ports owned by inactive clients:"
  490. " \"%s\" is not active", client->GetClientControl()->fName);
  491. return -1;
  492. }
  493. ref = fGraphManager->GetInputRefNum(dst);
  494. assert(ref >= 0);
  495. client = fClientTable[ref];
  496. assert(client);
  497. if (!client->GetClientControl()->fActive) {
  498. jack_error("Cannot connect ports owned by inactive clients:"
  499. " \"%s\" is not active", client->GetClientControl()->fName);
  500. return -1;
  501. }
  502. return fGraphManager->Connect(src, dst);
  503. }
  504. int JackEngine::PortDisconnect(int refnum, jack_port_id_t src, jack_port_id_t dst)
  505. {
  506. JackLog("JackEngine::PortDisconnect src = %d dst = %d\n", src, dst);
  507. if (dst == ALL_PORTS) {
  508. return (fGraphManager->CheckPort(src) < 0)
  509. ? -1
  510. : fGraphManager->DisconnectAll(src);
  511. } else {
  512. return (fGraphManager->CheckPorts(src, dst) < 0)
  513. ? -1
  514. : fGraphManager->Disconnect(src, dst);
  515. }
  516. }
  517. //----------------------
  518. // Transport management
  519. //----------------------
  520. int JackEngine::ReleaseTimebase(int refnum)
  521. {
  522. return fEngineControl->fTransport.ResetTimebase(refnum);
  523. }
  524. int JackEngine::SetTimebaseCallback(int refnum, int conditional)
  525. {
  526. return fEngineControl->fTransport.SetTimebase(refnum, conditional);
  527. }
  528. //-----------
  529. // Debugging
  530. //-----------
  531. void JackEngine::PrintState()
  532. {
  533. std::cout << "Engine State" << std::endl;
  534. for (int i = 0; i < CLIENT_NUM; i++) {
  535. JackClientInterface* client = fClientTable[i];
  536. if (client)
  537. std::cout << "Client : " << client->GetClientControl()->fName << " : " << i << std::endl;
  538. }
  539. //fGraphManager->PrintState();
  540. fTiming->PrintState();
  541. }
  542. } // end of namespace