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.

644 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. {
  125. JackClientInterface* client = fClientTable[i];
  126. if (client && client->GetClientControl()->fActive) {
  127. JackClientTiming* timing = fGraphManager->GetClientTiming(i);
  128. jack_client_state_t status = timing->fStatus;
  129. jack_time_t finished_date = timing->fFinishedAt;
  130. if (status != NotTriggered && status != Finished) {
  131. jack_error("JackEngine::XRun: client = %s was not runned: state = %ld", client->GetClientControl()->fName, status);
  132. //fChannel->ClientNotify(i, kXRunCallback, 0); // Notify the failing client
  133. fChannel->ClientNotify(ALL_CLIENTS, JackNotifyChannelInterface::kXRunCallback, 0); // Notify all clients
  134. }
  135. if (status == Finished && (long)(finished_date - callback_usecs) > 0) {
  136. jack_error("JackEngine::XRun: client %s finished after current callback", client->GetClientControl()->fName);
  137. //fChannel->ClientNotify(i, kXRunCallback, 0); // Notify the failing client
  138. fChannel->ClientNotify(ALL_CLIENTS, JackNotifyChannelInterface::kXRunCallback, 0); // Notify all clients
  139. }
  140. }
  141. }
  142. }
  143. //---------------
  144. // Zombification
  145. //---------------
  146. bool JackEngine::IsZombie(JackClientInterface* client, jack_time_t current_time)
  147. {
  148. return ((current_time - fGraphManager->GetClientTiming(client->GetClientControl()->fRefNum)->fFinishedAt) > 2 * fEngineControl->fTimeOutUsecs); // A VERIFIER
  149. }
  150. // TODO : check what happens with looped sub-graph....
  151. void JackEngine::GetZombifiedClients(bool zombi_clients[CLIENT_NUM], jack_time_t current_time)
  152. {
  153. for (int i = REAL_REFNUM; i < CLIENT_NUM; i++) {
  154. JackClientInterface* client1 = fClientTable[i];
  155. if (client1 && IsZombie(client1, current_time)) {
  156. JackLog("JackEngine::GetZombifiedClients: %s\n", client1->GetClientControl()->fName);
  157. zombi_clients[i] = true; // Assume client is dead
  158. // If another dead client is connected to the scanned one, then the scanned one is not the first of the dead subgraph
  159. for (int j = REAL_REFNUM; j < CLIENT_NUM; j++) {
  160. JackClientInterface* client2 = fClientTable[j];
  161. if (client2 && IsZombie(client2, current_time) && fGraphManager->IsDirectConnection(j, i)) {
  162. zombi_clients[i] = false;
  163. break;
  164. }
  165. }
  166. } else {
  167. zombi_clients[i] = false;
  168. }
  169. }
  170. }
  171. void JackEngine::RemoveZombifiedClients(jack_time_t current_time)
  172. {
  173. bool zombi_clients[CLIENT_NUM];
  174. GetZombifiedClients(zombi_clients, current_time);
  175. for (int i = REAL_REFNUM; i < CLIENT_NUM; i++) {
  176. if (zombi_clients[i] && !fClientTable[i]->GetClientControl()->fZombie) {
  177. fClientTable[i]->GetClientControl()->fZombie = true;
  178. JackLog("RemoveZombifiedCients: name = %s\n", fClientTable[i]->GetClientControl()->fName);
  179. fGraphManager->DirectDisconnect(FREEWHEEL_DRIVER_REFNUM, i);
  180. fGraphManager->DirectDisconnect(i, FREEWHEEL_DRIVER_REFNUM);
  181. fGraphManager->DisconnectAllPorts(i);
  182. fChannel->ClientNotify(i, JackNotifyChannelInterface::kZombifyClient, 0); // Signal engine
  183. }
  184. }
  185. }
  186. void JackEngine::ZombifyClient(int refnum)
  187. {
  188. NotifyClient(refnum, JackNotifyChannelInterface::kZombifyClient, false, 0);
  189. }
  190. //---------------
  191. // Notifications
  192. //---------------
  193. void JackEngine::NotifyClient(int refnum, int event, int sync, int value)
  194. {
  195. JackClientInterface* client = fClientTable[refnum];
  196. // The client may be notified by the RT thread while closing
  197. if (client && (client->ClientNotify(refnum, client->GetClientControl()->fName, event, sync, value) < 0)) {
  198. jack_error("NotifyClient fails name = %s event = %ld = val = %ld", client->GetClientControl()->fName, event, value);
  199. } else {
  200. JackLog("JackEngine::NotifyClient: client not available anymore\n");
  201. }
  202. }
  203. void JackEngine::NotifyClients(int event, int sync, int value)
  204. {
  205. for (int i = 0; i < CLIENT_NUM; i++) {
  206. JackClientInterface* client = fClientTable[i];
  207. if (client && (client->ClientNotify(i, client->GetClientControl()->fName, event, sync, value) < 0)) {
  208. jack_error("NotifyClient fails name = %s event = %ld = val = %ld", client->GetClientControl()->fName, event, value);
  209. }
  210. }
  211. }
  212. int JackEngine::NotifyAddClient(JackClientInterface* new_client, const char* name, int refnum)
  213. {
  214. // Notify existing clients of the new client and new client of existing clients.
  215. for (int i = 0; i < CLIENT_NUM; i++) {
  216. JackClientInterface* old_client = fClientTable[i];
  217. if (old_client) {
  218. if (old_client->ClientNotify(refnum, name, JackNotifyChannelInterface::kAddClient, true, 0) < 0)
  219. return -1;
  220. if (new_client->ClientNotify(i, old_client->GetClientControl()->fName, JackNotifyChannelInterface::kAddClient, true, 0) < 0)
  221. return -1;
  222. }
  223. }
  224. return 0;
  225. }
  226. void JackEngine::NotifyRemoveClient(const char* name, int refnum)
  227. {
  228. // Notify existing clients (including the one beeing suppressed) of the removed client
  229. for (int i = 0; i < CLIENT_NUM; i++) {
  230. JackClientInterface* client = fClientTable[i];
  231. if (client) {
  232. client->ClientNotify(refnum, name, JackNotifyChannelInterface::kRemoveClient, true, 0);
  233. }
  234. }
  235. }
  236. // Coming from the driver
  237. void JackEngine::NotifyXRun(jack_time_t callback_usecs)
  238. {
  239. // Use the audio thread => request thread communication channel
  240. fEngineControl->fFrameTimer.ResetFrameTime(fEngineControl->fSampleRate, callback_usecs, fEngineControl->fPeriodUsecs);
  241. fChannel->ClientNotify(ALL_CLIENTS, JackNotifyChannelInterface::kXRunCallback, 0);
  242. }
  243. void JackEngine::NotifyXRun(int refnum)
  244. {
  245. if (refnum == ALL_CLIENTS) {
  246. NotifyClients(JackNotifyChannelInterface::kXRunCallback, false, 0);
  247. } else {
  248. NotifyClient(refnum, JackNotifyChannelInterface::kXRunCallback, false, 0);
  249. }
  250. }
  251. void JackEngine::NotifyGraphReorder()
  252. {
  253. NotifyClients(JackNotifyChannelInterface::kGraphOrderCallback, false, 0);
  254. }
  255. void JackEngine::NotifyBufferSize(jack_nframes_t nframes)
  256. {
  257. NotifyClients(JackNotifyChannelInterface::kBufferSizeCallback, true, nframes);
  258. }
  259. void JackEngine::NotifyFreewheel(bool onoff)
  260. {
  261. fEngineControl->fRealTime = !onoff;
  262. NotifyClients((onoff ? JackNotifyChannelInterface::kStartFreewheel : JackNotifyChannelInterface::kStopFreewheel), true, 0);
  263. }
  264. void JackEngine::NotifyPortRegistation(jack_port_id_t port_index, bool onoff)
  265. {
  266. NotifyClients((onoff ? JackNotifyChannelInterface::kPortRegistrationOn : JackNotifyChannelInterface::kPortRegistrationOff), false, port_index);
  267. }
  268. //-------------------
  269. // Client management
  270. //-------------------
  271. bool JackEngine::ClientCheckName(const char* name)
  272. {
  273. for (int i = 0; i < CLIENT_NUM; i++) {
  274. JackClientInterface* client = fClientTable[i];
  275. if (client && (strcmp(client->GetClientControl()->fName, name) == 0))
  276. return true;
  277. }
  278. return false;
  279. }
  280. // Used for external clients
  281. int JackEngine::ClientNew(const char* name, int* ref, int* shared_engine, int* shared_client, int* shared_graph_manager)
  282. {
  283. if (ClientCheckName(name)) {
  284. jack_error("client %s already registered", name);
  285. return -1;
  286. }
  287. JackExternalClient* client = new JackExternalClient();
  288. if (ClientExternalNew(name, ref, shared_engine, shared_client, shared_graph_manager, client) < 0) {
  289. delete client;
  290. return -1;
  291. }
  292. return 0;
  293. }
  294. // Used for external clients
  295. int JackEngine::ClientExternalNew(const char* name, int* ref, int* shared_engine, int* shared_client, int* shared_graph_manager, JackExternalClient* client)
  296. {
  297. JackLog("JackEngine::ClientNew: name = %s \n", name);
  298. int refnum = fGraphManager->AllocateRefNum();
  299. if (refnum < 0) {
  300. jack_error("No more refnum available");
  301. return -1;
  302. }
  303. if (!fSynchroTable[refnum]->Allocate(name, 0)) {
  304. jack_error("Cannot allocate synchro");
  305. goto error;
  306. }
  307. if (client->Open(name, refnum, shared_client) < 0) {
  308. jack_error("Cannot open client");
  309. goto error;
  310. }
  311. if (!fSignal->TimedWait(5 * 1000000)) {
  312. // Failure if RT thread is not running (problem with the driver...)
  313. jack_error("Driver is not running");
  314. goto error;
  315. }
  316. if (NotifyAddClient(client, name, refnum) < 0) {
  317. jack_error("Cannot notify add client");
  318. goto error;
  319. }
  320. fClientTable[refnum] = client;
  321. fTiming->ResetRollingUsecs();
  322. *shared_engine = fEngineControl->GetShmIndex();
  323. *shared_graph_manager = fGraphManager->GetShmIndex();
  324. *ref = refnum;
  325. return 0;
  326. error:
  327. fGraphManager->ReleaseRefNum(refnum);
  328. ClientCloseAux(refnum, client, false);
  329. client->Close();
  330. return -1;
  331. }
  332. // Used for server driver clients
  333. int JackEngine::ClientInternalNew(const char* name, int* ref, JackEngineControl** shared_engine, JackGraphManager** shared_manager, JackClientInterface* client)
  334. {
  335. JackLog("JackEngine::ClientInternalNew: name = %s\n", name);
  336. int refnum = fGraphManager->AllocateRefNum();
  337. if (refnum < 0) {
  338. jack_error("No more refnum available");
  339. return -1;
  340. }
  341. if (!fSynchroTable[refnum]->Allocate(name, 0)) {
  342. jack_error("Cannot allocate synchro");
  343. goto error;
  344. }
  345. if (NotifyAddClient(client, name, refnum) < 0) {
  346. jack_error("Cannot notify add client");
  347. goto error;
  348. }
  349. fClientTable[refnum] = client;
  350. fTiming->ResetRollingUsecs();
  351. *shared_engine = fEngineControl;
  352. *shared_manager = fGraphManager;
  353. *ref = refnum;
  354. return 0;
  355. error:
  356. fGraphManager->ReleaseRefNum(refnum);
  357. return -1;
  358. }
  359. // Used for externall clients
  360. int JackEngine::ClientClose(int refnum)
  361. {
  362. JackClientInterface* client = fClientTable[refnum];
  363. if (client) {
  364. fEngineControl->fTransport.ResetTimebase(refnum);
  365. int res = ClientCloseAux(refnum, client, true);
  366. client->Close();
  367. delete client;
  368. return res;
  369. } else {
  370. return -1;
  371. }
  372. }
  373. // Used for server internal clients
  374. int JackEngine::ClientInternalClose(int refnum)
  375. {
  376. JackClientInterface* client = fClientTable[refnum];
  377. return (client) ? ClientCloseAux(refnum, client, true) : -1;
  378. }
  379. // Used for drivers that close when the RT thread is stopped
  380. int JackEngine::ClientInternalCloseIm(int refnum)
  381. {
  382. JackClientInterface* client = fClientTable[refnum];
  383. return (client) ? ClientCloseAux(refnum, client, false) : -1;
  384. }
  385. int JackEngine::ClientCloseAux(int refnum, JackClientInterface* client, bool wait)
  386. {
  387. JackLog("JackEngine::ClientCloseAux ref = %ld name = %s\n", refnum, client->GetClientControl()->fName);
  388. // Remove the client from the table
  389. fClientTable[refnum] = NULL;
  390. // Remove ports
  391. fGraphManager->RemoveAllPorts(refnum);
  392. // Wait until next cycle to be sure client is not used anymore
  393. if (wait) {
  394. if (!fSignal->TimedWait(fEngineControl->fTimeOutUsecs * 2)) { // Must wait at least until a switch occurs in Process, even in case of graph end failure
  395. JackLog("JackEngine::ClientCloseAux wait error ref = %ld \n", refnum);
  396. }
  397. }
  398. // Notify running clients
  399. NotifyRemoveClient(client->GetClientControl()->fName, client->GetClientControl()->fRefNum);
  400. // Cleanup...
  401. fSynchroTable[refnum]->Destroy();
  402. fGraphManager->ReleaseRefNum(refnum);
  403. fTiming->ResetRollingUsecs();
  404. return 0;
  405. }
  406. int JackEngine::ClientActivate(int refnum)
  407. {
  408. JackClientInterface* client = fClientTable[refnum];
  409. assert(fClientTable[refnum]);
  410. JackLog("JackEngine::ClientActivate ref = %ld name = %s\n", refnum, client->GetClientControl()->fName);
  411. // Wait for graph state change to be effective
  412. if (!fSignal->TimedWait(fEngineControl->fPeriodUsecs * 10)) {
  413. JackLog("JackEngine::ClientActivate wait error ref = %ld name = %s\n", refnum, client->GetClientControl()->fName);
  414. return -1;
  415. } else {
  416. return 0;
  417. }
  418. }
  419. // May be called without client
  420. int JackEngine::ClientDeactivate(int refnum)
  421. {
  422. JackClientInterface* client = fClientTable[refnum];
  423. if (client == NULL)
  424. return -1;
  425. JackLog("JackEngine::ClientDeactivate ref = %ld name = %s\n", refnum, client->GetClientControl()->fName);
  426. fGraphManager->DisconnectAllPorts(refnum);
  427. // Wait for graph state change to be effective
  428. if (!fSignal->TimedWait(fEngineControl->fPeriodUsecs * 10)) {
  429. JackLog("JackEngine::ClientDeactivate wait error ref = %ld name = %s\n", refnum, client->GetClientControl()->fName);
  430. return -1;
  431. } else {
  432. return 0;
  433. }
  434. }
  435. //-----------------
  436. // Port management
  437. //-----------------
  438. int JackEngine::PortRegister(int refnum, const char* name, unsigned int flags, unsigned int buffer_size, jack_port_id_t* port_index)
  439. {
  440. JackLog("JackEngine::PortRegister ref = %ld name = %s flags = %d buffer_size = %d\n", refnum, name, flags, buffer_size);
  441. assert(fClientTable[refnum]);
  442. *port_index = fGraphManager->AllocatePort(refnum, name, (JackPortFlags)flags);
  443. if (*port_index != NO_PORT) {
  444. NotifyPortRegistation(*port_index, true);
  445. return 0;
  446. } else {
  447. return -1;
  448. }
  449. }
  450. int JackEngine::PortUnRegister(int refnum, jack_port_id_t port_index)
  451. {
  452. JackLog("JackEngine::PortUnRegister ref = %ld port_index = %ld\n", refnum, port_index);
  453. assert(fClientTable[refnum]);
  454. if (fGraphManager->RemovePort(refnum, port_index) == 0) {
  455. fGraphManager->ReleasePort(port_index);
  456. NotifyPortRegistation(port_index, false);
  457. return 0;
  458. } else {
  459. return -1;
  460. }
  461. }
  462. int JackEngine::PortConnect(int refnum, const char* src, const char* dst)
  463. {
  464. JackLog("JackEngine::PortConnect src = %s dst = %s\n", src, dst);
  465. jack_port_id_t port_src, port_dst;
  466. return (fGraphManager->CheckPorts(src, dst, &port_src, &port_dst) < 0)
  467. ? -1
  468. : PortConnect(refnum, port_src, port_dst);
  469. }
  470. int JackEngine::PortDisconnect(int refnum, const char* src, const char* dst)
  471. {
  472. JackLog("JackEngine::PortDisconnect src = %s dst = %s\n", src, dst);
  473. jack_port_id_t port_src, port_dst;
  474. return (fGraphManager->CheckPorts(src, dst, &port_src, &port_dst) < 0)
  475. ? -1
  476. : fGraphManager->Disconnect(port_src, port_dst);
  477. }
  478. int JackEngine::PortConnect(int refnum, jack_port_id_t src, jack_port_id_t dst)
  479. {
  480. JackLog("JackEngine::PortConnect src = %d dst = %d\n", src, dst);
  481. JackClientInterface* client;
  482. int ref;
  483. if (fGraphManager->CheckPorts(src, dst) < 0)
  484. return -1;
  485. ref = fGraphManager->GetOutputRefNum(src);
  486. assert(ref >= 0);
  487. client = fClientTable[ref];
  488. assert(client);
  489. if (!client->GetClientControl()->fActive) {
  490. jack_error("Cannot connect ports owned by inactive clients:"
  491. " \"%s\" is not active", client->GetClientControl()->fName);
  492. return -1;
  493. }
  494. ref = fGraphManager->GetInputRefNum(dst);
  495. assert(ref >= 0);
  496. client = fClientTable[ref];
  497. assert(client);
  498. if (!client->GetClientControl()->fActive) {
  499. jack_error("Cannot connect ports owned by inactive clients:"
  500. " \"%s\" is not active", client->GetClientControl()->fName);
  501. return -1;
  502. }
  503. return fGraphManager->Connect(src, dst);
  504. }
  505. int JackEngine::PortDisconnect(int refnum, jack_port_id_t src, jack_port_id_t dst)
  506. {
  507. JackLog("JackEngine::PortDisconnect src = %d dst = %d\n", src, dst);
  508. if (dst == ALL_PORTS) {
  509. return (fGraphManager->CheckPort(src) < 0)
  510. ? -1
  511. : fGraphManager->DisconnectAll(src);
  512. } else {
  513. return (fGraphManager->CheckPorts(src, dst) < 0)
  514. ? -1
  515. : fGraphManager->Disconnect(src, dst);
  516. }
  517. }
  518. //----------------------
  519. // Transport management
  520. //----------------------
  521. int JackEngine::ReleaseTimebase(int refnum)
  522. {
  523. return fEngineControl->fTransport.ResetTimebase(refnum);
  524. }
  525. int JackEngine::SetTimebaseCallback(int refnum, int conditional)
  526. {
  527. return fEngineControl->fTransport.SetTimebase(refnum, conditional);
  528. }
  529. //-----------
  530. // Debugging
  531. //-----------
  532. void JackEngine::PrintState()
  533. {
  534. std::cout << "Engine State" << std::endl;
  535. for (int i = 0; i < CLIENT_NUM; i++) {
  536. JackClientInterface* client = fClientTable[i];
  537. if (client)
  538. std::cout << "Client : " << client->GetClientControl()->fName << " : " << i << std::endl;
  539. }
  540. //fGraphManager->PrintState();
  541. fTiming->PrintState();
  542. }
  543. } // end of namespace