stop & detach driver when exiting due to -T/--temporary flag
[jack.git] / jack / jack.h
blob64ba8a7aed89f535860389f9393beeafa92a5904
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" {
26 #endif
28 #include <pthread.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 * @defgroup ClientFunctions Creating & manipulating clients
39 * @{
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.
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.
55 * @param options formed by OR-ing together @ref JackOptions bits.
56 * Only the @ref JackOpenOptions bits are allowed.
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.
63 * <b>Optional parameters:</b> depending on corresponding [@a options
64 * bits] additional parameters may follow @a status (in this order).
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.
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.
75 jack_client_t *jack_client_open (const char *client_name,
76 jack_options_t options,
77 jack_status_t *status, ...);
79 /**
80 * <b>THIS FUNCTION IS DEPRECATED AND SHOULD NOT BE USED IN
81 * NEW JACK CLIENTS</b>
84 jack_client_t *jack_client_new (const char *client_name);
86 /**
87 * Disconnects an external client from a JACK server.
89 * @return 0 on success, otherwise a non-zero error code
91 int jack_client_close (jack_client_t *client);
93 /**
94 * @return the maximum number of characters in a JACK client name
95 * including the final NULL character. This value is a constant.
97 int jack_client_name_size (void);
99 /**
100 * @return pointer to actual client name. This is useful when @ref
101 * JackUseExactName is not specified on open and @ref
102 * JackNameNotUnique status was returned. In that case, the actual
103 * name will differ from the @a client_name requested.
105 char *jack_get_client_name (jack_client_t *client);
108 * Load an internal client into the Jack server.
110 * Internal clients run inside the JACK server process. They can use
111 * most of the same functions as external clients. Each internal
112 * client must declare jack_initialize() and jack_finish() entry
113 * points, called at load and unload times. See inprocess.c for an
114 * example of how to write an internal client.
116 * @deprecated Please use jack_internal_client_load().
118 * @param client_name of at most jack_client_name_size() characters.
120 * @param load_name of a shared object file containing the code for
121 * the new client.
123 * @param load_init an arbitary string passed to the jack_initialize()
124 * routine of the new client (may be NULL).
126 * @return 0 if successful.
128 int jack_internal_client_new (const char *client_name,
129 const char *load_name,
130 const char *load_init);
133 * Remove an internal client from a JACK server.
135 * @deprecated Please use jack_internal_client_load().
137 void jack_internal_client_close (const char *client_name);
140 * Tell the Jack server that the program is ready to start processing
141 * audio.
143 * @return 0 on success, otherwise a non-zero error code
145 int jack_activate (jack_client_t *client);
148 * Tell the Jack server to remove this @a client from the process
149 * graph. Also, disconnect all ports belonging to it, since inactive
150 * clients have no port connections.
152 * @return 0 on success, otherwise a non-zero error code
154 int jack_deactivate (jack_client_t *client);
157 * @return the pthread ID of the thread running the JACK client side
158 * code.
160 pthread_t jack_client_thread_id (jack_client_t *);
162 /*@}*/
165 * @param client pointer to JACK client structure.
167 * Check if the JACK subsystem is running with -R (--realtime).
169 * @return 1 if JACK is running realtime, 0 otherwise
171 int jack_is_realtime (jack_client_t *client);
174 * @defgroup NonCallbackAPI The non-callback API
175 * @{
179 * <b>THIS FUNCTION IS DEPRECATED AND SHOULD NOT BE USED IN
180 * NEW JACK CLIENTS</b>
182 * It should be replace by use of @ jack_cycle_wait and @ jack_cycle_signal functions.
185 jack_nframes_t jack_thread_wait (jack_client_t*, int status);
188 * Wait until this JACK client should process data.
190 * @param client - pointer to a JACK client structure
192 * @return the number of frames of data to process
194 jack_nframes_t jack_cycle_wait (jack_client_t* client);
197 * Signal next clients in the graph.
199 * @param client - pointer to a JACK client structure
200 * @param status - if non-zero, calling thread should exit
202 void jack_cycle_signal (jack_client_t* client, int status);
205 * Tell the Jack server to call @a thread_callback in the RT thread.
206 * Typical use are in conjunction with @a jack_cycle_wait and @ jack_cycle_signal functions.
207 * The code in the supplied function must be suitable for real-time
208 * execution. That means that it cannot call functions that might
209 * block for a long time. This includes malloc, free, printf,
210 * pthread_mutex_lock, sleep, wait, poll, select, pthread_join,
211 * pthread_cond_wait, etc, etc. See
212 * http://jackit.sourceforge.net/docs/design/design.html#SECTION00411000000000000000
213 * for more information.
215 * @return 0 on success, otherwise a non-zero error code.
217 int jack_set_process_thread(jack_client_t* client, JackThreadCallback fun, void *arg);
219 /*@}*/
222 * @defgroup ClientCallbacks Setting Client Callbacks
223 * @{
227 * Tell JACK to call @a thread_init_callback once just after
228 * the creation of the thread in which all other callbacks
229 * will be handled.
231 * The code in the supplied function does not need to be
232 * suitable for real-time execution.
234 * @return 0 on success, otherwise a non-zero error code, causing JACK
235 * to remove that client from the process() graph.
237 int jack_set_thread_init_callback (jack_client_t *client,
238 JackThreadInitCallback thread_init_callback,
239 void *arg);
241 /**
242 * @param client pointer to JACK client structure.
243 * @param function The jack_shutdown function pointer.
244 * @param arg The arguments for the jack_shutdown function.
246 * Register a function (and argument) to be called if and when the
247 * JACK server shuts down the client thread. The function must
248 * be written as if it were an asynchonrous POSIX signal
249 * handler --- use only async-safe functions, and remember that it
250 * is executed from another thread. A typical function might
251 * set a flag or write to a pipe so that the rest of the
252 * application knows that the JACK client thread has shut
253 * down.
255 * NOTE: clients do not need to call this. It exists only
256 * to help more complex clients understand what is going
257 * on. It should be called before jack_client_activate().
259 void jack_on_shutdown (jack_client_t *client,
260 void (*function)(void *arg), void *arg);
263 * Tell the Jack server to call @a process_callback whenever there is
264 * work be done, passing @a arg as the second argument.
266 * The code in the supplied function must be suitable for real-time
267 * execution. That means that it cannot call functions that might
268 * block for a long time. This includes malloc, free, printf,
269 * pthread_mutex_lock, sleep, wait, poll, select, pthread_join,
270 * pthread_cond_wait, etc, etc. See
271 * http://jackit.sourceforge.net/docs/design/design.html#SECTION00411000000000000000
272 * for more information.
274 * @return 0 on success, otherwise a non-zero error code, causing JACK
275 * to remove that client from the process() graph.
277 int jack_set_process_callback (jack_client_t *client,
278 JackProcessCallback process_callback,
279 void *arg);
282 * Tell the Jack server to call @a freewheel_callback
283 * whenever we enter or leave "freewheel" mode, passing @a
284 * arg as the second argument. The first argument to the
285 * callback will be non-zero if JACK is entering freewheel
286 * mode, and zero otherwise.
288 * @return 0 on success, otherwise a non-zero error code.
290 int jack_set_freewheel_callback (jack_client_t *client,
291 JackFreewheelCallback freewheel_callback,
292 void *arg);
295 * Tell JACK to call @a bufsize_callback whenever the size of the the
296 * buffer that will be passed to the @a process_callback is about to
297 * change. Clients that depend on knowing the buffer size must supply
298 * a @a bufsize_callback before activating themselves.
300 * @param client pointer to JACK client structure.
301 * @param bufsize_callback function to call when the buffer size changes.
302 * @param arg argument for @a bufsize_callback.
304 * @return 0 on success, otherwise a non-zero error code
306 int jack_set_buffer_size_callback (jack_client_t *client,
307 JackBufferSizeCallback bufsize_callback,
308 void *arg);
311 * Tell the Jack server to call @a srate_callback whenever the system
312 * sample rate changes.
314 * @return 0 on success, otherwise a non-zero error code
316 int jack_set_sample_rate_callback (jack_client_t *client,
317 JackSampleRateCallback srate_callback,
318 void *arg);
321 * Tell the JACK server to call @a registration_callback whenever a
322 * port is registered or unregistered, passing @a arg as a parameter.
324 * @return 0 on success, otherwise a non-zero error code
326 int jack_set_client_registration_callback (jack_client_t *,
327 JackClientRegistrationCallback
328 registration_callback, void *arg);
331 * Tell the JACK server to call @a registration_callback whenever a
332 * port is registered or unregistered, passing @a arg as a parameter.
334 * @return 0 on success, otherwise a non-zero error code
336 int jack_set_port_registration_callback (jack_client_t *,
337 JackPortRegistrationCallback
338 registration_callback, void *arg);
341 * Tell the JACK server to call @a connect_callback whenever a
342 * port is connected or disconnected, passing @a arg as a parameter.
344 * @return 0 on success, otherwise a non-zero error code
346 int jack_set_port_connect_callback (jack_client_t *,
347 JackPortConnectCallback
348 connect_callback, void *arg);
350 * Tell the JACK server to call @a graph_callback whenever the
351 * processing graph is reordered, passing @a arg as a parameter.
353 * @return 0 on success, otherwise a non-zero error code
355 int jack_set_graph_order_callback (jack_client_t *,
356 JackGraphOrderCallback graph_callback,
357 void *);
360 * Tell the JACK server to call @a xrun_callback whenever there is a
361 * xrun, passing @a arg as a parameter.
363 * @return 0 on success, otherwise a non-zero error code
365 int jack_set_xrun_callback (jack_client_t *,
366 JackXRunCallback xrun_callback, void *arg);
368 /*@}*/
371 * @defgroup ServerControl Controlling & querying JACK server operation
372 * @{
376 * Start/Stop JACK's "freewheel" mode.
378 * When in "freewheel" mode, JACK no longer waits for
379 * any external event to begin the start of the next process
380 * cycle.
382 * As a result, freewheel mode causes "faster than realtime"
383 * execution of a JACK graph. If possessed, real-time
384 * scheduling is dropped when entering freewheel mode, and
385 * if appropriate it is reacquired when stopping.
387 * IMPORTANT: on systems using capabilities to provide real-time
388 * scheduling (i.e. Linux kernel 2.4), if onoff is zero, this function
389 * must be called from the thread that originally called jack_activate().
390 * This restriction does not apply to other systems (e.g. Linux kernel 2.6
391 * or OS X).
393 * @param client pointer to JACK client structure
394 * @param onoff if non-zero, freewheel mode starts. Otherwise
395 * freewheel mode ends.
397 * @return 0 on success, otherwise a non-zero error code.
399 int jack_set_freewheel(jack_client_t* client, int onoff);
402 * Change the buffer size passed to the @a process_callback.
404 * This operation stops the JACK engine process cycle, then calls all
405 * registered @a bufsize_callback functions before restarting the
406 * process cycle. This will cause a gap in the audio flow, so it
407 * should only be done at appropriate stopping points.
409 * @see jack_set_buffer_size_callback()
411 * @param client pointer to JACK client structure.
412 * @param nframes new buffer size. Must be a power of two.
414 * @return 0 on success, otherwise a non-zero error code
416 int jack_set_buffer_size (jack_client_t *client, jack_nframes_t nframes);
419 * @return the sample rate of the jack system, as set by the user when
420 * jackd was started.
422 jack_nframes_t jack_get_sample_rate (jack_client_t *);
425 * @return the current maximum size that will ever be passed to the @a
426 * process_callback. It should only be used *before* the client has
427 * been activated. This size may change, clients that depend on it
428 * must register a @a bufsize_callback so they will be notified if it
429 * does.
431 * @see jack_set_buffer_size_callback()
433 jack_nframes_t jack_get_buffer_size (jack_client_t *);
436 * Old-style interface to become the timebase for the entire JACK
437 * subsystem.
439 * @deprecated This function still exists for compatibility with the
440 * earlier transport interface, but it does nothing. Instead, see
441 * transport.h and use jack_set_timebase_callback().
443 * @return ENOSYS, function not implemented.
445 int jack_engine_takeover_timebase (jack_client_t *);
448 * @return the current CPU load estimated by JACK. This is a running
449 * average of the time it takes to execute a full process cycle for
450 * all clients as a percentage of the real time available per cycle
451 * determined by the buffer size and sample rate.
453 float jack_cpu_load (jack_client_t *client);
456 /*@}*/
459 * @defgroup PortFunctions Creating & manipulating ports
460 * @{
464 * Create a new port for the client. This is an object used for moving
465 * data of any type in or out of the client. Ports may be connected
466 * in various ways.
468 * Each port has a short name. The port's full name contains the name
469 * of the client concatenated with a colon (:) followed by its short
470 * name. The jack_port_name_size() is the maximum length of this full
471 * name. Exceeding that will cause the port registration to fail and
472 * return NULL.
474 * All ports have a type, which may be any non-NULL and non-zero
475 * length string, passed as an argument. Some port types are built
476 * into the JACK API, like JACK_DEFAULT_AUDIO_TYPE or JACK_DEFAULT_MIDI_TYPE
478 * @param client pointer to JACK client structure.
479 * @param port_name non-empty short name for the new port (not
480 * including the leading @a "client_name:").
481 * @param port_type port type name. If longer than
482 * jack_port_type_size(), only that many characters are significant.
483 * @param flags @ref JackPortFlags bit mask.
484 * @param buffer_size must be non-zero if this is not a built-in @a
485 * port_type. Otherwise, it is ignored.
487 * @return jack_port_t pointer on success, otherwise NULL.
489 jack_port_t *jack_port_register (jack_client_t *client,
490 const char *port_name,
491 const char *port_type,
492 unsigned long flags,
493 unsigned long buffer_size);
495 /**
496 * Remove the port from the client, disconnecting any existing
497 * connections.
499 * @return 0 on success, otherwise a non-zero error code
501 int jack_port_unregister (jack_client_t *, jack_port_t *);
504 * This returns a pointer to the memory area associated with the
505 * specified port. For an output port, it will be a memory area
506 * that can be written to; for an input port, it will be an area
507 * containing the data from the port's connection(s), or
508 * zero-filled. if there are multiple inbound connections, the data
509 * will be mixed appropriately.
511 * FOR OUTPUT PORTS ONLY : WILL BE DEPRECATED in Jack 2.0 !!
512 * ---------------------------------------------------------
513 * You may cache the value returned, but only between calls to
514 * your "blocksize" callback. For this reason alone, you should
515 * either never cache the return value or ensure you have
516 * a "blocksize" callback and be sure to invalidate the cached
517 * address from there.
519 * Caching output ports is DEPRECATED in Jack 2.0, due to some new optimization (like "pipelining").
520 * Port buffers have to be retrieved in each callback for proper functionning.
522 void *jack_port_get_buffer (jack_port_t *, jack_nframes_t);
525 * @return the full name of the jack_port_t (including the @a
526 * "client_name:" prefix).
528 * @see jack_port_name_size().
530 const char *jack_port_name (const jack_port_t *port);
533 * @return the short name of the jack_port_t (not including the @a
534 * "client_name:" prefix).
536 * @see jack_port_name_size().
538 const char *jack_port_short_name (const jack_port_t *port);
541 * @return the @ref JackPortFlags of the jack_port_t.
543 int jack_port_flags (const jack_port_t *port);
546 * @return the @a port type, at most jack_port_type_size() characters
547 * including a final NULL.
549 const char *jack_port_type (const jack_port_t *port);
551 /**
552 * @return TRUE if the jack_port_t belongs to the jack_client_t.
554 int jack_port_is_mine (const jack_client_t *, const jack_port_t *port);
556 /**
557 * @return number of connections to or from @a port.
559 * @pre The calling client must own @a port.
561 int jack_port_connected (const jack_port_t *port);
564 * @return TRUE if the locally-owned @a port is @b directly connected
565 * to the @a port_name.
567 * @see jack_port_name_size()
569 int jack_port_connected_to (const jack_port_t *port,
570 const char *port_name);
573 * @return a null-terminated array of full port names to which the @a
574 * port is connected. If none, returns NULL.
576 * The caller is responsible for calling free(3) on any non-NULL
577 * returned value.
579 * @param port locally owned jack_port_t pointer.
581 * @see jack_port_name_size(), jack_port_get_all_connections()
583 const char **jack_port_get_connections (const jack_port_t *port);
586 * @return a null-terminated array of full port names to which the @a
587 * port is connected. If none, returns NULL.
589 * The caller is responsible for calling free(3) on any non-NULL
590 * returned value.
592 * This differs from jack_port_get_connections() in two important
593 * respects:
595 * 1) You may not call this function from code that is
596 * executed in response to a JACK event. For example,
597 * you cannot use it in a GraphReordered handler.
599 * 2) You need not be the owner of the port to get information
600 * about its connections.
602 * @see jack_port_name_size()
604 const char **jack_port_get_all_connections (const jack_client_t *client,
605 const jack_port_t *port);
609 * @deprecated This function will be removed from a future version
610 * of JACK. Do not use it. There is no replacement. It has
611 * turned out to serve essentially no purpose in real-life
612 * JACK clients.
614 int jack_port_tie (jack_port_t *src, jack_port_t *dst);
618 * @deprecated This function will be removed from a future version
619 * of JACK. Do not use it. There is no replacement. It has
620 * turned out to serve essentially no purpose in real-life
621 * JACK clients.
623 int jack_port_untie (jack_port_t *port);
625 /**
626 * @return the time (in frames) between data being available or
627 * delivered at/to a port, and the time at which it arrived at or is
628 * delivered to the "other side" of the port. E.g. for a physical
629 * audio output port, this is the time between writing to the port and
630 * when the signal will leave the connector. For a physical audio
631 * input port, this is the time between the sound arriving at the
632 * connector and the corresponding frames being readable from the
633 * port.
635 jack_nframes_t jack_port_get_latency (jack_port_t *port);
638 * The maximum of the sum of the latencies in every
639 * connection path that can be drawn between the port and other
640 * ports with the @ref JackPortIsTerminal flag set.
642 jack_nframes_t jack_port_get_total_latency (jack_client_t *,
643 jack_port_t *port);
646 * The port latency is zero by default. Clients that control
647 * physical hardware with non-zero latency should call this
648 * to set the latency to its correct value. Note that the value
649 * should include any systemic latency present "outside" the
650 * physical hardware controlled by the client. For example,
651 * for a client controlling a digital audio interface connected
652 * to an external digital converter, the latency setting should
653 * include both buffering by the audio interface *and* the converter.
655 void jack_port_set_latency (jack_port_t *, jack_nframes_t);
658 * Request a complete recomputation of a port's total latency. This
659 * can be called by a client that has just changed the internal
660 * latency of its port using jack_port_set_latency
661 * and wants to ensure that all signal pathways in the graph
662 * are updated with respect to the values that will be returned
663 * by jack_port_get_total_latency.
665 * @return zero for successful execution of the request. non-zero
666 * otherwise.
668 int jack_recompute_total_latency (jack_client_t*, jack_port_t* port);
671 * Request a complete recomputation of all port latencies. This
672 * can be called by a client that has just changed the internal
673 * latency of its port using jack_port_set_latency
674 * and wants to ensure that all signal pathways in the graph
675 * are updated with respect to the values that will be returned
676 * by jack_port_get_total_latency. It allows a client
677 * to change multiple port latencies without triggering a
678 * recompute for each change.
680 * @return zero for successful execution of the request. non-zero
681 * otherwise.
683 int jack_recompute_total_latencies (jack_client_t*);
686 * Modify a port's short name. May be called at any time. If the
687 * resulting full name (including the @a "client_name:" prefix) is
688 * longer than jack_port_name_size(), it will be truncated.
690 * @return 0 on success, otherwise a non-zero error code.
692 int jack_port_set_name (jack_port_t *port, const char *port_name);
695 * Set @a alias as an alias for @a port. May be called at any time.
696 * If the alias is longer than jack_port_name_size(), it will be truncated.
698 * After a successful call, and until JACK exits or
699 * jack_port_unset_alias() is called, may be
700 * used as a alternate name for the port.
702 * Ports can have up to two aliases - if both are already
703 * set, this function will return an error.
705 * @return 0 on success, otherwise a non-zero error code.
707 int jack_port_set_alias (jack_port_t *port, const char *alias);
710 * Remove @a alias as an alias for @a port. May be called at any time.
712 * After a successful call, @a alias can no longer be
713 * used as a alternate name for the port.
715 * @return 0 on success, otherwise a non-zero error code.
717 int jack_port_unset_alias (jack_port_t *port, const char *alias);
720 * Get any aliases known for @port.
722 * @return the number of aliases discovered for the port
724 int jack_port_get_aliases (const jack_port_t *port, char* const aliases[2]);
727 * If @ref JackPortCanMonitor is set for this @a port, turn input
728 * monitoring on or off. Otherwise, do nothing.
730 int jack_port_request_monitor (jack_port_t *port, int onoff);
733 * If @ref JackPortCanMonitor is set for this @a port_name, turn input
734 * monitoring on or off. Otherwise, do nothing.
736 * @return 0 on success, otherwise a non-zero error code.
738 * @see jack_port_name_size()
740 int jack_port_request_monitor_by_name (jack_client_t *client,
741 const char *port_name, int onoff);
744 * If @ref JackPortCanMonitor is set for a port, this function turns
745 * on input monitoring if it was off, and turns it off if only one
746 * request has been made to turn it on. Otherwise it does nothing.
748 * @return 0 on success, otherwise a non-zero error code
750 int jack_port_ensure_monitor (jack_port_t *port, int onoff);
753 * @return TRUE if input monitoring has been requested for @a port.
755 int jack_port_monitoring_input (jack_port_t *port);
758 * Establish a connection between two ports.
760 * When a connection exists, data written to the source port will
761 * be available to be read at the destination port.
763 * @pre The port types must be identical.
765 * @pre The @ref JackPortFlags of the @a source_port must include @ref
766 * JackPortIsOutput.
768 * @pre The @ref JackPortFlags of the @a destination_port must include
769 * @ref JackPortIsInput.
771 * @return 0 on success, EEXIST if the connection is already made,
772 * otherwise a non-zero error code
774 int jack_connect (jack_client_t *,
775 const char *source_port,
776 const char *destination_port);
779 * Remove a connection between two ports.
781 * @pre The port types must be identical.
783 * @pre The @ref JackPortFlags of the @a source_port must include @ref
784 * JackPortIsOutput.
786 * @pre The @ref JackPortFlags of the @a destination_port must include
787 * @ref JackPortIsInput.
789 * @return 0 on success, otherwise a non-zero error code
791 int jack_disconnect (jack_client_t *,
792 const char *source_port,
793 const char *destination_port);
796 * Perform the same function as jack_disconnect() using port handles
797 * rather than names. This avoids the name lookup inherent in the
798 * name-based version.
800 * Clients connecting their own ports are likely to use this function,
801 * while generic connection clients (e.g. patchbays) would use
802 * jack_disconnect().
804 int jack_port_disconnect (jack_client_t *, jack_port_t *);
807 * @return the maximum number of characters in a full JACK port name
808 * including the final NULL character. This value is a constant.
810 * A port's full name contains the owning client name concatenated
811 * with a colon (:) followed by its short name and a NULL
812 * character.
814 int jack_port_name_size(void);
817 * @return the maximum number of characters in a JACK port type name
818 * including the final NULL character. This value is a constant.
820 int jack_port_type_size(void);
821 /*@}*/
824 * @defgroup PortSearching Looking up ports
825 * @{
829 * @param port_name_pattern A regular expression used to select
830 * ports by name. If NULL or of zero length, no selection based
831 * on name will be carried out.
832 * @param type_name_pattern A regular expression used to select
833 * ports by type. If NULL or of zero length, no selection based
834 * on type will be carried out.
835 * @param flags A value used to select ports by their flags.
836 * If zero, no selection based on flags will be carried out.
838 * @return a NULL-terminated array of ports that match the specified
839 * arguments. The caller is responsible for calling free(3) any
840 * non-NULL returned value.
842 * @see jack_port_name_size(), jack_port_type_size()
844 const char **jack_get_ports (jack_client_t *,
845 const char *port_name_pattern,
846 const char *type_name_pattern,
847 unsigned long flags);
850 * @return address of the jack_port_t named @a port_name.
852 * @see jack_port_name_size()
854 jack_port_t *jack_port_by_name (jack_client_t *, const char *port_name);
857 * @return address of the jack_port_t of a @a port_id.
859 jack_port_t *jack_port_by_id (jack_client_t *client,
860 jack_port_id_t port_id);
862 /*@}*/
866 * @defgroup TimeFunctions Handling time
867 * @{
871 * @return the time in frames that has passed since the JACK server
872 * began the current process cycle.
874 jack_nframes_t jack_frames_since_cycle_start (const jack_client_t *);
877 * @return an estimate of the current time in frames. This is a
878 * running counter, no significance should be attached to its value,
879 * but it can be compared to a previously returned value.
881 jack_nframes_t jack_frame_time (const jack_client_t *);
884 * @return the frame_time after the last processing of the graph
885 * this is only to be used from the process callback.
887 * This function can be used to put timestamps generated by
888 * jack_frame_time() in correlation to the current process cycle.
890 jack_nframes_t jack_last_frame_time (const jack_client_t *client);
893 * @return estimated time in microseconds of the specified frame time
895 jack_time_t jack_frames_to_time(const jack_client_t *client, jack_nframes_t);
898 * @return estimated time in frames for the specified system time.
900 jack_nframes_t jack_time_to_frames(const jack_client_t *client, jack_time_t);
903 * @return return JACK's current system time in microseconds,
904 * using JACK clock source.
906 * The value returned is guaranteed to be monotonic, but not linear.
908 * This function is a client version of jack_get_microseconds().
910 jack_time_t jack_get_time();
912 /*@}*/
915 * @defgroup ErrorOutput Controlling error/information output
917 /*@{*/
920 * Display JACK error message.
922 * Set via jack_set_error_function(), otherwise a JACK-provided
923 * default will print @a msg (plus a newline) to stderr.
925 * @param msg error message text (no newline at end).
927 extern void (*jack_error_callback)(const char *msg);
930 * Set the @ref jack_error_callback for error message display.
932 * The JACK library provides two built-in callbacks for this purpose:
933 * default_jack_error_callback() and silent_jack_error_callback().
935 void jack_set_error_function (void (*func)(const char *));
938 * Display JACK info message.
940 * Set via jack_set_info_function(), otherwise a JACK-provided
941 * default will print @a msg (plus a newline) to stdout.
943 * @param msg info message text (no newline at end).
945 extern void (*jack_info_callback)(const char *msg);
948 * Set the @ref jack_info_callback for info message display.
950 void jack_set_info_function (void (*func)(const char *));
951 /*@}*/
953 #ifdef __cplusplus
955 #endif
957 #endif /* __jack_h__ */