JACK API headers
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.

1299 lines
47KB

  1. /*
  2. Copyright (C) 2001 Paul Davis
  3. Copyright (C) 2004 Jack O'Quin
  4. This program is free software; you can redistribute it and/or modify
  5. it under the terms of the GNU Lesser General Public License as published by
  6. the Free Software Foundation; either version 2.1 of the License, or
  7. (at your option) any later version.
  8. This program is distributed in the hope that it will be useful,
  9. but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. GNU Lesser General Public License for more details.
  12. You should have received a copy of the GNU Lesser General Public License
  13. along with this program; if not, write to the Free Software
  14. Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  15. */
  16. #ifndef __jack_h__
  17. #define __jack_h__
  18. #ifdef __cplusplus
  19. extern "C" {
  20. #endif
  21. #include <jack/types.h>
  22. #include <jack/transport.h>
  23. /**
  24. * Note: More documentation can be found in jack/types.h.
  25. */
  26. /*************************************************************
  27. * NOTE: JACK_WEAK_EXPORT ***MUST*** be used on every function
  28. * added to the JACK API after the 0.116.2 release.
  29. *
  30. * Functions that predate this release are marked with
  31. * JACK_WEAK_OPTIONAL_EXPORT which can be defined at compile
  32. * time in a variety of ways. The default definition is empty,
  33. * so that these symbols get normal linkage. If you wish to
  34. * use all JACK symbols with weak linkage, include
  35. * <jack/weakjack.h> before jack.h.
  36. *************************************************************/
  37. #include <jack/weakmacros.h>
  38. /**
  39. * @defgroup ClientFunctions Creating & manipulating clients
  40. * @{
  41. */
  42. /**
  43. * Open an external client session with a JACK server. This interface
  44. * is more complex but more powerful than jack_client_new(). With it,
  45. * clients may choose which of several servers to connect, and control
  46. * whether and how to start the server automatically, if it was not
  47. * already running. There is also an option for JACK to generate a
  48. * unique client name, when necessary.
  49. *
  50. * @param client_name of at most jack_client_name_size() characters.
  51. * The name scope is local to each server. Unless forbidden by the
  52. * @ref JackUseExactName option, the server will modify this name to
  53. * create a unique variant, if needed.
  54. *
  55. * @param options formed by OR-ing together @ref JackOptions bits.
  56. * Only the @ref JackOpenOptions bits are allowed.
  57. *
  58. * @param status (if non-NULL) an address for JACK to return
  59. * information from the open operation. This status word is formed by
  60. * OR-ing together the relevant @ref JackStatus bits.
  61. *
  62. *
  63. * <b>Optional parameters:</b> depending on corresponding [@a options
  64. * bits] additional parameters may follow @a status (in this order).
  65. *
  66. * @arg [@ref JackServerName] <em>(char *) server_name</em> selects
  67. * from among several possible concurrent server instances. Server
  68. * names are unique to each user. If unspecified, use "default"
  69. * unless \$JACK_DEFAULT_SERVER is defined in the process environment.
  70. *
  71. * @return Opaque client handle if successful. If this is NULL, the
  72. * open operation failed, @a *status includes @ref JackFailure and the
  73. * caller is not a JACK client.
  74. */
  75. jack_client_t *jack_client_open (const char *client_name,
  76. jack_options_t options,
  77. jack_status_t *status, ...) JACK_OPTIONAL_WEAK_EXPORT;
  78. /**
  79. * <b>THIS FUNCTION IS DEPRECATED AND SHOULD NOT BE USED IN
  80. * NEW JACK CLIENTS</b>
  81. *
  82. */
  83. jack_client_t *jack_client_new (const char *client_name) JACK_OPTIONAL_WEAK_DEPRECATED_EXPORT;
  84. /**
  85. * Disconnects an external client from a JACK server.
  86. *
  87. * @return 0 on success, otherwise a non-zero error code
  88. */
  89. int jack_client_close (jack_client_t *client) JACK_OPTIONAL_WEAK_EXPORT;
  90. /**
  91. * @return the maximum number of characters in a JACK client name
  92. * including the final NULL character. This value is a constant.
  93. */
  94. int jack_client_name_size (void) JACK_OPTIONAL_WEAK_EXPORT;
  95. /**
  96. * @return pointer to actual client name. This is useful when @ref
  97. * JackUseExactName is not specified on open and @ref
  98. * JackNameNotUnique status was returned. In that case, the actual
  99. * name will differ from the @a client_name requested.
  100. */
  101. char *jack_get_client_name (jack_client_t *client) JACK_OPTIONAL_WEAK_EXPORT;
  102. /**
  103. * @return pointer to a string representation of the UUID for
  104. * a client named @param name. If no such client exists, return NULL
  105. */
  106. char *jack_get_uuid_for_client_name (jack_client_t *client,
  107. const char *name) JACK_WEAK_EXPORT;
  108. /**
  109. * @return a pointer to the name of the client with the UUID
  110. * specified by @param uuid.
  111. *
  112. * Return NULL if no such client with the given UUID exists
  113. */
  114. char *jack_get_client_name_by_uuid (jack_client_t *client,
  115. const char *uuid ) JACK_WEAK_EXPORT;
  116. /**
  117. * Load an internal client into the Jack server.
  118. *
  119. * Internal clients run inside the JACK server process. They can use
  120. * most of the same functions as external clients. Each internal
  121. * client must declare jack_initialize() and jack_finish() entry
  122. * points, called at load and unload times. See inprocess.c for an
  123. * example of how to write an internal client.
  124. *
  125. * @deprecated Please use jack_internal_client_load().
  126. *
  127. * @param client_name of at most jack_client_name_size() characters.
  128. *
  129. * @param load_name of a shared object file containing the code for
  130. * the new client.
  131. *
  132. * @param load_init an arbitary string passed to the jack_initialize()
  133. * routine of the new client (may be NULL).
  134. *
  135. * @return 0 if successful.
  136. */
  137. int jack_internal_client_new (const char *client_name,
  138. const char *load_name,
  139. const char *load_init) JACK_OPTIONAL_WEAK_DEPRECATED_EXPORT;
  140. /**
  141. * Remove an internal client from a JACK server.
  142. *
  143. * @deprecated Please use jack_internal_client_load().
  144. */
  145. void jack_internal_client_close (const char *client_name) JACK_OPTIONAL_WEAK_DEPRECATED_EXPORT;
  146. /**
  147. * Tell the Jack server that the program is ready to start processing
  148. * audio.
  149. *
  150. * @return 0 on success, otherwise a non-zero error code
  151. */
  152. int jack_activate (jack_client_t *client) JACK_OPTIONAL_WEAK_EXPORT;
  153. /**
  154. * Tell the Jack server to remove this @a client from the process
  155. * graph. Also, disconnect all ports belonging to it, since inactive
  156. * clients have no port connections.
  157. *
  158. * @return 0 on success, otherwise a non-zero error code
  159. */
  160. int jack_deactivate (jack_client_t *client) JACK_OPTIONAL_WEAK_EXPORT;
  161. /**
  162. * @return the pthread ID of the thread running the JACK client side
  163. * code.
  164. */
  165. jack_native_thread_t jack_client_thread_id (jack_client_t *) JACK_OPTIONAL_WEAK_EXPORT;
  166. /*@}*/
  167. /**
  168. * @param client pointer to JACK client structure.
  169. *
  170. * Check if the JACK subsystem is running with -R (--realtime).
  171. *
  172. * @return 1 if JACK is running realtime, 0 otherwise
  173. */
  174. int jack_is_realtime (jack_client_t *client) JACK_OPTIONAL_WEAK_EXPORT;
  175. /**
  176. * @defgroup NonCallbackAPI The non-callback API
  177. * @{
  178. */
  179. /**
  180. * <b>THIS FUNCTION IS DEPRECATED AND SHOULD NOT BE USED IN
  181. * NEW JACK CLIENTS</b>
  182. *
  183. * It should be replace by use of @ jack_cycle_wait and @ jack_cycle_signal functions.
  184. *
  185. */
  186. jack_nframes_t jack_thread_wait (jack_client_t*, int status) JACK_OPTIONAL_WEAK_DEPRECATED_EXPORT;
  187. /**
  188. * Wait until this JACK client should process data.
  189. *
  190. * @param client - pointer to a JACK client structure
  191. *
  192. * @return the number of frames of data to process
  193. */
  194. jack_nframes_t jack_cycle_wait (jack_client_t* client) JACK_OPTIONAL_WEAK_EXPORT;
  195. /**
  196. * Signal next clients in the graph.
  197. *
  198. * @param client - pointer to a JACK client structure
  199. * @param status - if non-zero, calling thread should exit
  200. */
  201. void jack_cycle_signal (jack_client_t* client, int status) JACK_OPTIONAL_WEAK_EXPORT;
  202. /**
  203. * Tell the Jack server to call @a thread_callback in the RT thread.
  204. * Typical use are in conjunction with @a jack_cycle_wait and @ jack_cycle_signal functions.
  205. * The code in the supplied function must be suitable for real-time
  206. * execution. That means that it cannot call functions that might
  207. * block for a long time. This includes all I/O functions (disk, TTY, network),
  208. * malloc, free, printf, pthread_mutex_lock, sleep, wait, poll, select, pthread_join,
  209. * pthread_cond_wait, etc, etc.
  210. *
  211. * @return 0 on success, otherwise a non-zero error code.
  212. */
  213. int jack_set_process_thread(jack_client_t* client, JackThreadCallback fun, void *arg) JACK_OPTIONAL_WEAK_EXPORT;
  214. /*@}*/
  215. /**
  216. * @defgroup ClientCallbacks Setting Client Callbacks
  217. * @{
  218. */
  219. /**
  220. * Tell JACK to call @a thread_init_callback once just after
  221. * the creation of the thread in which all other callbacks
  222. * will be handled.
  223. *
  224. * The code in the supplied function does not need to be
  225. * suitable for real-time execution.
  226. *
  227. * @return 0 on success, otherwise a non-zero error code, causing JACK
  228. * to remove that client from the process() graph.
  229. */
  230. int jack_set_thread_init_callback (jack_client_t *client,
  231. JackThreadInitCallback thread_init_callback,
  232. void *arg) JACK_OPTIONAL_WEAK_EXPORT;
  233. /**
  234. * @param client pointer to JACK client structure.
  235. * @param function The jack_shutdown function pointer.
  236. * @param arg The arguments for the jack_shutdown function.
  237. *
  238. * Register a function (and argument) to be called if and when the
  239. * JACK server shuts down the client thread. The function must
  240. * be written as if it were an asynchonrous POSIX signal
  241. * handler --- use only async-safe functions, and remember that it
  242. * is executed from another thread. A typical function might
  243. * set a flag or write to a pipe so that the rest of the
  244. * application knows that the JACK client thread has shut
  245. * down.
  246. *
  247. * NOTE: clients do not need to call this. It exists only
  248. * to help more complex clients understand what is going
  249. * on. It should be called before jack_client_activate().
  250. *
  251. * NOTE: if a client calls this AND jack_on_info_shutdown(), then
  252. * the event of a client thread shutdown, the callback
  253. * passed to this function will not be called, and the one passed to
  254. * jack_on_info_shutdown() will.
  255. */
  256. void jack_on_shutdown (jack_client_t *client,
  257. JackShutdownCallback function, void *arg) JACK_OPTIONAL_WEAK_EXPORT;
  258. /**
  259. * @param client pointer to JACK client structure.
  260. * @param function The jack_shutdown function pointer.
  261. * @param arg The arguments for the jack_shutdown function.
  262. *
  263. * Register a function (and argument) to be called if and when the
  264. * JACK server shuts down the client thread. The function must
  265. * be written as if it were an asynchonrous POSIX signal
  266. * handler --- use only async-safe functions, and remember that it
  267. * is executed from another thread. A typical function might
  268. * set a flag or write to a pipe so that the rest of the
  269. * application knows that the JACK client thread has shut
  270. * down.
  271. *
  272. * NOTE: clients do not need to call this. It exists only
  273. * to help more complex clients understand what is going
  274. * on. It should be called before jack_client_activate().
  275. *
  276. * NOTE: if a client calls this AND jack_on_shutdown(), then in the
  277. * event of a client thread shutdown, the callback passed to
  278. * this function will be called, and the one passed to
  279. * jack_on_shutdown() will not.
  280. */
  281. void jack_on_info_shutdown (jack_client_t *client,
  282. JackInfoShutdownCallback function, void *arg) JACK_WEAK_EXPORT;
  283. /**
  284. * Tell the Jack server to call @a process_callback whenever there is
  285. * work be done, passing @a arg as the second argument.
  286. *
  287. * The code in the supplied function must be suitable for real-time
  288. * execution. That means that it cannot call functions that might
  289. * block for a long time. This includes all I/O functions (disk, TTY, network),
  290. * malloc, free, printf, pthread_mutex_lock, sleep, wait, poll, select, pthread_join,
  291. * pthread_cond_wait, etc, etc.
  292. *
  293. * @return 0 on success, otherwise a non-zero error code, causing JACK
  294. * to remove that client from the process() graph.
  295. */
  296. int jack_set_process_callback (jack_client_t *client,
  297. JackProcessCallback process_callback,
  298. void *arg) JACK_OPTIONAL_WEAK_EXPORT;
  299. /**
  300. * Tell the Jack server to call @a freewheel_callback
  301. * whenever we enter or leave "freewheel" mode, passing @a
  302. * arg as the second argument. The first argument to the
  303. * callback will be non-zero if JACK is entering freewheel
  304. * mode, and zero otherwise.
  305. *
  306. * @return 0 on success, otherwise a non-zero error code.
  307. */
  308. int jack_set_freewheel_callback (jack_client_t *client,
  309. JackFreewheelCallback freewheel_callback,
  310. void *arg) JACK_OPTIONAL_WEAK_EXPORT;
  311. /**
  312. * Tell JACK to call @a bufsize_callback whenever the size of the the
  313. * buffer that will be passed to the @a process_callback is about to
  314. * change. Clients that depend on knowing the buffer size must supply
  315. * a @a bufsize_callback before activating themselves.
  316. *
  317. * @param client pointer to JACK client structure.
  318. * @param bufsize_callback function to call when the buffer size changes.
  319. * @param arg argument for @a bufsize_callback.
  320. *
  321. * @return 0 on success, otherwise a non-zero error code
  322. */
  323. int jack_set_buffer_size_callback (jack_client_t *client,
  324. JackBufferSizeCallback bufsize_callback,
  325. void *arg) JACK_OPTIONAL_WEAK_EXPORT;
  326. /**
  327. * Tell the Jack server to call @a srate_callback whenever the system
  328. * sample rate changes.
  329. *
  330. * @return 0 on success, otherwise a non-zero error code
  331. */
  332. int jack_set_sample_rate_callback (jack_client_t *client,
  333. JackSampleRateCallback srate_callback,
  334. void *arg) JACK_OPTIONAL_WEAK_EXPORT;
  335. /**
  336. * Tell the JACK server to call @a registration_callback whenever a
  337. * port is registered or unregistered, passing @a arg as a parameter.
  338. *
  339. * @return 0 on success, otherwise a non-zero error code
  340. */
  341. int jack_set_client_registration_callback (jack_client_t *,
  342. JackClientRegistrationCallback
  343. registration_callback, void *arg) JACK_OPTIONAL_WEAK_EXPORT;
  344. /**
  345. * Tell the JACK server to call @a registration_callback whenever a
  346. * port is registered or unregistered, passing @a arg as a parameter.
  347. *
  348. * @return 0 on success, otherwise a non-zero error code
  349. */
  350. int jack_set_port_registration_callback (jack_client_t *,
  351. JackPortRegistrationCallback
  352. registration_callback, void *arg) JACK_OPTIONAL_WEAK_EXPORT;
  353. /**
  354. * Tell the JACK server to call @a connect_callback whenever a
  355. * port is connected or disconnected, passing @a arg as a parameter.
  356. *
  357. * @return 0 on success, otherwise a non-zero error code
  358. */
  359. int jack_set_port_connect_callback (jack_client_t *,
  360. JackPortConnectCallback
  361. connect_callback, void *arg) JACK_OPTIONAL_WEAK_EXPORT;
  362. /**
  363. * Tell the JACK server to call @a graph_callback whenever the
  364. * processing graph is reordered, passing @a arg as a parameter.
  365. *
  366. * @return 0 on success, otherwise a non-zero error code
  367. */
  368. int jack_set_graph_order_callback (jack_client_t *,
  369. JackGraphOrderCallback graph_callback,
  370. void *) JACK_OPTIONAL_WEAK_EXPORT;
  371. /**
  372. * Tell the JACK server to call @a xrun_callback whenever there is a
  373. * xrun, passing @a arg as a parameter.
  374. *
  375. * @return 0 on success, otherwise a non-zero error code
  376. */
  377. int jack_set_xrun_callback (jack_client_t *,
  378. JackXRunCallback xrun_callback, void *arg) JACK_OPTIONAL_WEAK_EXPORT;
  379. /**
  380. * Tell the Jack server to call @a latency_callback whenever it
  381. * is necessary to recompute the latencies for some or all
  382. * Jack ports.
  383. *
  384. * @a latency_callback will be called twice each time it is
  385. * needed, once being passed JackCaptureLatency and once
  386. * JackPlaybackLatency. See @ref LatencyFunctions for
  387. * the definition of each type of latency and related functions.
  388. *
  389. * <b>IMPORTANT: Most JACK clients do NOT need to register a latency
  390. * callback.</b>
  391. *
  392. * Clients that meet any of the following conditions do NOT
  393. * need to register a latency callback:
  394. *
  395. * - have only input ports
  396. * - have only output ports
  397. * - their output is totally unrelated to their input
  398. * - their output is not delayed relative to their input
  399. * (i.e. data that arrives in a given process()
  400. * callback is processed and output again in the
  401. * same callback)
  402. *
  403. * Clients NOT registering a latency callback MUST also
  404. * satisfy this condition:
  405. *
  406. * - have no multiple distinct internal signal pathways
  407. *
  408. * This means that if your client has more than 1 input and
  409. * output port, and considers them always "correlated"
  410. * (e.g. as a stereo pair), then there is only 1 (e.g. stereo)
  411. * signal pathway through the client. This would be true,
  412. * for example, of a stereo FX rack client that has a
  413. * left/right input pair and a left/right output pair.
  414. *
  415. * However, this is somewhat a matter of perspective. The
  416. * same FX rack client could be connected so that its
  417. * two input ports were connected to entirely separate
  418. * sources. Under these conditions, the fact that the client
  419. * does not register a latency callback MAY result
  420. * in port latency values being incorrect.
  421. *
  422. * Clients that do not meet any of those conditions SHOULD
  423. * register a latency callback.
  424. *
  425. * See the documentation for @ref jack_port_set_latency_range()
  426. * on how the callback should operate. Remember that the @a mode
  427. * argument given to the latency callback will need to be
  428. * passed into @ref jack_port_set_latency_range()
  429. *
  430. * @return 0 on success, otherwise a non-zero error code
  431. */
  432. int jack_set_latency_callback (jack_client_t *,
  433. JackLatencyCallback latency_callback,
  434. void *) JACK_WEAK_EXPORT;
  435. /*@}*/
  436. /**
  437. * @defgroup ServerControl Controlling & querying JACK server operation
  438. * @{
  439. */
  440. /**
  441. * Start/Stop JACK's "freewheel" mode.
  442. *
  443. * When in "freewheel" mode, JACK no longer waits for
  444. * any external event to begin the start of the next process
  445. * cycle.
  446. *
  447. * As a result, freewheel mode causes "faster than realtime"
  448. * execution of a JACK graph. If possessed, real-time
  449. * scheduling is dropped when entering freewheel mode, and
  450. * if appropriate it is reacquired when stopping.
  451. *
  452. * IMPORTANT: on systems using capabilities to provide real-time
  453. * scheduling (i.e. Linux kernel 2.4), if onoff is zero, this function
  454. * must be called from the thread that originally called jack_activate().
  455. * This restriction does not apply to other systems (e.g. Linux kernel 2.6
  456. * or OS X).
  457. *
  458. * @param client pointer to JACK client structure
  459. * @param onoff if non-zero, freewheel mode starts. Otherwise
  460. * freewheel mode ends.
  461. *
  462. * @return 0 on success, otherwise a non-zero error code.
  463. */
  464. int jack_set_freewheel(jack_client_t* client, int onoff) JACK_OPTIONAL_WEAK_EXPORT;
  465. /**
  466. * Change the buffer size passed to the @a process_callback.
  467. *
  468. * This operation stops the JACK engine process cycle, then calls all
  469. * registered @a bufsize_callback functions before restarting the
  470. * process cycle. This will cause a gap in the audio flow, so it
  471. * should only be done at appropriate stopping points.
  472. *
  473. * @see jack_set_buffer_size_callback()
  474. *
  475. * @param client pointer to JACK client structure.
  476. * @param nframes new buffer size. Must be a power of two.
  477. *
  478. * @return 0 on success, otherwise a non-zero error code
  479. */
  480. int jack_set_buffer_size (jack_client_t *client, jack_nframes_t nframes) JACK_OPTIONAL_WEAK_EXPORT;
  481. /**
  482. * @return the sample rate of the jack system, as set by the user when
  483. * jackd was started.
  484. */
  485. jack_nframes_t jack_get_sample_rate (jack_client_t *) JACK_OPTIONAL_WEAK_EXPORT;
  486. /**
  487. * @return the current maximum size that will ever be passed to the @a
  488. * process_callback. It should only be used *before* the client has
  489. * been activated. This size may change, clients that depend on it
  490. * must register a @a bufsize_callback so they will be notified if it
  491. * does.
  492. *
  493. * @see jack_set_buffer_size_callback()
  494. */
  495. jack_nframes_t jack_get_buffer_size (jack_client_t *) JACK_OPTIONAL_WEAK_EXPORT;
  496. /**
  497. * Old-style interface to become the timebase for the entire JACK
  498. * subsystem.
  499. *
  500. * @deprecated This function still exists for compatibility with the
  501. * earlier transport interface, but it does nothing. Instead, see
  502. * transport.h and use jack_set_timebase_callback().
  503. *
  504. * @return ENOSYS, function not implemented.
  505. */
  506. int jack_engine_takeover_timebase (jack_client_t *) JACK_OPTIONAL_WEAK_DEPRECATED_EXPORT;
  507. /**
  508. * @return the current CPU load estimated by JACK. This is a running
  509. * average of the time it takes to execute a full process cycle for
  510. * all clients as a percentage of the real time available per cycle
  511. * determined by the buffer size and sample rate.
  512. */
  513. float jack_cpu_load (jack_client_t *client) JACK_OPTIONAL_WEAK_EXPORT;
  514. /*@}*/
  515. /**
  516. * @defgroup PortFunctions Creating & manipulating ports
  517. * @{
  518. */
  519. /**
  520. * Create a new port for the client. This is an object used for moving
  521. * data of any type in or out of the client. Ports may be connected
  522. * in various ways.
  523. *
  524. * Each port has a short name. The port's full name contains the name
  525. * of the client concatenated with a colon (:) followed by its short
  526. * name. The jack_port_name_size() is the maximum length of this full
  527. * name. Exceeding that will cause the port registration to fail and
  528. * return NULL.
  529. *
  530. * The @a port_name must be unique among all ports owned by this client.
  531. * If the name is not unique, the registration will fail.
  532. *
  533. * All ports have a type, which may be any non-NULL and non-zero
  534. * length string, passed as an argument. Some port types are built
  535. * into the JACK API, like JACK_DEFAULT_AUDIO_TYPE or JACK_DEFAULT_MIDI_TYPE
  536. *
  537. * @param client pointer to JACK client structure.
  538. * @param port_name non-empty short name for the new port (not
  539. * including the leading @a "client_name:"). Must be unique.
  540. * @param port_type port type name. If longer than
  541. * jack_port_type_size(), only that many characters are significant.
  542. * @param flags @ref JackPortFlags bit mask.
  543. * @param buffer_size must be non-zero if this is not a built-in @a
  544. * port_type. Otherwise, it is ignored.
  545. *
  546. * @return jack_port_t pointer on success, otherwise NULL.
  547. */
  548. jack_port_t *jack_port_register (jack_client_t *client,
  549. const char *port_name,
  550. const char *port_type,
  551. unsigned long flags,
  552. unsigned long buffer_size) JACK_OPTIONAL_WEAK_EXPORT;
  553. /**
  554. * Remove the port from the client, disconnecting any existing
  555. * connections.
  556. *
  557. * @return 0 on success, otherwise a non-zero error code
  558. */
  559. int jack_port_unregister (jack_client_t *, jack_port_t *) JACK_OPTIONAL_WEAK_EXPORT;
  560. /**
  561. * This returns a pointer to the memory area associated with the
  562. * specified port. For an output port, it will be a memory area
  563. * that can be written to; for an input port, it will be an area
  564. * containing the data from the port's connection(s), or
  565. * zero-filled. if there are multiple inbound connections, the data
  566. * will be mixed appropriately.
  567. *
  568. * Do not cache the returned address across process() callbacks.
  569. * Port buffers have to be retrieved in each callback for proper functionning.
  570. */
  571. void *jack_port_get_buffer (jack_port_t *, jack_nframes_t) JACK_OPTIONAL_WEAK_EXPORT;
  572. /**
  573. * @return the full name of the jack_port_t (including the @a
  574. * "client_name:" prefix).
  575. *
  576. * @see jack_port_name_size().
  577. */
  578. const char *jack_port_name (const jack_port_t *port) JACK_OPTIONAL_WEAK_EXPORT;
  579. /**
  580. * @return the UUID of the jack_port_t
  581. *
  582. * @see jack_uuid_to_string() to convert into a string representation
  583. */
  584. void jack_port_uuid (const jack_port_t *port, jack_uuid_t) JACK_OPTIONAL_WEAK_EXPORT;
  585. /**
  586. * @return the short name of the jack_port_t (not including the @a
  587. * "client_name:" prefix).
  588. *
  589. * @see jack_port_name_size().
  590. */
  591. const char *jack_port_short_name (const jack_port_t *port) JACK_OPTIONAL_WEAK_EXPORT;
  592. /**
  593. * @return the @ref JackPortFlags of the jack_port_t.
  594. */
  595. int jack_port_flags (const jack_port_t *port) JACK_OPTIONAL_WEAK_EXPORT;
  596. /**
  597. * @return the @a port type, at most jack_port_type_size() characters
  598. * including a final NULL.
  599. */
  600. const char *jack_port_type (const jack_port_t *port) JACK_OPTIONAL_WEAK_EXPORT;
  601. /**
  602. * @return TRUE if the jack_port_t belongs to the jack_client_t.
  603. */
  604. int jack_port_is_mine (const jack_client_t *, const jack_port_t *port) JACK_OPTIONAL_WEAK_EXPORT;
  605. /**
  606. * @return number of connections to or from @a port.
  607. *
  608. * @pre The calling client must own @a port.
  609. */
  610. int jack_port_connected (const jack_port_t *port) JACK_OPTIONAL_WEAK_EXPORT;
  611. /**
  612. * @return TRUE if the locally-owned @a port is @b directly connected
  613. * to the @a port_name.
  614. *
  615. * @see jack_port_name_size()
  616. */
  617. int jack_port_connected_to (const jack_port_t *port,
  618. const char *port_name) JACK_OPTIONAL_WEAK_EXPORT;
  619. /**
  620. * @return a null-terminated array of full port names to which the @a
  621. * port is connected. If none, returns NULL.
  622. *
  623. * The caller is responsible for calling jack_free(3) on any non-NULL
  624. * returned value.
  625. *
  626. * @param port locally owned jack_port_t pointer.
  627. *
  628. * @see jack_port_name_size(), jack_port_get_all_connections()
  629. */
  630. const char **jack_port_get_connections (const jack_port_t *port) JACK_OPTIONAL_WEAK_EXPORT;
  631. /**
  632. * @return a null-terminated array of full port names to which the @a
  633. * port is connected. If none, returns NULL.
  634. *
  635. * The caller is responsible for calling jack_free(3) on any non-NULL
  636. * returned value.
  637. *
  638. * This differs from jack_port_get_connections() in two important
  639. * respects:
  640. *
  641. * 1) You may not call this function from code that is
  642. * executed in response to a JACK event. For example,
  643. * you cannot use it in a GraphReordered handler.
  644. *
  645. * 2) You need not be the owner of the port to get information
  646. * about its connections.
  647. *
  648. * @see jack_port_name_size()
  649. */
  650. const char **jack_port_get_all_connections (const jack_client_t *client,
  651. const jack_port_t *port) JACK_OPTIONAL_WEAK_EXPORT;
  652. /**
  653. *
  654. * @deprecated This function will be removed from a future version
  655. * of JACK. Do not use it. There is no replacement. It has
  656. * turned out to serve essentially no purpose in real-life
  657. * JACK clients.
  658. */
  659. int jack_port_tie (jack_port_t *src, jack_port_t *dst) JACK_OPTIONAL_WEAK_DEPRECATED_EXPORT;
  660. /**
  661. *
  662. * @deprecated This function will be removed from a future version
  663. * of JACK. Do not use it. There is no replacement. It has
  664. * turned out to serve essentially no purpose in real-life
  665. * JACK clients.
  666. */
  667. int jack_port_untie (jack_port_t *port) JACK_OPTIONAL_WEAK_DEPRECATED_EXPORT;
  668. /**
  669. * Modify a port's short name. May be called at any time. If the
  670. * resulting full name (including the @a "client_name:" prefix) is
  671. * longer than jack_port_name_size(), it will be truncated.
  672. *
  673. * @return 0 on success, otherwise a non-zero error code.
  674. */
  675. int jack_port_set_name (jack_port_t *port, const char *port_name) JACK_OPTIONAL_WEAK_EXPORT;
  676. /**
  677. * Set @a alias as an alias for @a port. May be called at any time.
  678. * If the alias is longer than jack_port_name_size(), it will be truncated.
  679. *
  680. * After a successful call, and until JACK exits or
  681. * jack_port_unset_alias() is called, may be
  682. * used as a alternate name for the port.
  683. *
  684. * Ports can have up to two aliases - if both are already
  685. * set, this function will return an error.
  686. *
  687. * @return 0 on success, otherwise a non-zero error code.
  688. */
  689. int jack_port_set_alias (jack_port_t *port, const char *alias) JACK_OPTIONAL_WEAK_EXPORT;
  690. /**
  691. * Remove @a alias as an alias for @a port. May be called at any time.
  692. *
  693. * After a successful call, @a alias can no longer be
  694. * used as a alternate name for the port.
  695. *
  696. * @return 0 on success, otherwise a non-zero error code.
  697. */
  698. int jack_port_unset_alias (jack_port_t *port, const char *alias) JACK_OPTIONAL_WEAK_EXPORT;
  699. /*
  700. * Get any aliases known for @port.
  701. *
  702. * @return the number of aliases discovered for the port
  703. */
  704. int jack_port_get_aliases (const jack_port_t *port, char* const aliases[2]) JACK_OPTIONAL_WEAK_EXPORT;
  705. /**
  706. * If @ref JackPortCanMonitor is set for this @a port, turn input
  707. * monitoring on or off. Otherwise, do nothing.
  708. */
  709. int jack_port_request_monitor (jack_port_t *port, int onoff) JACK_OPTIONAL_WEAK_EXPORT;
  710. /**
  711. * If @ref JackPortCanMonitor is set for this @a port_name, turn input
  712. * monitoring on or off. Otherwise, do nothing.
  713. *
  714. * @return 0 on success, otherwise a non-zero error code.
  715. *
  716. * @see jack_port_name_size()
  717. */
  718. int jack_port_request_monitor_by_name (jack_client_t *client,
  719. const char *port_name, int onoff) JACK_OPTIONAL_WEAK_EXPORT;
  720. /**
  721. * If @ref JackPortCanMonitor is set for a port, this function turns
  722. * on input monitoring if it was off, and turns it off if only one
  723. * request has been made to turn it on. Otherwise it does nothing.
  724. *
  725. * @return 0 on success, otherwise a non-zero error code
  726. */
  727. int jack_port_ensure_monitor (jack_port_t *port, int onoff) JACK_OPTIONAL_WEAK_EXPORT;
  728. /**
  729. * @return TRUE if input monitoring has been requested for @a port.
  730. */
  731. int jack_port_monitoring_input (jack_port_t *port) JACK_OPTIONAL_WEAK_EXPORT;
  732. /**
  733. * Establish a connection between two ports.
  734. *
  735. * When a connection exists, data written to the source port will
  736. * be available to be read at the destination port.
  737. *
  738. * @pre The port types must be identical.
  739. *
  740. * @pre The @ref JackPortFlags of the @a source_port must include @ref
  741. * JackPortIsOutput.
  742. *
  743. * @pre The @ref JackPortFlags of the @a destination_port must include
  744. * @ref JackPortIsInput.
  745. *
  746. * @return 0 on success, EEXIST if the connection is already made,
  747. * otherwise a non-zero error code
  748. */
  749. int jack_connect (jack_client_t *,
  750. const char *source_port,
  751. const char *destination_port) JACK_OPTIONAL_WEAK_EXPORT;
  752. /**
  753. * Remove a connection between two ports.
  754. *
  755. * @pre The port types must be identical.
  756. *
  757. * @pre The @ref JackPortFlags of the @a source_port must include @ref
  758. * JackPortIsOutput.
  759. *
  760. * @pre The @ref JackPortFlags of the @a destination_port must include
  761. * @ref JackPortIsInput.
  762. *
  763. * @return 0 on success, otherwise a non-zero error code
  764. */
  765. int jack_disconnect (jack_client_t *,
  766. const char *source_port,
  767. const char *destination_port) JACK_OPTIONAL_WEAK_EXPORT;
  768. /**
  769. * Perform the same function as jack_disconnect() using port handles
  770. * rather than names. This avoids the name lookup inherent in the
  771. * name-based version.
  772. *
  773. * Clients connecting their own ports are likely to use this function,
  774. * while generic connection clients (e.g. patchbays) would use
  775. * jack_disconnect().
  776. */
  777. int jack_port_disconnect (jack_client_t *, jack_port_t *) JACK_OPTIONAL_WEAK_EXPORT;
  778. /**
  779. * @return the maximum number of characters in a full JACK port name
  780. * including the final NULL character. This value is a constant.
  781. *
  782. * A port's full name contains the owning client name concatenated
  783. * with a colon (:) followed by its short name and a NULL
  784. * character.
  785. */
  786. int jack_port_name_size(void) JACK_OPTIONAL_WEAK_EXPORT;
  787. /**
  788. * @return the maximum number of characters in a JACK port type name
  789. * including the final NULL character. This value is a constant.
  790. */
  791. int jack_port_type_size(void) JACK_OPTIONAL_WEAK_EXPORT;
  792. /**
  793. * @return the buffersize of a port of type @arg port_type.
  794. *
  795. * this function may only be called in a buffer_size callback.
  796. */
  797. size_t jack_port_type_get_buffer_size (jack_client_t *client, const char *port_type) JACK_WEAK_EXPORT;
  798. /*@}*/
  799. /**
  800. * @defgroup LatencyFunctions Managing and determining latency
  801. *
  802. * The purpose of JACK's latency API is to allow clients to
  803. * easily answer two questions:
  804. *
  805. * - How long has it been since the data read from a port arrived
  806. * at the edge of the JACK graph (either via a physical port
  807. * or being synthesized from scratch)?
  808. *
  809. * - How long will it be before the data written to a port arrives
  810. * at the edge of a JACK graph?
  811. * To help answering these two questions, all JACK ports have two
  812. * latency values associated with them, both measured in frames:
  813. *
  814. * <b>capture latency</b>: how long since the data read from
  815. * the buffer of a port arrived at at
  816. * a port marked with JackPortIsTerminal.
  817. * The data will have come from the "outside
  818. * world" if the terminal port is also
  819. * marked with JackPortIsPhysical, or
  820. * will have been synthesized by the client
  821. * that owns the terminal port.
  822. *
  823. * <b>playback latency</b>: how long until the data
  824. * written to the buffer of port will reach a port
  825. * marked with JackPortIsTerminal.
  826. *
  827. * Both latencies might potentially have more than one value
  828. * because there may be multiple pathways to/from a given port
  829. * and a terminal port. Latency is therefore generally
  830. * expressed a min/max pair.
  831. *
  832. * In most common setups, the minimum and maximum latency
  833. * are the same, but this design accomodates more complex
  834. * routing, and allows applications (and thus users) to
  835. * detect cases where routing is creating an anomalous
  836. * situation that may either need fixing or more
  837. * sophisticated handling by clients that care about
  838. * latency.
  839. *
  840. * See also @ref jack_set_latency_callback for details on how
  841. * clients that add latency to the signal path should interact
  842. * with JACK to ensure that the correct latency figures are
  843. * used.
  844. * @{
  845. */
  846. /**
  847. * The port latency is zero by default. Clients that control
  848. * physical hardware with non-zero latency should call this
  849. * to set the latency to its correct value. Note that the value
  850. * should include any systemic latency present "outside" the
  851. * physical hardware controlled by the client. For example,
  852. * for a client controlling a digital audio interface connected
  853. * to an external digital converter, the latency setting should
  854. * include both buffering by the audio interface *and* the converter.
  855. *
  856. * @deprecated This method will be removed in the next major
  857. * release of JACK. It should not be used in new code, and should
  858. * be replaced by a latency callback that calls @ref
  859. * jack_port_set_latency_range().
  860. */
  861. void jack_port_set_latency (jack_port_t *, jack_nframes_t) JACK_OPTIONAL_WEAK_DEPRECATED_EXPORT;
  862. /**
  863. * return the latency range defined by @a mode for
  864. * @a port, in frames.
  865. *
  866. * See @ref LatencyFunctions for the definition of each latency value.
  867. *
  868. * This is normally used in the LatencyCallback.
  869. * and therefor safe to execute from callbacks.
  870. */
  871. void jack_port_get_latency_range (jack_port_t *port, jack_latency_callback_mode_t mode, jack_latency_range_t *range) JACK_WEAK_EXPORT;
  872. /**
  873. * set the minimum and maximum latencies defined by
  874. * @a mode for @a port, in frames.
  875. *
  876. * See @ref LatencyFunctions for the definition of each latency value.
  877. *
  878. * This function should ONLY be used inside a latency
  879. * callback. The client should determine the current
  880. * value of the latency using @ref jack_port_get_latency_range()
  881. * (called using the same mode as @a mode)
  882. * and then add some number of frames to that reflects
  883. * latency added by the client.
  884. *
  885. * How much latency a client adds will vary
  886. * dramatically. For most clients, the answer is zero
  887. * and there is no reason for them to register a latency
  888. * callback and thus they should never call this
  889. * function.
  890. *
  891. * More complex clients that take an input signal,
  892. * transform it in some way and output the result but
  893. * not during the same process() callback will
  894. * generally know a single constant value to add
  895. * to the value returned by @ref jack_port_get_latency_range().
  896. *
  897. * Such clients would register a latency callback (see
  898. * @ref jack_set_latency_callback) and must know what input
  899. * ports feed which output ports as part of their
  900. * internal state. Their latency callback will update
  901. * the ports' latency values appropriately.
  902. *
  903. * A pseudo-code example will help. The @a mode argument to the latency
  904. * callback will determine whether playback or capture
  905. * latency is being set. The callback will use
  906. * @ref jack_port_set_latency_range() as follows:
  907. *
  908. * \code
  909. * jack_latency_range_t range;
  910. * if (mode == JackPlaybackLatency) {
  911. * foreach input_port in (all self-registered port) {
  912. * jack_port_get_latency_range (port_feeding_input_port, JackPlaybackLatency, &range);
  913. * range.min += min_delay_added_as_signal_flows_from port_feeding to input_port;
  914. * range.max += max_delay_added_as_signal_flows_from port_feeding to input_port;
  915. * jack_port_set_latency_range (input_port, JackPlaybackLatency, &range);
  916. * }
  917. * } else if (mode == JackCaptureLatency) {
  918. * foreach output_port in (all self-registered port) {
  919. * jack_port_get_latency_range (port_fed_by_output_port, JackCaptureLatency, &range);
  920. * range.min += min_delay_added_as_signal_flows_from_output_port_to_fed_by_port;
  921. * range.max += max_delay_added_as_signal_flows_from_output_port_to_fed_by_port;
  922. * jack_port_set_latency_range (output_port, JackCaptureLatency, &range);
  923. * }
  924. * }
  925. * \endcode
  926. *
  927. * In this relatively simple pseudo-code example, it is assumed that
  928. * each input port or output is connected to only 1 output or input
  929. * port respectively.
  930. *
  931. * If a port is connected to more than 1 other port, then the
  932. * range.min and range.max values passed to @ref
  933. * jack_port_set_latency_range() should reflect the minimum and
  934. * maximum values across all connected ports.
  935. *
  936. * See the description of @ref jack_set_latency_callback for more
  937. * information.
  938. */
  939. void jack_port_set_latency_range (jack_port_t *port, jack_latency_callback_mode_t mode, jack_latency_range_t *range) JACK_WEAK_EXPORT;
  940. /**
  941. * Request a complete recomputation of all port latencies. This
  942. * can be called by a client that has just changed the internal
  943. * latency of its port using jack_port_set_latency
  944. * and wants to ensure that all signal pathways in the graph
  945. * are updated with respect to the values that will be returned
  946. * by jack_port_get_total_latency. It allows a client
  947. * to change multiple port latencies without triggering a
  948. * recompute for each change.
  949. *
  950. * @return zero for successful execution of the request. non-zero
  951. * otherwise.
  952. */
  953. int jack_recompute_total_latencies (jack_client_t*) JACK_OPTIONAL_WEAK_EXPORT;
  954. /**
  955. * @return the time (in frames) between data being available or
  956. * delivered at/to a port, and the time at which it arrived at or is
  957. * delivered to the "other side" of the port. E.g. for a physical
  958. * audio output port, this is the time between writing to the port and
  959. * when the signal will leave the connector. For a physical audio
  960. * input port, this is the time between the sound arriving at the
  961. * connector and the corresponding frames being readable from the
  962. * port.
  963. *
  964. * @deprecated This method will be removed in the next major
  965. * release of JACK. It should not be used in new code, and should
  966. * be replaced by jack_port_get_latency_range() in any existing
  967. * use cases.
  968. */
  969. jack_nframes_t jack_port_get_latency (jack_port_t *port) JACK_OPTIONAL_WEAK_DEPRECATED_EXPORT;
  970. /**
  971. * The maximum of the sum of the latencies in every
  972. * connection path that can be drawn between the port and other
  973. * ports with the @ref JackPortIsTerminal flag set.
  974. *
  975. * @deprecated This method will be removed in the next major
  976. * release of JACK. It should not be used in new code, and should
  977. * be replaced by jack_port_get_latency_range() in any existing
  978. * use cases.
  979. */
  980. jack_nframes_t jack_port_get_total_latency (jack_client_t *,
  981. jack_port_t *port) JACK_OPTIONAL_WEAK_DEPRECATED_EXPORT;
  982. /**
  983. * Request a complete recomputation of a port's total latency. This
  984. * can be called by a client that has just changed the internal
  985. * latency of its port using jack_port_set_latency
  986. * and wants to ensure that all signal pathways in the graph
  987. * are updated with respect to the values that will be returned
  988. * by jack_port_get_total_latency.
  989. *
  990. * @return zero for successful execution of the request. non-zero
  991. * otherwise.
  992. *
  993. * @deprecated This method will be removed in the next major
  994. * release of JACK. It should not be used in new code, and should
  995. * be replaced by jack_recompute_total_latencies() in any existing
  996. * use cases.
  997. */
  998. int jack_recompute_total_latency (jack_client_t*, jack_port_t* port) JACK_OPTIONAL_WEAK_DEPRECATED_EXPORT;
  999. /*@}*/
  1000. /**
  1001. * @defgroup PortSearching Looking up ports
  1002. * @{
  1003. */
  1004. /**
  1005. * @param port_name_pattern A regular expression used to select
  1006. * ports by name. If NULL or of zero length, no selection based
  1007. * on name will be carried out.
  1008. * @param type_name_pattern A regular expression used to select
  1009. * ports by type. If NULL or of zero length, no selection based
  1010. * on type will be carried out.
  1011. * @param flags A value used to select ports by their flags.
  1012. * If zero, no selection based on flags will be carried out.
  1013. *
  1014. * @return a NULL-terminated array of ports that match the specified
  1015. * arguments. The caller is responsible for calling jack_free(3) any
  1016. * non-NULL returned value.
  1017. *
  1018. * @see jack_port_name_size(), jack_port_type_size()
  1019. */
  1020. const char **jack_get_ports (jack_client_t *,
  1021. const char *port_name_pattern,
  1022. const char *type_name_pattern,
  1023. unsigned long flags) JACK_OPTIONAL_WEAK_EXPORT;
  1024. /**
  1025. * @return address of the jack_port_t named @a port_name.
  1026. *
  1027. * @see jack_port_name_size()
  1028. */
  1029. jack_port_t *jack_port_by_name (jack_client_t *, const char *port_name) JACK_OPTIONAL_WEAK_EXPORT;
  1030. /**
  1031. * @return address of the jack_port_t of a @a port_id.
  1032. */
  1033. jack_port_t *jack_port_by_id (jack_client_t *client,
  1034. jack_port_id_t port_id) JACK_OPTIONAL_WEAK_EXPORT;
  1035. /*@}*/
  1036. /**
  1037. * @defgroup TimeFunctions Handling time
  1038. * @{
  1039. *
  1040. * JACK time is in units of 'frames', according to the current sample rate.
  1041. * The absolute value of frame times is meaningless, frame times have meaning
  1042. * only relative to each other.
  1043. */
  1044. /**
  1045. * @return the estimated time in frames that has passed since the JACK
  1046. * server began the current process cycle.
  1047. */
  1048. jack_nframes_t jack_frames_since_cycle_start (const jack_client_t *) JACK_OPTIONAL_WEAK_EXPORT;
  1049. /**
  1050. * @return the estimated current time in frames.
  1051. * This function is intended for use in other threads (not the process
  1052. * callback). The return value can be compared with the value of
  1053. * jack_last_frame_time to relate time in other threads to JACK time.
  1054. */
  1055. jack_nframes_t jack_frame_time (const jack_client_t *) JACK_OPTIONAL_WEAK_EXPORT;
  1056. /**
  1057. * @return the precise time at the start of the current process cycle.
  1058. * This function may only be used from the process callback, and can
  1059. * be used to interpret timestamps generated by jack_frame_time() in
  1060. * other threads with respect to the current process cycle.
  1061. *
  1062. * This is the only jack time function that returns exact time:
  1063. * when used during the process callback it always returns the same
  1064. * value (until the next process callback, where it will return
  1065. * that value + nframes, etc). The return value is guaranteed to be
  1066. * monotonic and linear in this fashion unless an xrun occurs.
  1067. * If an xrun occurs, clients must check this value again, as time
  1068. * may have advanced in a non-linear way (e.g. cycles may have been skipped).
  1069. */
  1070. jack_nframes_t jack_last_frame_time (const jack_client_t *client) JACK_OPTIONAL_WEAK_EXPORT;
  1071. /**
  1072. * This function may only be used from the process callback.
  1073. * It provides the internal cycle timing information as used by
  1074. * most of the other time related functions. This allows the
  1075. * caller to map between frame counts and microseconds with full
  1076. * precision (i.e. without rounding frame times to integers),
  1077. * and also provides e.g. the microseconds time of the start of
  1078. * the current cycle directly (it has to be computed otherwise).
  1079. *
  1080. * If the return value is zero, the following information is
  1081. * provided in the variables pointed to by the arguments:
  1082. *
  1083. * current_frames: the frame time counter at the start of the
  1084. * current cycle, same as jack_last_frame_time().
  1085. * current_usecs: the microseconds time at the start of the
  1086. * current cycle.
  1087. * next_usecs: the microseconds time of the start of the next
  1088. * next cycle as computed by the DLL.
  1089. * period_usecs: the current best estimate of the period time in
  1090. * microseconds.
  1091. *
  1092. * NOTES:
  1093. *
  1094. * Because of the types used, all the returned values except period_usecs
  1095. * are unsigned. In computations mapping between frames and microseconds
  1096. * *signed* differences are required. The easiest way is to compute those
  1097. * separately and assign them to the appropriate signed variables,
  1098. * int32_t for frames and int64_t for usecs. See the implementation of
  1099. * jack_frames_to_time() and Jack_time_to_frames() for an example.
  1100. *
  1101. * Unless there was an xrun, skipped cycles, or the current cycle is the
  1102. * first after freewheeling or starting Jack, the value of current_usecs
  1103. * will always be the value of next_usecs of the previous cycle.
  1104. *
  1105. * The value of period_usecs will in general NOT be exactly equal to
  1106. * the difference of next_usecs and current_usecs. This is because to
  1107. * ensure stability of the DLL and continuity of the mapping, a fraction
  1108. * of the loop error must be included in next_usecs. For an accurate
  1109. * mapping between frames and microseconds, the difference of next_usecs
  1110. * and current_usecs should be used, and not period_usecs.
  1111. *
  1112. * @return zero if OK, non-zero otherwise.
  1113. */
  1114. int jack_get_cycle_times (const jack_client_t *client,
  1115. jack_nframes_t *current_frames,
  1116. jack_time_t *current_usecs,
  1117. jack_time_t *next_usecs,
  1118. float *period_usecs) JACK_OPTIONAL_WEAK_EXPORT;
  1119. /**
  1120. * @return the estimated time in microseconds of the specified frame time
  1121. */
  1122. jack_time_t jack_frames_to_time(const jack_client_t *client, jack_nframes_t) JACK_OPTIONAL_WEAK_EXPORT;
  1123. /**
  1124. * @return the estimated time in frames for the specified system time.
  1125. */
  1126. jack_nframes_t jack_time_to_frames(const jack_client_t *client, jack_time_t) JACK_OPTIONAL_WEAK_EXPORT;
  1127. /**
  1128. * @return return JACK's current system time in microseconds,
  1129. * using the JACK clock source.
  1130. *
  1131. * The value returned is guaranteed to be monotonic, but not linear.
  1132. */
  1133. jack_time_t jack_get_time() JACK_OPTIONAL_WEAK_EXPORT;
  1134. /*@}*/
  1135. /**
  1136. * @defgroup ErrorOutput Controlling error/information output
  1137. */
  1138. /*@{*/
  1139. /**
  1140. * Display JACK error message.
  1141. *
  1142. * Set via jack_set_error_function(), otherwise a JACK-provided
  1143. * default will print @a msg (plus a newline) to stderr.
  1144. *
  1145. * @param msg error message text (no newline at end).
  1146. */
  1147. extern void (*jack_error_callback)(const char *msg) JACK_OPTIONAL_WEAK_EXPORT;
  1148. /**
  1149. * Set the @ref jack_error_callback for error message display.
  1150. *
  1151. * The JACK library provides two built-in callbacks for this purpose:
  1152. * default_jack_error_callback() and silent_jack_error_callback().
  1153. */
  1154. void jack_set_error_function (void (*func)(const char *)) JACK_OPTIONAL_WEAK_EXPORT;
  1155. /**
  1156. * Display JACK info message.
  1157. *
  1158. * Set via jack_set_info_function(), otherwise a JACK-provided
  1159. * default will print @a msg (plus a newline) to stdout.
  1160. *
  1161. * @param msg info message text (no newline at end).
  1162. */
  1163. extern void (*jack_info_callback)(const char *msg) JACK_OPTIONAL_WEAK_EXPORT;
  1164. /**
  1165. * Set the @ref jack_info_callback for info message display.
  1166. */
  1167. void jack_set_info_function (void (*func)(const char *)) JACK_OPTIONAL_WEAK_EXPORT;
  1168. /*@}*/
  1169. /**
  1170. * The free function to be used on memory returned by jack_port_get_connections,
  1171. * jack_port_get_all_connections and jack_get_ports functions.
  1172. * This is MANDATORY on Windows when otherwise all nasty runtime version related crashes can occur.
  1173. * Developers are strongly encouraged to use this function instead of the standard "free" function in new code.
  1174. *
  1175. */
  1176. void jack_free(void* ptr) JACK_OPTIONAL_WEAK_EXPORT;
  1177. #ifdef __cplusplus
  1178. }
  1179. #endif
  1180. #endif /* __jack_h__ */