Update jack2 pdf link to archive.org
[jackdbus.git] / common / jack / jack.h
blob23850bbc0415705654faf9db0df872788d1fa14e
1 /*
2 Copyright (C) 2001 Paul Davis
3 Copyright (C) 2004 Jack O'Quin
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU Lesser General Public License as published by
7 the Free Software Foundation; either version 2.1 of the License, or
8 (at your option) any later version.
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU Lesser General Public License for more details.
15 You should have received a copy of the GNU Lesser General Public License
16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
21 #ifndef __jack_h__
22 #define __jack_h__
24 #ifdef __cplusplus
25 extern "C"
27 #endif
29 #include <jack/systemdeps.h>
30 #include <jack/types.h>
31 #include <jack/transport.h>
33 /**
34 * Note: More documentation can be found in jack/types.h.
37 /*************************************************************
38 * NOTE: JACK_WEAK_EXPORT ***MUST*** be used on every function
39 * added to the JACK API after the 0.116.2 release.
41 * Functions that predate this release are marked with
42 * JACK_WEAK_OPTIONAL_EXPORT which can be defined at compile
43 * time in a variety of ways. The default definition is empty,
44 * so that these symbols get normal linkage. If you wish to
45 * use all JACK symbols with weak linkage, include
46 * <jack/weakjack.h> before jack.h.
47 *************************************************************/
49 #include <jack/weakmacros.h>
51 /**
52 * Call this function to get version of the JACK, in form of several numbers
54 * @param major_ptr pointer to variable receiving major version of JACK.
56 * @param minor_ptr pointer to variable receiving minor version of JACK.
58 * @param major_ptr pointer to variable receiving micro version of JACK.
60 * @param major_ptr pointer to variable receiving protocol version of JACK.
63 void
64 jack_get_version(
65 int *major_ptr,
66 int *minor_ptr,
67 int *micro_ptr,
68 int *proto_ptr) JACK_OPTIONAL_WEAK_EXPORT;
70 /**
71 * Call this function to get version of the JACK, in form of a string
73 * @return Human readable string describing JACK version being used.
76 const char *
77 jack_get_version_string(void) JACK_OPTIONAL_WEAK_EXPORT;
79 /**
80 * @defgroup ClientFunctions Creating & manipulating clients
81 * @{
84 /**
85 * Open an external client session with a JACK server. This interface
86 * is more complex but more powerful than jack_client_new(). With it,
87 * clients may choose which of several servers to connect, and control
88 * whether and how to start the server automatically, if it was not
89 * already running. There is also an option for JACK to generate a
90 * unique client name, when necessary.
92 * @param client_name of at most jack_client_name_size() characters.
93 * The name scope is local to each server. Unless forbidden by the
94 * @ref JackUseExactName option, the server will modify this name to
95 * create a unique variant, if needed.
97 * @param options formed by OR-ing together @ref JackOptions bits.
98 * Only the @ref JackOpenOptions bits are allowed.
100 * @param status (if non-NULL) an address for JACK to return
101 * information from the open operation. This status word is formed by
102 * OR-ing together the relevant @ref JackStatus bits.
105 * <b>Optional parameters:</b> depending on corresponding [@a options
106 * bits] additional parameters may follow @a status (in this order).
108 * @arg [@ref JackServerName] <em>(char *) server_name</em> selects
109 * from among several possible concurrent server instances. Server
110 * names are unique to each user. If unspecified, use "default"
111 * unless \$JACK_DEFAULT_SERVER is defined in the process environment.
113 * @return Opaque client handle if successful. If this is NULL, the
114 * open operation failed, @a *status includes @ref JackFailure and the
115 * caller is not a JACK client.
117 jack_client_t * jack_client_open (const char *client_name,
118 jack_options_t options,
119 jack_status_t *status, ...) JACK_OPTIONAL_WEAK_EXPORT;
122 * \bold THIS FUNCTION IS DEPRECATED AND SHOULD NOT BE USED IN
123 * NEW JACK CLIENTS
125 * @deprecated Please use jack_client_open().
127 jack_client_t * jack_client_new (const char *client_name) JACK_OPTIONAL_WEAK_DEPRECATED_EXPORT;
130 * Disconnects an external client from a JACK server.
132 * @return 0 on success, otherwise a non-zero error code
134 int jack_client_close (jack_client_t *client) JACK_OPTIONAL_WEAK_EXPORT;
137 * @return the maximum number of characters in a JACK client name
138 * including the final NULL character. This value is a constant.
140 int jack_client_name_size (void) JACK_OPTIONAL_WEAK_EXPORT;
143 * @return pointer to actual client name. This is useful when @ref
144 * JackUseExactName is not specified on open and @ref
145 * JackNameNotUnique status was returned. In that case, the actual
146 * name will differ from the @a client_name requested.
148 char * jack_get_client_name (jack_client_t *client) JACK_OPTIONAL_WEAK_EXPORT;
151 * Get the session ID for a client name.
153 * The session manager needs this to reassociate a client name to the session_id.
155 * The caller is responsible for calling jack_free(3) on any non-NULL
156 * returned value.
158 char *jack_get_uuid_for_client_name (jack_client_t *client,
159 const char *client_name) JACK_WEAK_EXPORT;
162 * Get the client name for a session_id.
164 * In order to snapshot the graph connections, the session manager needs to map
165 * session_ids to client names.
167 * The caller is responsible for calling jack_free(3) on any non-NULL
168 * returned value.
170 char *jack_get_client_name_by_uuid (jack_client_t *client,
171 const char *client_uuid ) JACK_WEAK_EXPORT;
174 * Load an internal client into the Jack server.
176 * Internal clients run inside the JACK server process. They can use
177 * most of the same functions as external clients. Each internal
178 * client must declare jack_initialize() and jack_finish() entry
179 * points, called at load and unload times. See inprocess.c for an
180 * example of how to write an internal client.
182 * @deprecated Please use jack_internal_client_load().
184 * @param client_name of at most jack_client_name_size() characters.
186 * @param load_name of a shared object file containing the code for
187 * the new client.
189 * @param load_init an arbitrary string passed to the jack_initialize()
190 * routine of the new client (may be NULL).
192 * @return 0 if successful.
194 int jack_internal_client_new (const char *client_name,
195 const char *load_name,
196 const char *load_init) JACK_OPTIONAL_WEAK_DEPRECATED_EXPORT;
199 * Remove an internal client from a JACK server.
201 * @deprecated Please use jack_internal_client_unload().
203 void jack_internal_client_close (const char *client_name) JACK_OPTIONAL_WEAK_DEPRECATED_EXPORT;
206 * Tell the Jack server that the program is ready to start processing
207 * audio.
209 * @return 0 on success, otherwise a non-zero error code
211 int jack_activate (jack_client_t *client) JACK_OPTIONAL_WEAK_EXPORT;
214 * Tell the Jack server to remove this @a client from the process
215 * graph. Also, disconnect all ports belonging to it, since inactive
216 * clients have no port connections.
218 * @return 0 on success, otherwise a non-zero error code
220 int jack_deactivate (jack_client_t *client) JACK_OPTIONAL_WEAK_EXPORT;
223 * @return pid of client. If not available, 0 will be returned.
225 int jack_get_client_pid (const char *name) JACK_OPTIONAL_WEAK_EXPORT;
228 * @return the pthread ID of the thread running the JACK client side
229 * real-time code.
231 jack_native_thread_t jack_client_thread_id (jack_client_t *client) JACK_OPTIONAL_WEAK_EXPORT;
233 /**@}*/
236 * @param client pointer to JACK client structure.
238 * Check if the JACK subsystem is running with -R (--realtime).
240 * @return 1 if JACK is running realtime, 0 otherwise
242 int jack_is_realtime (jack_client_t *client) JACK_OPTIONAL_WEAK_EXPORT;
245 * @defgroup NonCallbackAPI The non-callback API
246 * @{
250 * \bold THIS FUNCTION IS DEPRECATED AND SHOULD NOT BE USED IN
251 * NEW JACK CLIENTS.
253 * @deprecated Please use jack_cycle_wait() and jack_cycle_signal() functions.
255 jack_nframes_t jack_thread_wait (jack_client_t *client, int status) JACK_OPTIONAL_WEAK_EXPORT;
258 * Wait until this JACK client should process data.
260 * @param client - pointer to a JACK client structure
262 * @return the number of frames of data to process
264 jack_nframes_t jack_cycle_wait (jack_client_t* client) JACK_OPTIONAL_WEAK_EXPORT;
267 * Signal next clients in the graph.
269 * @param client - pointer to a JACK client structure
270 * @param status - if non-zero, calling thread should exit
272 void jack_cycle_signal (jack_client_t* client, int status) JACK_OPTIONAL_WEAK_EXPORT;
275 * Tell the Jack server to call @a thread_callback in the RT thread.
276 * Typical use are in conjunction with @a jack_cycle_wait and @a jack_cycle_signal functions.
277 * The code in the supplied function must be suitable for real-time
278 * execution. That means that it cannot call functions that might
279 * block for a long time. This includes malloc, free, printf,
280 * pthread_mutex_lock, sleep, wait, poll, select, pthread_join,
281 * pthread_cond_wait, etc, etc. See
282 * http://jackit.sourceforge.net/docs/design/design.html#SECTION00411000000000000000
283 * for more information.
285 * NOTE: this function cannot be called while the client is activated
286 * (after jack_activate has been called.)
288 * @return 0 on success, otherwise a non-zero error code.
290 int jack_set_process_thread(jack_client_t* client, JackThreadCallback thread_callback, void *arg) JACK_OPTIONAL_WEAK_EXPORT;
292 /**@}*/
295 * @defgroup ClientCallbacks Setting Client Callbacks
296 * @{
300 * Tell JACK to call @a thread_init_callback once just after
301 * the creation of the thread in which all other callbacks
302 * will be handled.
304 * The code in the supplied function does not need to be
305 * suitable for real-time execution.
307 * NOTE: this function cannot be called while the client is activated
308 * (after jack_activate has been called.)
310 * @return 0 on success, otherwise a non-zero error code, causing JACK
311 * to remove that client from the process() graph.
313 int jack_set_thread_init_callback (jack_client_t *client,
314 JackThreadInitCallback thread_init_callback,
315 void *arg) JACK_OPTIONAL_WEAK_EXPORT;
318 * @param client pointer to JACK client structure.
319 * @param function The jack_shutdown function pointer.
320 * @param arg The arguments for the jack_shutdown function.
322 * Register a function (and argument) to be called if and when the
323 * JACK server shuts down the client thread. The function must
324 * be written as if it were an asynchonrous POSIX signal
325 * handler --- use only async-safe functions, and remember that it
326 * is executed from another thread. A typical function might
327 * set a flag or write to a pipe so that the rest of the
328 * application knows that the JACK client thread has shut
329 * down.
331 * NOTE: clients do not need to call this. It exists only
332 * to help more complex clients understand what is going
333 * on. It should be called before jack_client_activate().
335 * NOTE: if a client calls this AND jack_on_info_shutdown(), then
336 * in case of a client thread shutdown, the callback
337 * passed to this function will not be called, and the one passed to
338 * jack_on_info_shutdown() will.
340 * NOTE: application should typically signal another thread to correctly
341 * finish cleanup, that is by calling "jack_client_close"
342 * (since "jack_client_close" cannot be called directly in the context
343 * of the thread that calls the shutdown callback).
345 void jack_on_shutdown (jack_client_t *client,
346 JackShutdownCallback shutdown_callback, void *arg) JACK_OPTIONAL_WEAK_EXPORT;
349 * @param client pointer to JACK client structure.
350 * @param function The jack_info_shutdown function pointer.
351 * @param arg The arguments for the jack_info_shutdown function.
353 * Register a function (and argument) to be called if and when the
354 * JACK server shuts down the client thread. The function must
355 * be written as if it were an asynchonrous POSIX signal
356 * handler --- use only async-safe functions, and remember that it
357 * is executed from another thread. A typical function might
358 * set a flag or write to a pipe so that the rest of the
359 * application knows that the JACK client thread has shut
360 * down.
362 * NOTE: clients do not need to call this. It exists only
363 * to help more complex clients understand what is going
364 * on. It should be called before jack_client_activate().
366 * NOTE: if a client calls this AND jack_on_shutdown(), then
367 * in case of a client thread shutdown, the callback passed to
368 * jack_on_info_shutdown() will be called.
370 * NOTE: application should typically signal another thread to correctly
371 * finish cleanup, that is by calling "jack_client_close"
372 * (since "jack_client_close" cannot be called directly in the context
373 * of the thread that calls the shutdown callback).
375 void jack_on_info_shutdown (jack_client_t *client,
376 JackInfoShutdownCallback shutdown_callback, void *arg) JACK_WEAK_EXPORT;
379 * Tell the Jack server to call @a process_callback whenever there is
380 * work be done, passing @a arg as the second argument.
382 * The code in the supplied function must be suitable for real-time
383 * execution. That means that it cannot call functions that might
384 * block for a long time. This includes malloc, free, printf,
385 * pthread_mutex_lock, sleep, wait, poll, select, pthread_join,
386 * pthread_cond_wait, etc, etc. See
387 * http://jackit.sourceforge.net/docs/design/design.html#SECTION00411000000000000000
388 * for more information.
390 * NOTE: this function cannot be called while the client is activated
391 * (after jack_activate has been called.)
393 * @return 0 on success, otherwise a non-zero error code.
395 int jack_set_process_callback (jack_client_t *client,
396 JackProcessCallback process_callback,
397 void *arg) JACK_OPTIONAL_WEAK_EXPORT;
400 * Tell the Jack server to call @a freewheel_callback
401 * whenever we enter or leave "freewheel" mode, passing @a
402 * arg as the second argument. The first argument to the
403 * callback will be non-zero if JACK is entering freewheel
404 * mode, and zero otherwise.
406 * All "notification events" are received in a separated non RT thread,
407 * the code in the supplied function does not need to be
408 * suitable for real-time execution.
410 * NOTE: this function cannot be called while the client is activated
411 * (after jack_activate has been called.)
413 * @return 0 on success, otherwise a non-zero error code.
415 int jack_set_freewheel_callback (jack_client_t *client,
416 JackFreewheelCallback freewheel_callback,
417 void *arg) JACK_OPTIONAL_WEAK_EXPORT;
420 * Tell JACK to call @a bufsize_callback whenever the size of the the
421 * buffer that will be passed to the @a process_callback is about to
422 * change. Clients that depend on knowing the buffer size must supply
423 * a @a bufsize_callback before activating themselves.
425 * All "notification events" are received in a separated non RT thread,
426 * the code in the supplied function does not need to be
427 * suitable for real-time execution.
429 * NOTE: this function cannot be called while the client is activated
430 * (after jack_activate has been called.)
432 * @param client pointer to JACK client structure.
433 * @param bufsize_callback function to call when the buffer size changes.
434 * @param arg argument for @a bufsize_callback.
436 * @return 0 on success, otherwise a non-zero error code
438 int jack_set_buffer_size_callback (jack_client_t *client,
439 JackBufferSizeCallback bufsize_callback,
440 void *arg) JACK_OPTIONAL_WEAK_EXPORT;
443 * Tell the Jack server to call @a srate_callback whenever the system
444 * sample rate changes.
446 * All "notification events" are received in a separated non RT thread,
447 * the code in the supplied function does not need to be
448 * suitable for real-time execution.
450 * NOTE: this function cannot be called while the client is activated
451 * (after jack_activate has been called.)
453 * @return 0 on success, otherwise a non-zero error code
455 int jack_set_sample_rate_callback (jack_client_t *client,
456 JackSampleRateCallback srate_callback,
457 void *arg) JACK_OPTIONAL_WEAK_EXPORT;
460 * Tell the JACK server to call @a client_registration_callback whenever a
461 * client is registered or unregistered, passing @a arg as a parameter.
463 * All "notification events" are received in a separated non RT thread,
464 * the code in the supplied function does not need to be
465 * suitable for real-time execution.
467 * NOTE: this function cannot be called while the client is activated
468 * (after jack_activate has been called.)
470 * @return 0 on success, otherwise a non-zero error code
472 int jack_set_client_registration_callback (jack_client_t *client,
473 JackClientRegistrationCallback
474 registration_callback, void *arg) JACK_OPTIONAL_WEAK_EXPORT;
477 * Tell the JACK server to call @a registration_callback whenever a
478 * port is registered or unregistered, passing @a arg as a parameter.
480 * All "notification events" are received in a separated non RT thread,
481 * the code in the supplied function does not need to be
482 * suitable for real-time execution.
484 * NOTE: this function cannot be called while the client is activated
485 * (after jack_activate has been called.)
487 * @return 0 on success, otherwise a non-zero error code
489 int jack_set_port_registration_callback (jack_client_t *client,
490 JackPortRegistrationCallback
491 registration_callback, void *arg) JACK_OPTIONAL_WEAK_EXPORT;
494 * Tell the JACK server to call @a connect_callback whenever a
495 * port is connected or disconnected, passing @a arg as a parameter.
497 * All "notification events" are received in a separated non RT thread,
498 * the code in the supplied function does not need to be
499 * suitable for real-time execution.
501 * NOTE: this function cannot be called while the client is activated
502 * (after jack_activate has been called.)
504 * @return 0 on success, otherwise a non-zero error code
506 int jack_set_port_connect_callback (jack_client_t *client,
507 JackPortConnectCallback
508 connect_callback, void *arg) JACK_OPTIONAL_WEAK_EXPORT;
511 * Tell the JACK server to call @a rename_callback whenever a
512 * port is renamed, passing @a arg as a parameter.
514 * All "notification events" are received in a separated non RT thread,
515 * the code in the supplied function does not need to be
516 * suitable for real-time execution.
518 * NOTE: this function cannot be called while the client is activated
519 * (after jack_activate has been called.)
521 * @return 0 on success, otherwise a non-zero error code
523 int jack_set_port_rename_callback (jack_client_t *client,
524 JackPortRenameCallback
525 rename_callback, void *arg) JACK_OPTIONAL_WEAK_EXPORT;
528 * Tell the JACK server to call @a graph_callback whenever the
529 * processing graph is reordered, passing @a arg as a parameter.
531 * All "notification events" are received in a separated non RT thread,
532 * the code in the supplied function does not need to be
533 * suitable for real-time execution.
535 * NOTE: this function cannot be called while the client is activated
536 * (after jack_activate has been called.)
538 * @return 0 on success, otherwise a non-zero error code
540 int jack_set_graph_order_callback (jack_client_t *client,
541 JackGraphOrderCallback graph_callback,
542 void *) JACK_OPTIONAL_WEAK_EXPORT;
545 * Tell the JACK server to call @a xrun_callback whenever there is a
546 * xrun, passing @a arg as a parameter.
548 * All "notification events" are received in a separated non RT thread,
549 * the code in the supplied function does not need to be
550 * suitable for real-time execution.
552 * NOTE: this function cannot be called while the client is activated
553 * (after jack_activate has been called.)
555 * @return 0 on success, otherwise a non-zero error code
557 int jack_set_xrun_callback (jack_client_t *client,
558 JackXRunCallback xrun_callback, void *arg) JACK_OPTIONAL_WEAK_EXPORT;
561 * Tell the Jack server to call @a latency_callback whenever it
562 * is necessary to recompute the latencies for some or all
563 * Jack ports.
565 * @a latency_callback will be called twice each time it is
566 * needed, once being passed JackCaptureLatency and once
567 * JackPlaybackLatency. See @ref LatencyFunctions for
568 * the definition of each type of latency and related functions.
570 * <b>IMPORTANT: Most JACK clients do NOT need to register a latency
571 * callback.</b>
573 * Clients that meet any of the following conditions do NOT
574 * need to register a latency callback:
576 * - have only input ports
577 * - have only output ports
578 * - their output is totally unrelated to their input
579 * - their output is not delayed relative to their input
580 * (i.e. data that arrives in a given process()
581 * callback is processed and output again in the
582 * same callback)
584 * Clients NOT registering a latency callback MUST also
585 * satisfy this condition:
587 * - have no multiple distinct internal signal pathways
589 * This means that if your client has more than 1 input and
590 * output port, and considers them always "correlated"
591 * (e.g. as a stereo pair), then there is only 1 (e.g. stereo)
592 * signal pathway through the client. This would be true,
593 * for example, of a stereo FX rack client that has a
594 * left/right input pair and a left/right output pair.
596 * However, this is somewhat a matter of perspective. The
597 * same FX rack client could be connected so that its
598 * two input ports were connected to entirely separate
599 * sources. Under these conditions, the fact that the client
600 * does not register a latency callback MAY result
601 * in port latency values being incorrect.
603 * Clients that do not meet any of those conditions SHOULD
604 * register a latency callback.
606 * Another case is when a client wants to use
607 * @ref jack_port_get_latency_range(), which only returns meaningful
608 * values when ports get connected and latency values change.
610 * See the documentation for @ref jack_port_set_latency_range()
611 * on how the callback should operate. Remember that the @a mode
612 * argument given to the latency callback will need to be
613 * passed into @ref jack_port_set_latency_range()
615 * @return 0 on success, otherwise a non-zero error code
617 int jack_set_latency_callback (jack_client_t *client,
618 JackLatencyCallback latency_callback,
619 void *) JACK_WEAK_EXPORT;
620 /**@}*/
623 * @defgroup ServerClientControl Controlling & querying JACK server operation
624 * @{
628 * Start/Stop JACK's "freewheel" mode.
630 * When in "freewheel" mode, JACK no longer waits for
631 * any external event to begin the start of the next process
632 * cycle.
634 * As a result, freewheel mode causes "faster than realtime"
635 * execution of a JACK graph. If possessed, real-time
636 * scheduling is dropped when entering freewheel mode, and
637 * if appropriate it is reacquired when stopping.
639 * IMPORTANT: on systems using capabilities to provide real-time
640 * scheduling (i.e. Linux kernel 2.4), if onoff is zero, this function
641 * must be called from the thread that originally called jack_activate().
642 * This restriction does not apply to other systems (e.g. Linux kernel 2.6
643 * or OS X).
645 * @param client pointer to JACK client structure
646 * @param onoff if non-zero, freewheel mode starts. Otherwise
647 * freewheel mode ends.
649 * @return 0 on success, otherwise a non-zero error code.
651 int jack_set_freewheel(jack_client_t* client, int onoff) JACK_OPTIONAL_WEAK_EXPORT;
654 * Change the buffer size passed to the @a process_callback.
656 * This operation stops the JACK engine process cycle, then calls all
657 * registered @a bufsize_callback functions before restarting the
658 * process cycle. This will cause a gap in the audio flow, so it
659 * should only be done at appropriate stopping points.
661 * @see jack_set_buffer_size_callback()
663 * @param client pointer to JACK client structure.
664 * @param nframes new buffer size. Must be a power of two.
666 * @return 0 on success, otherwise a non-zero error code
668 int jack_set_buffer_size (jack_client_t *client, jack_nframes_t nframes) JACK_OPTIONAL_WEAK_EXPORT;
671 * @return the sample rate of the jack system, as set by the user when
672 * jackd was started.
674 jack_nframes_t jack_get_sample_rate (jack_client_t *) JACK_OPTIONAL_WEAK_EXPORT;
677 * @return the current maximum size that will ever be passed to the @a
678 * process_callback. It should only be used *before* the client has
679 * been activated. This size may change, clients that depend on it
680 * must register a @a bufsize_callback so they will be notified if it
681 * does.
683 * @see jack_set_buffer_size_callback()
685 jack_nframes_t jack_get_buffer_size (jack_client_t *) JACK_OPTIONAL_WEAK_EXPORT;
688 * Old-style interface to become the timebase for the entire JACK
689 * subsystem.
691 * @deprecated This function still exists for compatibility with the
692 * earlier transport interface, but it does nothing. Instead, see
693 * transport.h and use jack_set_timebase_callback().
695 * @return ENOSYS, function not implemented.
697 int jack_engine_takeover_timebase (jack_client_t *) JACK_OPTIONAL_WEAK_DEPRECATED_EXPORT;
700 * @return the current CPU load estimated by JACK. This is a running
701 * average of the time it takes to execute a full process cycle for
702 * all clients as a percentage of the real time available per cycle
703 * determined by the buffer size and sample rate.
705 float jack_cpu_load (jack_client_t *client) JACK_OPTIONAL_WEAK_EXPORT;
707 /**@}*/
710 * @defgroup PortFunctions Creating & manipulating ports
711 * @{
715 * Create a new port for the client. This is an object used for moving
716 * data of any type in or out of the client. Ports may be connected
717 * in various ways.
719 * Each port has a short name. The port's full name contains the name
720 * of the client concatenated with a colon (:) followed by its short
721 * name. The jack_port_name_size() is the maximum length of this full
722 * name. Exceeding that will cause the port registration to fail and
723 * return NULL.
725 * The @a port_name must be unique among all ports owned by this client.
726 * If the name is not unique, the registration will fail.
728 * All ports have a type, which may be any non-NULL and non-zero
729 * length string, passed as an argument. Some port types are built
730 * into the JACK API, currently only JACK_DEFAULT_AUDIO_TYPE.
732 * @param client pointer to JACK client structure.
733 * @param port_name non-empty short name for the new port (not
734 * including the leading @a "client_name:"). Must be unique.
735 * @param port_type port type name. If longer than
736 * jack_port_type_size(), only that many characters are significant.
737 * @param flags @ref JackPortFlags bit mask.
738 * @param buffer_size must be non-zero if this is not a built-in @a
739 * port_type. Otherwise, it is ignored.
741 * @return jack_port_t pointer on success, otherwise NULL.
743 jack_port_t * jack_port_register (jack_client_t *client,
744 const char *port_name,
745 const char *port_type,
746 unsigned long flags,
747 unsigned long buffer_size) JACK_OPTIONAL_WEAK_EXPORT;
750 * Remove the port from the client, disconnecting any existing
751 * connections.
753 * @return 0 on success, otherwise a non-zero error code
755 int jack_port_unregister (jack_client_t *client, jack_port_t *port) JACK_OPTIONAL_WEAK_EXPORT;
758 * This returns a pointer to the memory area associated with the
759 * specified port. For an output port, it will be a memory area
760 * that can be written to; for an input port, it will be an area
761 * containing the data from the port's connection(s), or
762 * zero-filled. if there are multiple inbound connections, the data
763 * will be mixed appropriately.
765 * FOR OUTPUT PORTS ONLY : DEPRECATED in Jack 2.0 !!
766 * ---------------------------------------------------
767 * You may cache the value returned, but only between calls to
768 * your "blocksize" callback. For this reason alone, you should
769 * either never cache the return value or ensure you have
770 * a "blocksize" callback and be sure to invalidate the cached
771 * address from there.
773 * Caching output ports is DEPRECATED in Jack 2.0, due to some new optimization (like "pipelining").
774 * Port buffers have to be retrieved in each callback for proper functioning.
776 void * jack_port_get_buffer (jack_port_t *port, jack_nframes_t) JACK_OPTIONAL_WEAK_EXPORT;
779 * @return the UUID of the jack_port_t
781 * @see jack_uuid_to_string() to convert into a string representation
783 jack_uuid_t jack_port_uuid (const jack_port_t *port) JACK_OPTIONAL_WEAK_EXPORT;
786 * @return the full name of the jack_port_t (including the @a
787 * "client_name:" prefix).
789 * @see jack_port_name_size().
791 const char * jack_port_name (const jack_port_t *port) JACK_OPTIONAL_WEAK_EXPORT;
794 * @return the short name of the jack_port_t (not including the @a
795 * "client_name:" prefix).
797 * @see jack_port_name_size().
799 const char * jack_port_short_name (const jack_port_t *port) JACK_OPTIONAL_WEAK_EXPORT;
802 * @return the @ref JackPortFlags of the jack_port_t.
804 int jack_port_flags (const jack_port_t *port) JACK_OPTIONAL_WEAK_EXPORT;
807 * @return the @a port type, at most jack_port_type_size() characters
808 * including a final NULL.
810 const char * jack_port_type (const jack_port_t *port) JACK_OPTIONAL_WEAK_EXPORT;
813 * @return the @a port type id.
815 jack_port_type_id_t jack_port_type_id (const jack_port_t *port) JACK_OPTIONAL_WEAK_EXPORT;
818 * @return TRUE if the jack_port_t belongs to the jack_client_t.
820 int jack_port_is_mine (const jack_client_t *client, const jack_port_t *port) JACK_OPTIONAL_WEAK_EXPORT;
823 * @return number of connections to or from @a port.
825 * @pre The calling client must own @a port.
827 int jack_port_connected (const jack_port_t *port) JACK_OPTIONAL_WEAK_EXPORT;
830 * @return TRUE if the locally-owned @a port is @b directly connected
831 * to the @a port_name.
833 * @see jack_port_name_size()
835 int jack_port_connected_to (const jack_port_t *port,
836 const char *port_name) JACK_OPTIONAL_WEAK_EXPORT;
839 * @return a null-terminated array of full port names to which the @a
840 * port is connected. If none, returns NULL.
842 * The caller is responsible for calling jack_free() on any non-NULL
843 * returned value.
845 * @param port locally owned jack_port_t pointer.
847 * @see jack_port_name_size(), jack_port_get_all_connections()
849 const char ** jack_port_get_connections (const jack_port_t *port) JACK_OPTIONAL_WEAK_EXPORT;
852 * @return a null-terminated array of full port names to which the @a
853 * port is connected. If none, returns NULL.
855 * The caller is responsible for calling jack_free() on any non-NULL
856 * returned value.
858 * This differs from jack_port_get_connections() in two important
859 * respects:
861 * 1) You may not call this function from code that is
862 * executed in response to a JACK event. For example,
863 * you cannot use it in a GraphReordered handler.
865 * 2) You need not be the owner of the port to get information
866 * about its connections.
868 * @see jack_port_name_size()
870 const char ** jack_port_get_all_connections (const jack_client_t *client,
871 const jack_port_t *port) JACK_OPTIONAL_WEAK_EXPORT;
875 * @deprecated This function will be removed from a future version
876 * of JACK. Do not use it. There is no replacement. It has
877 * turned out to serve essentially no purpose in real-life
878 * JACK clients.
880 int jack_port_tie (jack_port_t *src, jack_port_t *dst) JACK_OPTIONAL_WEAK_DEPRECATED_EXPORT;
884 * @deprecated This function will be removed from a future version
885 * of JACK. Do not use it. There is no replacement. It has
886 * turned out to serve essentially no purpose in real-life
887 * JACK clients.
889 int jack_port_untie (jack_port_t *port) JACK_OPTIONAL_WEAK_DEPRECATED_EXPORT;
892 * \bold THIS FUNCTION IS DEPRECATED AND SHOULD NOT BE USED IN
893 * NEW JACK CLIENTS
895 * Modify a port's short name. May be called at any time. If the
896 * resulting full name (including the @a "client_name:" prefix) is
897 * longer than jack_port_name_size(), it will be truncated.
899 * @return 0 on success, otherwise a non-zero error code.
901 int jack_port_set_name (jack_port_t *port, const char *port_name) JACK_OPTIONAL_WEAK_DEPRECATED_EXPORT;
904 * Modify a port's short name. May NOT be called from a callback handling a server event.
905 * If the resulting full name (including the @a "client_name:" prefix) is
906 * longer than jack_port_name_size(), it will be truncated.
908 * @return 0 on success, otherwise a non-zero error code.
910 * This differs from jack_port_set_name() by triggering PortRename notifications to
911 * clients that have registered a port rename handler.
913 int jack_port_rename (jack_client_t* client, jack_port_t *port, const char *port_name) JACK_OPTIONAL_WEAK_EXPORT;
916 * Set @a alias as an alias for @a port. May be called at any time.
917 * If the alias is longer than jack_port_name_size(), it will be truncated.
919 * After a successful call, and until JACK exits or
920 * @function jack_port_unset_alias() is called, @alias may be
921 * used as a alternate name for the port.
923 * Ports can have up to two aliases - if both are already
924 * set, this function will return an error.
926 * @return 0 on success, otherwise a non-zero error code.
928 int jack_port_set_alias (jack_port_t *port, const char *alias) JACK_OPTIONAL_WEAK_EXPORT;
931 * Remove @a alias as an alias for @a port. May be called at any time.
933 * After a successful call, @a alias can no longer be
934 * used as a alternate name for the port.
936 * @return 0 on success, otherwise a non-zero error code.
938 int jack_port_unset_alias (jack_port_t *port, const char *alias) JACK_OPTIONAL_WEAK_EXPORT;
941 * Get any aliases known for @port.
943 * @return the number of aliases discovered for the port
945 int jack_port_get_aliases (const jack_port_t *port, char* const aliases[2]) JACK_OPTIONAL_WEAK_EXPORT;
948 * If @ref JackPortCanMonitor is set for this @a port, turn input
949 * monitoring on or off. Otherwise, do nothing.
951 int jack_port_request_monitor (jack_port_t *port, int onoff) JACK_OPTIONAL_WEAK_EXPORT;
954 * If @ref JackPortCanMonitor is set for this @a port_name, turn input
955 * monitoring on or off. Otherwise, do nothing.
957 * @return 0 on success, otherwise a non-zero error code.
959 * @see jack_port_name_size()
961 int jack_port_request_monitor_by_name (jack_client_t *client,
962 const char *port_name, int onoff) JACK_OPTIONAL_WEAK_EXPORT;
965 * If @ref JackPortCanMonitor is set for a port, this function turns
966 * on input monitoring if it was off, and turns it off if only one
967 * request has been made to turn it on. Otherwise it does nothing.
969 * @return 0 on success, otherwise a non-zero error code
971 int jack_port_ensure_monitor (jack_port_t *port, int onoff) JACK_OPTIONAL_WEAK_EXPORT;
974 * @return TRUE if input monitoring has been requested for @a port.
976 int jack_port_monitoring_input (jack_port_t *port) JACK_OPTIONAL_WEAK_EXPORT;
979 * Establish a connection between two ports.
981 * When a connection exists, data written to the source port will
982 * be available to be read at the destination port.
984 * @pre The port types must be identical.
986 * @pre The @ref JackPortFlags of the @a source_port must include @ref
987 * JackPortIsOutput.
989 * @pre The @ref JackPortFlags of the @a destination_port must include
990 * @ref JackPortIsInput.
992 * @return 0 on success, EEXIST if the connection is already made,
993 * otherwise a non-zero error code
995 int jack_connect (jack_client_t *client,
996 const char *source_port,
997 const char *destination_port) JACK_OPTIONAL_WEAK_EXPORT;
1000 * Remove a connection between two ports.
1002 * @pre The port types must be identical.
1004 * @pre The @ref JackPortFlags of the @a source_port must include @ref
1005 * JackPortIsOutput.
1007 * @pre The @ref JackPortFlags of the @a destination_port must include
1008 * @ref JackPortIsInput.
1010 * @return 0 on success, otherwise a non-zero error code
1012 int jack_disconnect (jack_client_t *client,
1013 const char *source_port,
1014 const char *destination_port) JACK_OPTIONAL_WEAK_EXPORT;
1017 * Perform the same function as jack_disconnect() using port handles
1018 * rather than names. This avoids the name lookup inherent in the
1019 * name-based version.
1021 * Clients connecting their own ports are likely to use this function,
1022 * while generic connection clients (e.g. patchbays) would use
1023 * jack_disconnect().
1025 int jack_port_disconnect (jack_client_t *client, jack_port_t *port) JACK_OPTIONAL_WEAK_EXPORT;
1028 * @return the maximum number of characters in a full JACK port name
1029 * including the final NULL character. This value is a constant.
1031 * A port's full name contains the owning client name concatenated
1032 * with a colon (:) followed by its short name and a NULL
1033 * character.
1035 int jack_port_name_size(void) JACK_OPTIONAL_WEAK_EXPORT;
1038 * @return the maximum number of characters in a JACK port type name
1039 * including the final NULL character. This value is a constant.
1041 int jack_port_type_size(void) JACK_OPTIONAL_WEAK_EXPORT;
1044 * @return the buffersize of a port of type @arg port_type.
1046 * this function may only be called in a buffer_size callback.
1048 size_t jack_port_type_get_buffer_size (jack_client_t *client, const char *port_type) JACK_WEAK_EXPORT;
1050 /**@}*/
1053 * @defgroup LatencyFunctions Managing and determining latency
1054 * @{
1056 * The purpose of JACK's latency API is to allow clients to
1057 * easily answer two questions:
1059 * - How long has it been since the data read from a port arrived
1060 * at the edge of the JACK graph (either via a physical port
1061 * or being synthesized from scratch)?
1063 * - How long will it be before the data written to a port arrives
1064 * at the edge of a JACK graph?
1066 * To help answering these two questions, all JACK ports have two
1067 * latency values associated with them, both measured in frames:
1069 * <b>capture latency</b>: how long since the data read from
1070 * the buffer of a port arrived at
1071 * a port marked with JackPortIsTerminal.
1072 * The data will have come from the "outside
1073 * world" if the terminal port is also
1074 * marked with JackPortIsPhysical, or
1075 * will have been synthesized by the client
1076 * that owns the terminal port.
1078 * <b>playback latency</b>: how long until the data
1079 * written to the buffer of port will reach a port
1080 * marked with JackPortIsTerminal.
1082 * Both latencies might potentially have more than one value
1083 * because there may be multiple pathways to/from a given port
1084 * and a terminal port. Latency is therefore generally
1085 * expressed a min/max pair.
1087 * In most common setups, the minimum and maximum latency
1088 * are the same, but this design accommodates more complex
1089 * routing, and allows applications (and thus users) to
1090 * detect cases where routing is creating an anomalous
1091 * situation that may either need fixing or more
1092 * sophisticated handling by clients that care about
1093 * latency.
1095 * See also @ref jack_set_latency_callback for details on how
1096 * clients that add latency to the signal path should interact
1097 * with JACK to ensure that the correct latency figures are
1098 * used.
1102 * The port latency is zero by default. Clients that control
1103 * physical hardware with non-zero latency should call this
1104 * to set the latency to its correct value. Note that the value
1105 * should include any systemic latency present "outside" the
1106 * physical hardware controlled by the client. For example,
1107 * for a client controlling a digital audio interface connected
1108 * to an external digital converter, the latency setting should
1109 * include both buffering by the audio interface *and* the converter.
1111 * @deprecated This method will be removed in the next major
1112 * release of JACK. It should not be used in new code, and should
1113 * be replaced by a latency callback that calls @ref
1114 * jack_port_set_latency_range().
1116 void jack_port_set_latency (jack_port_t *port, jack_nframes_t) JACK_OPTIONAL_WEAK_DEPRECATED_EXPORT;
1119 * return the latency range defined by @a mode for
1120 * @a port, in frames.
1122 * See @ref LatencyFunctions for the definition of each latency value.
1124 * This function is best used from callbacks, specifically the latency callback.
1125 * Before a port is connected, this returns the default latency: zero.
1126 * Therefore it only makes sense to call jack_port_get_latency_range() when
1127 * the port is connected, and that gets signalled by the latency callback.
1128 * See @ref jack_set_latency_callback() for details.
1130 void jack_port_get_latency_range (jack_port_t *port, jack_latency_callback_mode_t mode, jack_latency_range_t *range) JACK_WEAK_EXPORT;
1133 * set the minimum and maximum latencies defined by
1134 * @a mode for @a port, in frames.
1136 * See @ref LatencyFunctions for the definition of each latency value.
1138 * This function should ONLY be used inside a latency
1139 * callback. The client should determine the current
1140 * value of the latency using @ref jack_port_get_latency_range()
1141 * (called using the same mode as @a mode)
1142 * and then add some number of frames to that reflects
1143 * latency added by the client.
1145 * How much latency a client adds will vary
1146 * dramatically. For most clients, the answer is zero
1147 * and there is no reason for them to register a latency
1148 * callback and thus they should never call this
1149 * function.
1151 * More complex clients that take an input signal,
1152 * transform it in some way and output the result but
1153 * not during the same process() callback will
1154 * generally know a single constant value to add
1155 * to the value returned by @ref jack_port_get_latency_range().
1157 * Such clients would register a latency callback (see
1158 * @ref jack_set_latency_callback) and must know what input
1159 * ports feed which output ports as part of their
1160 * internal state. Their latency callback will update
1161 * the ports' latency values appropriately.
1163 * A pseudo-code example will help. The @a mode argument to the latency
1164 * callback will determine whether playback or capture
1165 * latency is being set. The callback will use
1166 * @ref jack_port_set_latency_range() as follows:
1168 * \code
1169 * jack_latency_range_t range;
1170 * if (mode == JackPlaybackLatency) {
1171 * foreach input_port in (all self-registered port) {
1172 * jack_port_get_latency_range (port_feeding_input_port, JackPlaybackLatency, &range);
1173 * range.min += min_delay_added_as_signal_flows_from port_feeding to input_port;
1174 * range.max += max_delay_added_as_signal_flows_from port_feeding to input_port;
1175 * jack_port_set_latency_range (input_port, JackPlaybackLatency, &range);
1177 * } else if (mode == JackCaptureLatency) {
1178 * foreach output_port in (all self-registered port) {
1179 * jack_port_get_latency_range (port_fed_by_output_port, JackCaptureLatency, &range);
1180 * range.min += min_delay_added_as_signal_flows_from_output_port_to_fed_by_port;
1181 * range.max += max_delay_added_as_signal_flows_from_output_port_to_fed_by_port;
1182 * jack_port_set_latency_range (output_port, JackCaptureLatency, &range);
1185 * \endcode
1187 * In this relatively simple pseudo-code example, it is assumed that
1188 * each input port or output is connected to only 1 output or input
1189 * port respectively.
1191 * If a port is connected to more than 1 other port, then the
1192 * range.min and range.max values passed to @ref
1193 * jack_port_set_latency_range() should reflect the minimum and
1194 * maximum values across all connected ports.
1196 * See the description of @ref jack_set_latency_callback for more
1197 * information.
1199 void jack_port_set_latency_range (jack_port_t *port, jack_latency_callback_mode_t mode, jack_latency_range_t *range) JACK_WEAK_EXPORT;
1202 * Request a complete recomputation of all port latencies. This
1203 * can be called by a client that has just changed the internal
1204 * latency of its port using jack_port_set_latency
1205 * and wants to ensure that all signal pathways in the graph
1206 * are updated with respect to the values that will be returned
1207 * by jack_port_get_total_latency. It allows a client
1208 * to change multiple port latencies without triggering a
1209 * recompute for each change.
1211 * @return zero for successful execution of the request. non-zero
1212 * otherwise.
1214 int jack_recompute_total_latencies (jack_client_t *client) JACK_OPTIONAL_WEAK_EXPORT;
1217 * @return the time (in frames) between data being available or
1218 * delivered at/to a port, and the time at which it arrived at or is
1219 * delivered to the "other side" of the port. E.g. for a physical
1220 * audio output port, this is the time between writing to the port and
1221 * when the signal will leave the connector. For a physical audio
1222 * input port, this is the time between the sound arriving at the
1223 * connector and the corresponding frames being readable from the
1224 * port.
1226 * @deprecated This method will be removed in the next major
1227 * release of JACK. It should not be used in new code, and should
1228 * be replaced by jack_port_get_latency_range() in any existing
1229 * use cases.
1231 jack_nframes_t jack_port_get_latency (jack_port_t *port) JACK_OPTIONAL_WEAK_DEPRECATED_EXPORT;
1234 * The maximum of the sum of the latencies in every
1235 * connection path that can be drawn between the port and other
1236 * ports with the @ref JackPortIsTerminal flag set.
1238 * @deprecated This method will be removed in the next major
1239 * release of JACK. It should not be used in new code, and should
1240 * be replaced by jack_port_get_latency_range() in any existing
1241 * use cases.
1243 jack_nframes_t jack_port_get_total_latency (jack_client_t *client,
1244 jack_port_t *port) JACK_OPTIONAL_WEAK_DEPRECATED_EXPORT;
1247 * Request a complete recomputation of a port's total latency. This
1248 * can be called by a client that has just changed the internal
1249 * latency of its port using jack_port_set_latency
1250 * and wants to ensure that all signal pathways in the graph
1251 * are updated with respect to the values that will be returned
1252 * by jack_port_get_total_latency.
1254 * @return zero for successful execution of the request. non-zero
1255 * otherwise.
1257 * @deprecated This method will be removed in the next major
1258 * release of JACK. It should not be used in new code, and should
1259 * be replaced by jack_recompute_total_latencies() in any existing
1260 * use cases.
1262 int jack_recompute_total_latency (jack_client_t*, jack_port_t* port) JACK_OPTIONAL_WEAK_DEPRECATED_EXPORT;
1264 /**@}*/
1267 * @defgroup PortSearching Looking up ports
1268 * @{
1272 * @param port_name_pattern A regular expression used to select
1273 * ports by name. If NULL or of zero length, no selection based
1274 * on name will be carried out.
1275 * @param type_name_pattern A regular expression used to select
1276 * ports by type. If NULL or of zero length, no selection based
1277 * on type will be carried out.
1278 * @param flags A value used to select ports by their flags.
1279 * If zero, no selection based on flags will be carried out.
1281 * @return a NULL-terminated array of ports that match the specified
1282 * arguments. The caller is responsible for calling jack_free() any
1283 * non-NULL returned value.
1285 * @see jack_port_name_size(), jack_port_type_size()
1287 const char ** jack_get_ports (jack_client_t *client,
1288 const char *port_name_pattern,
1289 const char *type_name_pattern,
1290 unsigned long flags) JACK_OPTIONAL_WEAK_EXPORT;
1293 * @return address of the jack_port_t named @a port_name.
1295 * @see jack_port_name_size()
1297 jack_port_t * jack_port_by_name (jack_client_t *client, const char *port_name) JACK_OPTIONAL_WEAK_EXPORT;
1300 * @return address of the jack_port_t of a @a port_id.
1302 jack_port_t * jack_port_by_id (jack_client_t *client,
1303 jack_port_id_t port_id) JACK_OPTIONAL_WEAK_EXPORT;
1305 /**@}*/
1308 * @defgroup TimeFunctions Handling time
1309 * @{
1311 * JACK time is in units of 'frames', according to the current sample rate.
1312 * The absolute value of frame times is meaningless, frame times have meaning
1313 * only relative to each other.
1317 * @return the estimated time in frames that has passed since the JACK
1318 * server began the current process cycle.
1320 jack_nframes_t jack_frames_since_cycle_start (const jack_client_t *) JACK_OPTIONAL_WEAK_EXPORT;
1323 * @return the estimated current time in frames.
1324 * This function is intended for use in other threads (not the process
1325 * callback). The return value can be compared with the value of
1326 * jack_last_frame_time to relate time in other threads to JACK time.
1328 jack_nframes_t jack_frame_time (const jack_client_t *) JACK_OPTIONAL_WEAK_EXPORT;
1331 * @return the precise time at the start of the current process cycle.
1332 * This function may only be used from the process callback, and can
1333 * be used to interpret timestamps generated by jack_frame_time() in
1334 * other threads with respect to the current process cycle.
1336 * This is the only jack time function that returns exact time:
1337 * when used during the process callback it always returns the same
1338 * value (until the next process callback, where it will return
1339 * that value + nframes, etc). The return value is guaranteed to be
1340 * monotonic and linear in this fashion unless an xrun occurs.
1341 * If an xrun occurs, clients must check this value again, as time
1342 * may have advanced in a non-linear way (e.g. cycles may have been skipped).
1344 jack_nframes_t jack_last_frame_time (const jack_client_t *client) JACK_OPTIONAL_WEAK_EXPORT;
1347 * This function may only be used from the process callback.
1348 * It provides the internal cycle timing information as used by
1349 * most of the other time related functions. This allows the
1350 * caller to map between frame counts and microseconds with full
1351 * precision (i.e. without rounding frame times to integers),
1352 * and also provides e.g. the microseconds time of the start of
1353 * the current cycle directly (it has to be computed otherwise).
1355 * If the return value is zero, the following information is
1356 * provided in the variables pointed to by the arguments:
1358 * current_frames: the frame time counter at the start of the
1359 * current cycle, same as jack_last_frame_time().
1360 * current_usecs: the microseconds time at the start of the
1361 * current cycle.
1362 * next_usecs: the microseconds time of the start of the next
1363 * next cycle as computed by the DLL.
1364 * period_usecs: the current best estimate of the period time in
1365 * microseconds.
1367 * NOTES:
1369 * Because of the types used, all the returned values except period_usecs
1370 * are unsigned. In computations mapping between frames and microseconds
1371 * *signed* differences are required. The easiest way is to compute those
1372 * separately and assign them to the appropriate signed variables,
1373 * int32_t for frames and int64_t for usecs. See the implementation of
1374 * jack_frames_to_time() and Jack_time_to_frames() for an example.
1376 * Unless there was an xrun, skipped cycles, or the current cycle is the
1377 * first after freewheeling or starting Jack, the value of current_usecs
1378 * will always be the value of next_usecs of the previous cycle.
1380 * The value of period_usecs will in general NOT be exactly equal to
1381 * the difference of next_usecs and current_usecs. This is because to
1382 * ensure stability of the DLL and continuity of the mapping, a fraction
1383 * of the loop error must be included in next_usecs. For an accurate
1384 * mapping between frames and microseconds, the difference of next_usecs
1385 * and current_usecs should be used, and not period_usecs.
1387 * @return zero if OK, non-zero otherwise.
1389 int jack_get_cycle_times(const jack_client_t *client,
1390 jack_nframes_t *current_frames,
1391 jack_time_t *current_usecs,
1392 jack_time_t *next_usecs,
1393 float *period_usecs) JACK_OPTIONAL_WEAK_EXPORT;
1396 * @return the estimated time in microseconds of the specified frame time
1398 jack_time_t jack_frames_to_time(const jack_client_t *client, jack_nframes_t) JACK_OPTIONAL_WEAK_EXPORT;
1401 * @return the estimated time in frames for the specified system time.
1403 jack_nframes_t jack_time_to_frames(const jack_client_t *client, jack_time_t) JACK_OPTIONAL_WEAK_EXPORT;
1406 * @return return JACK's current system time in microseconds,
1407 * using the JACK clock source.
1409 * The value returned is guaranteed to be monotonic, but not linear.
1411 jack_time_t jack_get_time(void) JACK_OPTIONAL_WEAK_EXPORT;
1413 /**@}*/
1416 * @defgroup ErrorOutput Controlling error/information output
1417 * @{
1421 * Display JACK error message.
1423 * Set via jack_set_error_function(), otherwise a JACK-provided
1424 * default will print @a msg (plus a newline) to stderr.
1426 * @param msg error message text (no newline at end).
1428 extern void (*jack_error_callback)(const char *msg) JACK_OPTIONAL_WEAK_EXPORT;
1431 * Set the @ref jack_error_callback for error message display.
1432 * Set it to NULL to restore default_jack_error_callback function.
1434 * The JACK library provides two built-in callbacks for this purpose:
1435 * default_jack_error_callback() and silent_jack_error_callback().
1437 void jack_set_error_function (void (*func)(const char *)) JACK_OPTIONAL_WEAK_EXPORT;
1440 * Display JACK info message.
1442 * Set via jack_set_info_function(), otherwise a JACK-provided
1443 * default will print @a msg (plus a newline) to stdout.
1445 * @param msg info message text (no newline at end).
1447 extern void (*jack_info_callback)(const char *msg) JACK_OPTIONAL_WEAK_EXPORT;
1450 * Set the @ref jack_info_callback for info message display.
1451 * Set it to NULL to restore default_jack_info_callback function.
1453 * The JACK library provides two built-in callbacks for this purpose:
1454 * default_jack_info_callback() and silent_jack_info_callback().
1456 void jack_set_info_function (void (*func)(const char *)) JACK_OPTIONAL_WEAK_EXPORT;
1458 /**@}*/
1461 * The free function to be used on memory returned by jack_port_get_connections,
1462 * jack_port_get_all_connections, jack_get_ports and jack_get_internal_client_name functions.
1463 * This is MANDATORY on Windows when otherwise all nasty runtime version related crashes can occur.
1464 * Developers are strongly encouraged to use this function instead of the standard "free" function in new code.
1466 * @param ptr the memory pointer to be deallocated.
1468 void jack_free(void* ptr) JACK_OPTIONAL_WEAK_EXPORT;
1471 #ifdef __cplusplus
1473 #endif
1475 #endif /* __jack_h__ */