jack1 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.

790 lines
26KB

  1. /*
  2. Copyright (C) 2001 Paul Davis
  3. This program is free software; you can redistribute it and/or modify
  4. it under the terms of the GNU Lesser General Public License as published by
  5. the Free Software Foundation; either version 2.1 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 Lesser General Public License for more details.
  11. You should have received a copy of the GNU Lesser General Public License
  12. along with this program; if not, write to the Free Software
  13. Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  14. $Id$
  15. */
  16. #ifndef __jack_h__
  17. #define __jack_h__
  18. #ifdef __cplusplus
  19. extern "C" {
  20. #endif
  21. #include <pthread.h>
  22. #include <jack/types.h>
  23. #include <jack/transport.h>
  24. /**
  25. * Note: More documentation can be found in jack/types.h.
  26. */
  27. /**
  28. * Open an external client session with a JACK server. This interface
  29. * is more complex but more powerful than jack_client_new(). With it,
  30. * clients may choose which of several servers to connect, and control
  31. * whether and how to start the server automatically, if it was not
  32. * already running. There is also an option for JACK to generate a
  33. * unique client name, when necessary.
  34. *
  35. * @param client_name of at most jack_client_name_size() characters.
  36. * The name scope is local to each server. Unless forbidden by the
  37. * @ref JackUseExactName option, the server will modify this name to
  38. * create a unique variant, if needed.
  39. *
  40. * @param options formed by OR-ing together @ref JackOpenOptions bits.
  41. *
  42. * @param status (if non-NULL) an address for JACK to return
  43. * information from the open operation. This status word is formed by
  44. * OR-ing together the relevant @ref JackOpenStatus bits.
  45. *
  46. * <b>Optional parameters:</b>
  47. *
  48. * @arg @a server_name <tt>(char *)</tt> selects from among several
  49. * possible concurrent server instances. This parameter must follow
  50. * @a status if the @ref JackServerName option is specified.
  51. * Otherwise, "default" is assumed. Server names are unique to each
  52. * user.
  53. *
  54. * @return Opaque client handle if successful. If this is NULL, the
  55. * open operation failed, and the caller is not a JACK client.
  56. */
  57. jack_client_t *jack_client_open (const char *client_name,
  58. jack_options_t options,
  59. jack_status_t *status, ...);
  60. /**
  61. * Attempt to become an external client of the Jack server.
  62. *
  63. * JACK is evolving a mechanism for automatically starting the server
  64. * when needed. As a transition, jack_client_new() only does this
  65. * when \$JACK_START_SERVER is defined in the environment of the
  66. * calling process. In the future this will become normal behavior.
  67. * For full control of this feature, use jack_client_open(), instead.
  68. * In either case, defining \$JACK_NO_START_SERVER disables this
  69. * feature.
  70. *
  71. * @param client_name of at most jack_client_name_size() characters.
  72. * If this name is already in use, the request fails.
  73. *
  74. * @return Opaque client handle if successful, otherwise NULL.
  75. *
  76. * @note Failure generally means that the JACK server is not running.
  77. * If there was some other problem, it will be reported via the @ref
  78. * jack_error_callback mechanism. Use jack_client_open() and check
  79. * the @a status parameter for more detailed information.
  80. */
  81. jack_client_t *jack_client_new (const char *client_name);
  82. /**
  83. * Disconnects an external client from a JACK server.
  84. *
  85. * @return 0 on success, otherwise a non-zero error code
  86. */
  87. int jack_client_close (jack_client_t *client);
  88. /**
  89. * @return the maximum number of characters in a JACK client name
  90. * including the final NULL character. This value is a constant.
  91. */
  92. int jack_client_name_size (void);
  93. /**
  94. * @return pointer to actual client name. This is useful when @ref
  95. * JackUseExactName is not specified on open and @ref
  96. * JackNameNotUnique status was returned. In that case, the actual
  97. * name will differ from the @a client_name requested.
  98. */
  99. char *jack_get_client_name (jack_client_t* client);
  100. /**
  101. * Attempt to load an internal client into the Jack server.
  102. *
  103. * Internal clients run within the JACK server process. They can use
  104. * of the same functions as external clients. Each internal client
  105. * must declare jack_initialize() and jack_finish() entry points,
  106. * called at load and unload times. See inprocess.c for an example of
  107. * how to write an internal client.
  108. *
  109. * @param client_name of at most jack_client_name_size() characters.
  110. * @param so_name A path to a shared object file containing the code
  111. * for the new client.
  112. * @param so_data An arbitary string containing information to be
  113. * passed to the jack_initialize() routine of the new client.
  114. */
  115. int jack_internal_client_new (const char *client_name, const char *so_name,
  116. const char *so_data);
  117. /**
  118. * Removes an internal client from a JACK server.
  119. *
  120. * @return 0 on success, otherwise a non-zero error code
  121. */
  122. void jack_internal_client_close (const char *client_name);
  123. /**
  124. * @param client pointer to JACK client structure.
  125. *
  126. * Check if the JACK subsystem is running with -R (--realtime).
  127. *
  128. * @return 1 if JACK is running realtime, 0 otherwise
  129. */
  130. int jack_is_realtime (jack_client_t *client);
  131. /**
  132. * @param client pointer to JACK client structure.
  133. * @param function The jack_shutdown function pointer.
  134. * @param arg The arguments for the jack_shutdown function.
  135. *
  136. * Register a function (and argument) to be called if and when the
  137. * JACK server shuts down the client thread. The function must
  138. * be written as if it were an asynchonrous POSIX signal
  139. * handler --- use only async-safe functions, and remember that it
  140. * is executed from another thread. A typical function might
  141. * set a flag or write to a pipe so that the rest of the
  142. * application knows that the JACK client thread has shut
  143. * down.
  144. *
  145. * NOTE: clients do not need to call this. It exists only
  146. * to help more complex clients understand what is going
  147. * on. It should be called before jack_client_activate().
  148. */
  149. void jack_on_shutdown (jack_client_t *client,
  150. void (*function)(void *arg), void *arg);
  151. /**
  152. * Tell the Jack server to call @a process_callback whenever there is
  153. * work be done, passing @a arg as the second argument.
  154. *
  155. * The code in the supplied function must be suitable for real-time
  156. * execution. That means that it cannot call functions that might
  157. * block for a long time.  This includes malloc, free, printf,
  158. * pthread_mutex_lock, sleep, wait, poll, select, pthread_join,
  159. * pthread_cond_wait, etc, etc.  See
  160. * http://jackit.sourceforge.net/docs/design/design.html#SECTION00411000000000000000
  161. * for more information.
  162. *
  163. * @return 0 on success, otherwise a non-zero error code, causing JACK
  164. * to remove that client from the process() graph.
  165. */
  166. int jack_set_process_callback (jack_client_t *client,
  167. JackProcessCallback process_callback,
  168. void *arg);
  169. /**
  170. * Tell JACK to call @a thread_init_callback once just after
  171. * the creation of the thread in which all other callbacks
  172. * will be handled.
  173. *
  174. * The code in the supplied function does not need to be
  175. * suitable for real-time execution.
  176. *
  177. * @return 0 on success, otherwise a non-zero error code, causing JACK
  178. * to remove that client from the process() graph.
  179. */
  180. int jack_set_thread_init_callback (jack_client_t *client,
  181. JackThreadInitCallback thread_init_callback,
  182. void *arg);
  183. /**
  184. * Tell the Jack server to call @a freewheel_callback
  185. * whenever we enter or leave "freewheel" mode, passing @a
  186. * arg as the second argument. The first argument to the
  187. * callback will be non-zero if JACK is entering freewheel
  188. * mode, and zero otherwise.
  189. *
  190. * @return 0 on success, otherwise a non-zero error code.
  191. */
  192. int jack_set_freewheel_callback (jack_client_t *client,
  193. JackFreewheelCallback freewheel_callback,
  194. void *arg);
  195. /**
  196. * Start/Stop JACK's "freewheel" mode.
  197. *
  198. * When in "freewheel" mode, JACK no longer waits for
  199. * any external event to begin the start of the next process
  200. * cycle.
  201. *
  202. * As a result, freewheel mode causes "faster than realtime"
  203. * execution of a JACK graph. If possessed, real-time
  204. * scheduling is dropped when entering freewheel mode, and
  205. * if appropriate it is reacquired when stopping.
  206. *
  207. * @param client pointer to JACK client structure
  208. * @param onoff if non-zero, freewheel mode starts. Otherwise
  209. * freewheel mode ends.
  210. *
  211. * @return 0 on success, otherwise a non-zero error code.
  212. */
  213. int jack_set_freewheel(jack_client_t* client, int onoff);
  214. /**
  215. * Change the buffer size passed to the @a process_callback.
  216. *
  217. * This operation stops the JACK engine process cycle, then calls all
  218. * registered @a bufsize_callback functions before restarting the
  219. * process cycle. This will cause a gap in the audio flow, so it
  220. * should only be done at appropriate stopping points.
  221. *
  222. * @see jack_set_buffer_size_callback()
  223. *
  224. * @param client pointer to JACK client structure.
  225. * @param nframes new buffer size. Must be a power of two.
  226. *
  227. * @return 0 on success, otherwise a non-zero error code
  228. */
  229. int jack_set_buffer_size (jack_client_t *client, jack_nframes_t nframes);
  230. /**
  231. * Tell JACK to call @a bufsize_callback whenever the size of the the
  232. * buffer that will be passed to the @a process_callback is about to
  233. * change. Clients that depend on knowing the buffer size must supply
  234. * a @a bufsize_callback before activating themselves.
  235. *
  236. * @param client pointer to JACK client structure.
  237. * @param bufsize_callback function to call when the buffer size changes.
  238. * @param arg argument for @a bufsize_callback.
  239. *
  240. * @return 0 on success, otherwise a non-zero error code
  241. */
  242. int jack_set_buffer_size_callback (jack_client_t *client,
  243. JackBufferSizeCallback bufsize_callback,
  244. void *arg);
  245. /**
  246. * Tell the Jack server to call @a srate_callback whenever the system
  247. * sample rate changes.
  248. *
  249. * @return 0 on success, otherwise a non-zero error code
  250. */
  251. int jack_set_sample_rate_callback (jack_client_t *client,
  252. JackSampleRateCallback srate_callback,
  253. void *arg);
  254. /**
  255. * Tell the JACK server to call @a registration_callback whenever a
  256. * port is registered or unregistered, passing @a arg as a parameter.
  257. *
  258. * @return 0 on success, otherwise a non-zero error code
  259. */
  260. int jack_set_port_registration_callback (jack_client_t *,
  261. JackPortRegistrationCallback
  262. registration_callback, void *arg);
  263. /**
  264. * Tell the JACK server to call @a graph_callback whenever the
  265. * processing graph is reordered, passing @a arg as a parameter.
  266. *
  267. * @return 0 on success, otherwise a non-zero error code
  268. */
  269. int jack_set_graph_order_callback (jack_client_t *,
  270. JackGraphOrderCallback graph_callback,
  271. void *);
  272. /**
  273. * Tell the JACK server to call @a xrun_callback whenever there is a
  274. * xrun, passing @a arg as a parameter.
  275. *
  276. * @return 0 on success, otherwise a non-zero error code
  277. */
  278. int jack_set_xrun_callback (jack_client_t *,
  279. JackXRunCallback xrun_callback, void *arg);
  280. /**
  281. * @return the delay in microseconds due to the most recent XRUN
  282. * occurrence. This probably only makes sense when called from a @ref
  283. * JackXRunCallback defined using jack_set_xrun_callback().
  284. */
  285. float jack_get_xrun_delayed_usecs (jack_client_t *client);
  286. /**
  287. * Tell the Jack server that the program is ready to start processing
  288. * audio.
  289. *
  290. * @return 0 on success, otherwise a non-zero error code
  291. */
  292. int jack_activate (jack_client_t *client);
  293. /**
  294. * Tell the Jack server to remove this @a client from the process
  295. * graph. Also, disconnect all ports belonging to it, since inactive
  296. * clients have no port connections.
  297. *
  298. * @return 0 on success, otherwise a non-zero error code
  299. */
  300. int jack_deactivate (jack_client_t *client);
  301. /**
  302. * Create a new port for the client. This is an object used for moving
  303. * data of any type in or out of the client. Ports may be connected
  304. * in various ways.
  305. *
  306. * Each port has a short name. The port's full name contains the name
  307. * of the client concatenated with a colon (:) followed by its short
  308. * name. The jack_port_name_size() is the maximum length of this full
  309. * name. Exceeding that will cause the port registration to fail and
  310. * return NULL.
  311. *
  312. * All ports have a type, which may be any non-NULL and non-zero
  313. * length string, passed as an argument. Some port types are built
  314. * into the JACK API, currently only JACK_DEFAULT_AUDIO_TYPE.
  315. *
  316. * @param client pointer to JACK client structure.
  317. * @param port_name non-empty short name for the new port (not
  318. * including the leading @a "client_name:").
  319. * @param port_type port type name. If longer than
  320. * jack_port_type_size(), only that many characters are significant.
  321. * @param flags @ref JackPortFlags bit mask.
  322. * @param buffer_size must be non-zero if this is not a built-in @a
  323. * port_type. Otherwise, it is ignored.
  324. *
  325. * @return jack_port_t pointer on success, otherwise NULL.
  326. */
  327. jack_port_t *jack_port_register (jack_client_t *client,
  328. const char *port_name,
  329. const char *port_type,
  330. unsigned long flags,
  331. unsigned long buffer_size);
  332. /**
  333. * Remove the port from the client, disconnecting any existing
  334. * connections.
  335. *
  336. * @return 0 on success, otherwise a non-zero error code
  337. */
  338. int jack_port_unregister (jack_client_t *, jack_port_t *);
  339. /**
  340. * This returns a pointer to the memory area associated with the
  341. * specified port. For an output port, it will be a memory area
  342. * that can be written to; for an input port, it will be an area
  343. * containing the data from the port's connection(s), or
  344. * zero-filled. if there are multiple inbound connections, the data
  345. * will be mixed appropriately.
  346. *
  347. * FOR OUTPUT PORTS ONLY
  348. * ---------------------
  349. * You may cache the value returned, but only between calls to
  350. * your "blocksize" callback. For this reason alone, you should
  351. * either never cache the return value or ensure you have
  352. * a "blocksize" callback and be sure to invalidate the cached
  353. * address from there.
  354. */
  355. void *jack_port_get_buffer (jack_port_t *, jack_nframes_t);
  356. /**
  357. * @return the full name of the jack_port_t (including the @a
  358. * "client_name:" prefix).
  359. *
  360. * @see jack_port_name_size().
  361. */
  362. const char *jack_port_name (const jack_port_t *port);
  363. /**
  364. * @return the short name of the jack_port_t (not including the @a
  365. * "client_name:" prefix).
  366. *
  367. * @see jack_port_name_size().
  368. */
  369. const char *jack_port_short_name (const jack_port_t *port);
  370. /**
  371. * @return the @ref JackPortFlags of the jack_port_t.
  372. */
  373. int jack_port_flags (const jack_port_t *port);
  374. /**
  375. * @return the @a port type, at most jack_port_type_size() characters
  376. * including a final NULL.
  377. */
  378. const char *jack_port_type (const jack_port_t *port);
  379. /**
  380. * @return TRUE if the jack_port_t belongs to the jack_client_t.
  381. */
  382. int jack_port_is_mine (const jack_client_t *, const jack_port_t *port);
  383. /**
  384. * @return number of connections to or from @a port.
  385. *
  386. * @pre The calling client must own @a port.
  387. */
  388. int jack_port_connected (const jack_port_t *port);
  389. /**
  390. * @return TRUE if the locally-owned @a port is @b directly connected
  391. * to the @a port_name.
  392. *
  393. * @see jack_port_name_size()
  394. */
  395. int jack_port_connected_to (const jack_port_t *port,
  396. const char *port_name);
  397. /**
  398. * @return a null-terminated array of full port names to which the @a
  399. * port is connected. If none, returns NULL.
  400. *
  401. * The caller is responsible for calling free(3) on any non-NULL
  402. * returned value.
  403. *
  404. * @param port locally owned jack_port_t pointer.
  405. *
  406. * @see jack_port_name_size(), jack_port_get_all_connections()
  407. */
  408. const char **jack_port_get_connections (const jack_port_t *port);
  409. /**
  410. * @return a null-terminated array of full port names to which the @a
  411. * port is connected. If none, returns NULL.
  412. *
  413. * The caller is responsible for calling free(3) on any non-NULL
  414. * returned value.
  415. *
  416. * This differs from jack_port_get_connections() in two important
  417. * respects:
  418. *
  419. * 1) You may not call this function from code that is
  420. * executed in response to a JACK event. For example,
  421. * you cannot use it in a GraphReordered handler.
  422. *
  423. * 2) You need not be the owner of the port to get information
  424. * about its connections.
  425. *
  426. * @see jack_port_name_size()
  427. */
  428. const char **jack_port_get_all_connections (const jack_client_t *client,
  429. const jack_port_t *port);
  430. /**
  431. * A client may call this on a pair of its own ports to
  432. * semi-permanently wire them together. This means that
  433. * a client that wants to direct-wire an input port to
  434. * an output port can call this and then no longer
  435. * have to worry about moving data between them. Any data
  436. * arriving at the input port will appear automatically
  437. * at the output port.
  438. *
  439. * The 'destination' port must be an output port. The 'source'
  440. * port must be an input port. Both ports must belong to
  441. * the same client. You cannot use this to tie ports between
  442. * clients. That is what a connection is for.
  443. *
  444. * @return 0 on success, otherwise a non-zero error code
  445. */
  446. int jack_port_tie (jack_port_t *src, jack_port_t *dst);
  447. /**
  448. * This undoes the effect of jack_port_tie(). The port
  449. * should be same as the 'destination' port passed to
  450. * jack_port_tie().
  451. *
  452. * @return 0 on success, otherwise a non-zero error code
  453. */
  454. int jack_port_untie (jack_port_t *port);
  455. /**
  456. * A client may call this function to prevent other objects
  457. * from changing the connection status of a port. The port
  458. * must be owned by the calling client.
  459. *
  460. * @return 0 on success, otherwise a non-zero error code
  461. */
  462. int jack_port_lock (jack_client_t *, jack_port_t *);
  463. /**
  464. * This allows other objects to change the connection status of a port.
  465. *
  466. * @return 0 on success, otherwise a non-zero error code
  467. */
  468. int jack_port_unlock (jack_client_t *, jack_port_t *);
  469. /**
  470. * @return the time (in frames) between data being available or
  471. * delivered at/to a port, and the time at which it arrived at or is
  472. * delivered to the "other side" of the port. E.g. for a physical
  473. * audio output port, this is the time between writing to the port and
  474. * when the signal will leave the connector. For a physical audio
  475. * input port, this is the time between the sound arriving at the
  476. * connector and the corresponding frames being readable from the
  477. * port.
  478. */
  479. jack_nframes_t jack_port_get_latency (jack_port_t *port);
  480. /**
  481. * The maximum of the sum of the latencies in every
  482. * connection path that can be drawn between the port and other
  483. * ports with the @ref JackPortIsTerminal flag set.
  484. */
  485. jack_nframes_t jack_port_get_total_latency (jack_client_t *,
  486. jack_port_t *port);
  487. /**
  488. * The port latency is zero by default. Clients that control
  489. * physical hardware with non-zero latency should call this
  490. * to set the latency to its correct value. Note that the value
  491. * should include any systemic latency present "outside" the
  492. * physical hardware controlled by the client. For example,
  493. * for a client controlling a digital audio interface connected
  494. * to an external digital converter, the latency setting should
  495. * include both buffering by the audio interface *and* the converter.
  496. */
  497. void jack_port_set_latency (jack_port_t *, jack_nframes_t);
  498. /**
  499. * Modify a port's short name. May be called at any time. If the
  500. * resulting full name (including the @a "client_name:" prefix) is
  501. * longer than jack_port_name_size(), it will be truncated.
  502. *
  503. * @return 0 on success, otherwise a non-zero error code.
  504. */
  505. int jack_port_set_name (jack_port_t *port, const char *port_name);
  506. /**
  507. * If @ref JackPortCanMonitor is set for this @a port, turn input
  508. * monitoring on or off. Otherwise, do nothing.
  509. */
  510. int jack_port_request_monitor (jack_port_t *port, int onoff);
  511. /**
  512. * If @ref JackPortCanMonitor is set for this @a port_name, turn input
  513. * monitoring on or off. Otherwise, do nothing.
  514. *
  515. * @return 0 on success, otherwise a non-zero error code.
  516. *
  517. * @see jack_port_name_size()
  518. */
  519. int jack_port_request_monitor_by_name (jack_client_t *client,
  520. const char *port_name, int onoff);
  521. /**
  522. * If @ref JackPortCanMonitor is set for a port, this function turns
  523. * on input monitoring if it was off, and turns it off if only one
  524. * request has been made to turn it on. Otherwise it does nothing.
  525. *
  526. * @return 0 on success, otherwise a non-zero error code
  527. */
  528. int jack_port_ensure_monitor (jack_port_t *port, int onoff);
  529. /**
  530. * @return TRUE if input monitoring has been requested for @a port.
  531. */
  532. int jack_port_monitoring_input (jack_port_t *port);
  533. /**
  534. * Establish a connection between two ports.
  535. *
  536. * When a connection exists, data written to the source port will
  537. * be available to be read at the destination port.
  538. *
  539. * @pre The port types must be identical.
  540. *
  541. * @pre The @ref JackPortFlags of the @a source_port must include @ref
  542. * JackPortIsOutput.
  543. *
  544. * @pre The @ref JackPortFlags of the @a destination_port must include
  545. * @ref JackPortIsInput.
  546. *
  547. * @return 0 on success, EEXIST if the connection is already made,
  548. * otherwise a non-zero error code
  549. */
  550. int jack_connect (jack_client_t *,
  551. const char *source_port,
  552. const char *destination_port);
  553. /**
  554. * Remove a connection between two ports.
  555. *
  556. * @pre The port types must be identical.
  557. *
  558. * @pre The @ref JackPortFlags of the @a source_port must include @ref
  559. * JackPortIsOutput.
  560. *
  561. * @pre The @ref JackPortFlags of the @a destination_port must include
  562. * @ref JackPortIsInput.
  563. *
  564. * @return 0 on success, otherwise a non-zero error code
  565. */
  566. int jack_disconnect (jack_client_t *,
  567. const char *source_port,
  568. const char *destination_port);
  569. /**
  570. * Perform the same function as jack_disconnect() using port handles
  571. * rather than names. This avoids the name lookup inherent in the
  572. * name-based version.
  573. *
  574. * Clients connecting their own ports are likely to use this function,
  575. * while generic connection clients (e.g. patchbays) would use
  576. * jack_disconnect().
  577. */
  578. int jack_port_disconnect (jack_client_t *, jack_port_t *);
  579. /**
  580. * @return the maximum number of characters in a full JACK port name
  581. * including the final NULL character. This value is a constant.
  582. *
  583. * A port's full name contains the owning client name concatenated
  584. * with a colon (:) followed by its short name and a NULL
  585. * character.
  586. */
  587. int jack_port_name_size(void);
  588. /**
  589. * @return the maximum number of characters in a JACK port type name
  590. * including the final NULL character. This value is a constant.
  591. */
  592. int jack_port_type_size(void);
  593. /**
  594. * @return the sample rate of the jack system, as set by the user when
  595. * jackd was started.
  596. */
  597. jack_nframes_t jack_get_sample_rate (jack_client_t *);
  598. /**
  599. * @return the current maximum size that will ever be passed to the @a
  600. * process_callback. It should only be used *before* the client has
  601. * been activated. This size may change, clients that depend on it
  602. * must register a @a bufsize_callback so they will be notified if it
  603. * does.
  604. *
  605. * @see jack_set_buffer_size_callback()
  606. */
  607. jack_nframes_t jack_get_buffer_size (jack_client_t *);
  608. /**
  609. * @param port_name_pattern A regular expression used to select
  610. * ports by name. If NULL or of zero length, no selection based
  611. * on name will be carried out.
  612. * @param type_name_pattern A regular expression used to select
  613. * ports by type. If NULL or of zero length, no selection based
  614. * on type will be carried out.
  615. * @param flags A value used to select ports by their flags.
  616. * If zero, no selection based on flags will be carried out.
  617. *
  618. * @return a NULL-terminated array of ports that match the specified
  619. * arguments. The caller is responsible for calling free(3) any
  620. * non-NULL returned value.
  621. *
  622. * @see jack_port_name_size(), jack_port_type_size()
  623. */
  624. const char **jack_get_ports (jack_client_t *,
  625. const char *port_name_pattern,
  626. const char *type_name_pattern,
  627. unsigned long flags);
  628. /**
  629. * @return address of the jack_port_t named @a port_name.
  630. *
  631. * @see jack_port_name_size()
  632. */
  633. jack_port_t *jack_port_by_name (jack_client_t *, const char *port_name);
  634. /**
  635. * @return address of the jack_port_t of a @a port_id.
  636. */
  637. jack_port_t *jack_port_by_id (const jack_client_t *client,
  638. jack_port_id_t port_id);
  639. /**
  640. * Old-style interface to become the timebase for the entire JACK
  641. * subsystem.
  642. *
  643. * @deprecated This function still exists for compatibility with the
  644. * earlier transport interface, but it does nothing. Instead, see
  645. * transport.h and use jack_set_timebase_callback().
  646. *
  647. * @return ENOSYS, function not implemented.
  648. */
  649. int jack_engine_takeover_timebase (jack_client_t *);
  650. /**
  651. * @return the time in frames that has passed since the JACK server
  652. * began the current process cycle.
  653. */
  654. jack_nframes_t jack_frames_since_cycle_start (const jack_client_t *);
  655. /**
  656. * @return an estimate of the current time in frames. This is a
  657. * running counter, no significance should be attached to its value,
  658. * but it can be compared to a previously returned value.
  659. */
  660. jack_nframes_t jack_frame_time (const jack_client_t *);
  661. /**
  662. * @return the frame_time after the last processing of the graph
  663. * this is only to be used from the process callback.
  664. *
  665. * This function can be used to put timestamps generated by
  666. * jack_frame_time() in correlation to the current process cycle.
  667. */
  668. jack_nframes_t jack_last_frame_time (const jack_client_t *client);
  669. /**
  670. * @return the current CPU load estimated by JACK. This is a running
  671. * average of the time it takes to execute a full process cycle for
  672. * all clients as a percentage of the real time available per cycle
  673. * determined by the buffer size and sample rate.
  674. */
  675. float jack_cpu_load (jack_client_t *client);
  676. /**
  677. * Set the directory in which the server is expected
  678. * to have put its communication FIFOs. A client
  679. * will need to call this before calling
  680. * jack_client_new() if the server was started
  681. * with arguments telling it to use a non-standard
  682. * directory.
  683. *
  684. * @deprecated This function is deprecated. Don't use in new programs
  685. * and remove it in old programs.
  686. */
  687. void jack_set_server_dir (const char *path);
  688. /**
  689. * @return the pthread ID of the thread running the JACK client side
  690. * code.
  691. */
  692. pthread_t jack_client_thread_id (jack_client_t *);
  693. /**
  694. * Display JACK error message.
  695. *
  696. * Set via jack_set_error_function(), otherwise a JACK-provided
  697. * default will print @a msg (plus a newline) to stderr.
  698. *
  699. * @param msg error message text (no newline at end).
  700. */
  701. extern void (*jack_error_callback)(const char *msg);
  702. /**
  703. * Set the @ref jack_error_callback for error message display.
  704. *
  705. * The JACK library provides two built-in callbacks for this purpose:
  706. * default_jack_error_callback() and silent_jack_error_callback().
  707. */
  708. void jack_set_error_function (void (*func)(const char *));
  709. #ifdef __cplusplus
  710. }
  711. #endif
  712. #endif /* __jack_h__ */