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.

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