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.

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