reorganize jack/jack.h to group related functions; add @defgroup to several headers...
[jack.git] / jack / jack.h
blobff940cdd087269c94644013b1a9862652d01bdc7
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);
608 * A client may call this on a pair of its own ports to
609 * semi-permanently wire them together. This means that
610 * a client that wants to direct-wire an input port to
611 * an output port can call this and then no longer
612 * have to worry about moving data between them. Any data
613 * arriving at the input port will appear automatically
614 * at the output port.
616 * The 'destination' port must be an output port. The 'source'
617 * port must be an input port. Both ports must belong to
618 * the same client. You cannot use this to tie ports between
619 * clients. That is what a connection is for.
621 * @return 0 on success, otherwise a non-zero error code
623 int jack_port_tie (jack_port_t *src, jack_port_t *dst);
626 * This undoes the effect of jack_port_tie(). The port
627 * should be same as the 'destination' port passed to
628 * jack_port_tie().
630 * @return 0 on success, otherwise a non-zero error code
632 int jack_port_untie (jack_port_t *port);
634 /**
635 * @return the time (in frames) between data being available or
636 * delivered at/to a port, and the time at which it arrived at or is
637 * delivered to the "other side" of the port. E.g. for a physical
638 * audio output port, this is the time between writing to the port and
639 * when the signal will leave the connector. For a physical audio
640 * input port, this is the time between the sound arriving at the
641 * connector and the corresponding frames being readable from the
642 * port.
644 jack_nframes_t jack_port_get_latency (jack_port_t *port);
647 * The maximum of the sum of the latencies in every
648 * connection path that can be drawn between the port and other
649 * ports with the @ref JackPortIsTerminal flag set.
651 jack_nframes_t jack_port_get_total_latency (jack_client_t *,
652 jack_port_t *port);
655 * The port latency is zero by default. Clients that control
656 * physical hardware with non-zero latency should call this
657 * to set the latency to its correct value. Note that the value
658 * should include any systemic latency present "outside" the
659 * physical hardware controlled by the client. For example,
660 * for a client controlling a digital audio interface connected
661 * to an external digital converter, the latency setting should
662 * include both buffering by the audio interface *and* the converter.
664 void jack_port_set_latency (jack_port_t *, jack_nframes_t);
667 * Request a complete recomputation of a port's total latency. This
668 * can be called by a client that has just changed the internal
669 * latency of its port using jack_port_set_latency
670 * and wants to ensure that all signal pathways in the graph
671 * are updated with respect to the values that will be returned
672 * by jack_port_get_total_latency.
674 * @return zero for successful execution of the request. non-zero
675 * otherwise.
677 int jack_recompute_total_latency (jack_client_t*, jack_port_t* port);
680 * Request a complete recomputation of all port latencies. This
681 * can be called by a client that has just changed the internal
682 * latency of its port using jack_port_set_latency
683 * and wants to ensure that all signal pathways in the graph
684 * are updated with respect to the values that will be returned
685 * by jack_port_get_total_latency. It allows a client
686 * to change multiple port latencies without triggering a
687 * recompute for each change.
689 * @return zero for successful execution of the request. non-zero
690 * otherwise.
692 int jack_recompute_total_latencies (jack_client_t*);
695 * Modify a port's short name. May be called at any time. If the
696 * resulting full name (including the @a "client_name:" prefix) is
697 * longer than jack_port_name_size(), it will be truncated.
699 * @return 0 on success, otherwise a non-zero error code.
701 int jack_port_set_name (jack_port_t *port, const char *port_name);
704 * Set @a alias as an alias for @a port. May be called at any time.
705 * If the alias is longer than jack_port_name_size(), it will be truncated.
707 * After a successful call, and until JACK exits or
708 * jack_port_unset_alias() is called, may be
709 * used as a alternate name for the port.
711 * Ports can have up to two aliases - if both are already
712 * set, this function will return an error.
714 * @return 0 on success, otherwise a non-zero error code.
716 int jack_port_set_alias (jack_port_t *port, const char *alias);
719 * Remove @a alias as an alias for @a port. May be called at any time.
721 * After a successful call, @a alias can no longer be
722 * used as a alternate name for the port.
724 * @return 0 on success, otherwise a non-zero error code.
726 int jack_port_unset_alias (jack_port_t *port, const char *alias);
729 * Get any aliases known for @port.
731 * @return the number of aliases discovered for the port
733 int jack_port_get_aliases (const jack_port_t *port, char* const aliases[2]);
736 * If @ref JackPortCanMonitor is set for this @a port, turn input
737 * monitoring on or off. Otherwise, do nothing.
739 int jack_port_request_monitor (jack_port_t *port, int onoff);
742 * If @ref JackPortCanMonitor is set for this @a port_name, turn input
743 * monitoring on or off. Otherwise, do nothing.
745 * @return 0 on success, otherwise a non-zero error code.
747 * @see jack_port_name_size()
749 int jack_port_request_monitor_by_name (jack_client_t *client,
750 const char *port_name, int onoff);
753 * If @ref JackPortCanMonitor is set for a port, this function turns
754 * on input monitoring if it was off, and turns it off if only one
755 * request has been made to turn it on. Otherwise it does nothing.
757 * @return 0 on success, otherwise a non-zero error code
759 int jack_port_ensure_monitor (jack_port_t *port, int onoff);
762 * @return TRUE if input monitoring has been requested for @a port.
764 int jack_port_monitoring_input (jack_port_t *port);
767 * Establish a connection between two ports.
769 * When a connection exists, data written to the source port will
770 * be available to be read at the destination port.
772 * @pre The port types must be identical.
774 * @pre The @ref JackPortFlags of the @a source_port must include @ref
775 * JackPortIsOutput.
777 * @pre The @ref JackPortFlags of the @a destination_port must include
778 * @ref JackPortIsInput.
780 * @return 0 on success, EEXIST if the connection is already made,
781 * otherwise a non-zero error code
783 int jack_connect (jack_client_t *,
784 const char *source_port,
785 const char *destination_port);
788 * Remove a connection between two ports.
790 * @pre The port types must be identical.
792 * @pre The @ref JackPortFlags of the @a source_port must include @ref
793 * JackPortIsOutput.
795 * @pre The @ref JackPortFlags of the @a destination_port must include
796 * @ref JackPortIsInput.
798 * @return 0 on success, otherwise a non-zero error code
800 int jack_disconnect (jack_client_t *,
801 const char *source_port,
802 const char *destination_port);
805 * Perform the same function as jack_disconnect() using port handles
806 * rather than names. This avoids the name lookup inherent in the
807 * name-based version.
809 * Clients connecting their own ports are likely to use this function,
810 * while generic connection clients (e.g. patchbays) would use
811 * jack_disconnect().
813 int jack_port_disconnect (jack_client_t *, jack_port_t *);
816 * @return the maximum number of characters in a full JACK port name
817 * including the final NULL character. This value is a constant.
819 * A port's full name contains the owning client name concatenated
820 * with a colon (:) followed by its short name and a NULL
821 * character.
823 int jack_port_name_size(void);
826 * @return the maximum number of characters in a JACK port type name
827 * including the final NULL character. This value is a constant.
829 int jack_port_type_size(void);
830 /*@}*/
833 * @defgroup PortSearching Looking up ports
834 * @{
838 * @param port_name_pattern A regular expression used to select
839 * ports by name. If NULL or of zero length, no selection based
840 * on name will be carried out.
841 * @param type_name_pattern A regular expression used to select
842 * ports by type. If NULL or of zero length, no selection based
843 * on type will be carried out.
844 * @param flags A value used to select ports by their flags.
845 * If zero, no selection based on flags will be carried out.
847 * @return a NULL-terminated array of ports that match the specified
848 * arguments. The caller is responsible for calling free(3) any
849 * non-NULL returned value.
851 * @see jack_port_name_size(), jack_port_type_size()
853 const char **jack_get_ports (jack_client_t *,
854 const char *port_name_pattern,
855 const char *type_name_pattern,
856 unsigned long flags);
859 * @return address of the jack_port_t named @a port_name.
861 * @see jack_port_name_size()
863 jack_port_t *jack_port_by_name (jack_client_t *, const char *port_name);
866 * @return address of the jack_port_t of a @a port_id.
868 jack_port_t *jack_port_by_id (jack_client_t *client,
869 jack_port_id_t port_id);
871 /*@}*/
875 * @defgroup TimeFunctions Handling time
876 * @{
880 * @return the time in frames that has passed since the JACK server
881 * began the current process cycle.
883 jack_nframes_t jack_frames_since_cycle_start (const jack_client_t *);
886 * @return an estimate of the current time in frames. This is a
887 * running counter, no significance should be attached to its value,
888 * but it can be compared to a previously returned value.
890 jack_nframes_t jack_frame_time (const jack_client_t *);
893 * @return the frame_time after the last processing of the graph
894 * this is only to be used from the process callback.
896 * This function can be used to put timestamps generated by
897 * jack_frame_time() in correlation to the current process cycle.
899 jack_nframes_t jack_last_frame_time (const jack_client_t *client);
902 * @return estimated time in microseconds of the specified frame time
904 jack_time_t jack_frames_to_time(const jack_client_t *client, jack_nframes_t);
907 * @return estimated time in frames for the specified system time.
909 jack_nframes_t jack_time_to_frames(const jack_client_t *client, jack_time_t);
912 * @return return JACK's current system time in microseconds,
913 * using JACK clock source.
915 * The value returned is guaranteed to be monotonic, but not linear.
917 * This function is a client version of jack_get_microseconds().
919 jack_time_t jack_get_time();
921 /*@}*/
924 * @defgroup ErrorOutput Controlling error/information output
926 /*@{*/
929 * Display JACK error message.
931 * Set via jack_set_error_function(), otherwise a JACK-provided
932 * default will print @a msg (plus a newline) to stderr.
934 * @param msg error message text (no newline at end).
936 extern void (*jack_error_callback)(const char *msg);
939 * Set the @ref jack_error_callback for error message display.
941 * The JACK library provides two built-in callbacks for this purpose:
942 * default_jack_error_callback() and silent_jack_error_callback().
944 void jack_set_error_function (void (*func)(const char *));
947 * Display JACK info message.
949 * Set via jack_set_info_function(), otherwise a JACK-provided
950 * default will print @a msg (plus a newline) to stdout.
952 * @param msg info message text (no newline at end).
954 extern void (*jack_info_callback)(const char *msg);
957 * Set the @ref jack_info_callback for info message display.
959 void jack_set_info_function (void (*func)(const char *));
960 /*@}*/
962 #ifdef __cplusplus
964 #endif
966 #endif /* __jack_h__ */