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.

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