JACK-AUDIO-CONNECTION-KIT  0.124.1
jack.h
Go to the documentation of this file.
00001 /*
00002     Copyright (C) 2001 Paul Davis
00003     Copyright (C) 2004 Jack O'Quin
00004     
00005     This program is free software; you can redistribute it and/or modify
00006     it under the terms of the GNU Lesser General Public License as published by
00007     the Free Software Foundation; either version 2.1 of the License, or
00008     (at your option) any later version.
00009     
00010     This program is distributed in the hope that it will be useful,
00011     but WITHOUT ANY WARRANTY; without even the implied warranty of
00012     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013     GNU Lesser General Public License for more details.
00014     
00015     You should have received a copy of the GNU Lesser General Public License
00016     along with this program; if not, write to the Free Software 
00017     Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
00018 
00019 */
00020 
00021 #ifndef __jack_h__
00022 #define __jack_h__
00023 
00024 #ifdef __cplusplus
00025 extern "C" {
00026 #endif
00027 
00028 #include <jack/types.h>
00029 #include <jack/transport.h>
00030 
00036 /*************************************************************
00037  * NOTE: JACK_WEAK_EXPORT ***MUST*** be used on every function
00038  * added to the JACK API after the 0.116.2 release.
00039  * 
00040  * Functions that predate this release are marked with 
00041  * JACK_WEAK_OPTIONAL_EXPORT which can be defined at compile
00042  * time in a variety of ways. The default definition is empty,
00043  * so that these symbols get normal linkage. If you wish to
00044  * use all JACK symbols with weak linkage, include 
00045  * <jack/weakjack.h> before jack.h.
00046  *************************************************************/
00047 
00048 #include <jack/weakmacros.h>
00049 
00088 jack_client_t *jack_client_open (const char *client_name,
00089                                  jack_options_t options,
00090                                  jack_status_t *status, ...) JACK_OPTIONAL_WEAK_EXPORT;
00091 
00097 jack_client_t *jack_client_new (const char *client_name) JACK_OPTIONAL_WEAK_DEPRECATED_EXPORT;
00098 
00104 int jack_client_close (jack_client_t *client) JACK_OPTIONAL_WEAK_EXPORT;
00105 
00110 int jack_client_name_size (void) JACK_OPTIONAL_WEAK_EXPORT;
00111 
00118 char *jack_get_client_name (jack_client_t *client) JACK_OPTIONAL_WEAK_EXPORT;
00119 
00130 char *jack_get_uuid_for_client_name (jack_client_t *client,
00131                                      const char    *name) JACK_WEAK_EXPORT;
00132 
00142 char *jack_get_client_name_by_uuid (jack_client_t *client,
00143                                     const char    *uuid ) JACK_WEAK_EXPORT;
00144 
00166 int jack_internal_client_new (const char *client_name,
00167                               const char *load_name,
00168                               const char *load_init) JACK_OPTIONAL_WEAK_DEPRECATED_EXPORT;
00169 
00175 void jack_internal_client_close (const char *client_name) JACK_OPTIONAL_WEAK_DEPRECATED_EXPORT;
00176 
00183 int jack_activate (jack_client_t *client) JACK_OPTIONAL_WEAK_EXPORT;
00184 
00192 int jack_deactivate (jack_client_t *client) JACK_OPTIONAL_WEAK_EXPORT;
00193 
00198 jack_native_thread_t jack_client_thread_id (jack_client_t *) JACK_OPTIONAL_WEAK_EXPORT;
00199 
00209 int jack_is_realtime (jack_client_t *client) JACK_OPTIONAL_WEAK_EXPORT;
00210 
00223 jack_nframes_t jack_thread_wait (jack_client_t*, int status) JACK_OPTIONAL_WEAK_DEPRECATED_EXPORT;
00224 
00232 jack_nframes_t jack_cycle_wait (jack_client_t* client) JACK_OPTIONAL_WEAK_EXPORT;
00233         
00240 void jack_cycle_signal (jack_client_t* client, int status) JACK_OPTIONAL_WEAK_EXPORT;
00241         
00253 int jack_set_process_thread(jack_client_t* client, JackThreadCallback fun, void *arg) JACK_OPTIONAL_WEAK_EXPORT;
00254 
00273 int jack_set_thread_init_callback (jack_client_t *client,
00274                                    JackThreadInitCallback thread_init_callback,
00275                                    void *arg) JACK_OPTIONAL_WEAK_EXPORT;
00276 
00300 void jack_on_shutdown (jack_client_t *client,
00301                        JackShutdownCallback function, void *arg) JACK_OPTIONAL_WEAK_EXPORT;
00302 
00326 void jack_on_info_shutdown (jack_client_t *client,
00327                             JackInfoShutdownCallback function, void *arg) JACK_WEAK_EXPORT;
00328 
00342 int jack_set_process_callback (jack_client_t *client,
00343                                JackProcessCallback process_callback,
00344                                void *arg) JACK_OPTIONAL_WEAK_EXPORT;
00345 
00355 int jack_set_freewheel_callback (jack_client_t *client,
00356                                  JackFreewheelCallback freewheel_callback,
00357                                  void *arg) JACK_OPTIONAL_WEAK_EXPORT;
00358 
00371 int jack_set_buffer_size_callback (jack_client_t *client,
00372                                    JackBufferSizeCallback bufsize_callback,
00373                                    void *arg) JACK_OPTIONAL_WEAK_EXPORT;
00374 
00381 int jack_set_sample_rate_callback (jack_client_t *client,
00382                                    JackSampleRateCallback srate_callback,
00383                                    void *arg) JACK_OPTIONAL_WEAK_EXPORT;
00384 
00391 int jack_set_client_registration_callback (jack_client_t *,
00392                                            JackClientRegistrationCallback
00393                                            registration_callback, void *arg) JACK_OPTIONAL_WEAK_EXPORT;
00394         
00401 int jack_set_port_registration_callback (jack_client_t *,
00402                                          JackPortRegistrationCallback
00403                                          registration_callback, void *arg) JACK_OPTIONAL_WEAK_EXPORT;
00404 
00405 
00412 int jack_set_port_rename_callback (jack_client_t *,
00413                                    JackPortRenameCallback
00414                                    rename_callback, void *arg) JACK_OPTIONAL_WEAK_EXPORT;
00415 
00422 int jack_set_port_connect_callback (jack_client_t *,
00423                                     JackPortConnectCallback
00424                                     connect_callback, void *arg) JACK_OPTIONAL_WEAK_EXPORT;
00431 int jack_set_graph_order_callback (jack_client_t *,
00432                                    JackGraphOrderCallback graph_callback,
00433                                    void *) JACK_OPTIONAL_WEAK_EXPORT;
00434 
00441 int jack_set_xrun_callback (jack_client_t *,
00442                             JackXRunCallback xrun_callback, void *arg) JACK_OPTIONAL_WEAK_EXPORT;
00443 
00497 int jack_set_latency_callback (jack_client_t *,
00498                                JackLatencyCallback latency_callback,
00499                                void *) JACK_WEAK_EXPORT;
00531 int jack_set_freewheel(jack_client_t* client, int onoff) JACK_OPTIONAL_WEAK_EXPORT;
00532 
00548 int jack_set_buffer_size (jack_client_t *client, jack_nframes_t nframes) JACK_OPTIONAL_WEAK_EXPORT;
00549 
00554 jack_nframes_t jack_get_sample_rate (jack_client_t *) JACK_OPTIONAL_WEAK_EXPORT;
00555 
00565 jack_nframes_t jack_get_buffer_size (jack_client_t *) JACK_OPTIONAL_WEAK_EXPORT;
00566 
00577 int  jack_engine_takeover_timebase (jack_client_t *) JACK_OPTIONAL_WEAK_DEPRECATED_EXPORT;
00578 
00585 float jack_cpu_load (jack_client_t *client) JACK_OPTIONAL_WEAK_EXPORT;
00586         
00587 
00624 jack_port_t *jack_port_register (jack_client_t *client,
00625                                  const char *port_name,
00626                                  const char *port_type,
00627                                  unsigned long flags,
00628                                  unsigned long buffer_size) JACK_OPTIONAL_WEAK_EXPORT;
00629 
00636 int jack_port_unregister (jack_client_t *, jack_port_t *) JACK_OPTIONAL_WEAK_EXPORT;
00637 
00649 void *jack_port_get_buffer (jack_port_t *, jack_nframes_t) JACK_OPTIONAL_WEAK_EXPORT;
00650 
00657 const char *jack_port_name (const jack_port_t *port) JACK_OPTIONAL_WEAK_EXPORT;
00658 
00664 jack_uuid_t jack_port_uuid (const jack_port_t *port) JACK_OPTIONAL_WEAK_EXPORT;
00665 
00672 const char *jack_port_short_name (const jack_port_t *port) JACK_OPTIONAL_WEAK_EXPORT;
00673 
00677 int jack_port_flags (const jack_port_t *port) JACK_OPTIONAL_WEAK_EXPORT;
00678 
00683 const char *jack_port_type (const jack_port_t *port) JACK_OPTIONAL_WEAK_EXPORT;
00684 
00688 int jack_port_is_mine (const jack_client_t *, const jack_port_t *port) JACK_OPTIONAL_WEAK_EXPORT;
00689 
00695 int jack_port_connected (const jack_port_t *port) JACK_OPTIONAL_WEAK_EXPORT;
00696 
00703 int jack_port_connected_to (const jack_port_t *port,
00704                             const char *port_name) JACK_OPTIONAL_WEAK_EXPORT;
00705 
00717 const char **jack_port_get_connections (const jack_port_t *port) JACK_OPTIONAL_WEAK_EXPORT;
00718 
00738 const char **jack_port_get_all_connections (const jack_client_t *client,
00739                                             const jack_port_t *port) JACK_OPTIONAL_WEAK_EXPORT;
00740 
00748 int  jack_port_tie (jack_port_t *src, jack_port_t *dst) JACK_OPTIONAL_WEAK_DEPRECATED_EXPORT;
00749 
00757 int  jack_port_untie (jack_port_t *port) JACK_OPTIONAL_WEAK_DEPRECATED_EXPORT;
00758 
00766 int jack_port_set_name (jack_port_t *port, const char *port_name) JACK_OPTIONAL_WEAK_EXPORT;
00767 
00781 int jack_port_set_alias (jack_port_t *port, const char *alias) JACK_OPTIONAL_WEAK_EXPORT;
00782 
00791 int jack_port_unset_alias (jack_port_t *port, const char *alias) JACK_OPTIONAL_WEAK_EXPORT;
00792 
00793 /*
00794  * Get any aliases known for @port.
00795  *
00796  * @return the number of aliases discovered for the port
00797  */
00798 int jack_port_get_aliases (const jack_port_t *port, char* const aliases[2]) JACK_OPTIONAL_WEAK_EXPORT;
00799 
00804 int jack_port_request_monitor (jack_port_t *port, int onoff) JACK_OPTIONAL_WEAK_EXPORT;
00805 
00814 int jack_port_request_monitor_by_name (jack_client_t *client,
00815                                        const char *port_name, int onoff) JACK_OPTIONAL_WEAK_EXPORT;
00816 
00824 int jack_port_ensure_monitor (jack_port_t *port, int onoff) JACK_OPTIONAL_WEAK_EXPORT;
00825 
00829 int jack_port_monitoring_input (jack_port_t *port) JACK_OPTIONAL_WEAK_EXPORT;
00830 
00848 int jack_connect (jack_client_t *,
00849                   const char *source_port,
00850                   const char *destination_port) JACK_OPTIONAL_WEAK_EXPORT;
00851 
00865 int jack_disconnect (jack_client_t *,
00866                      const char *source_port,
00867                      const char *destination_port) JACK_OPTIONAL_WEAK_EXPORT;
00868 
00878 int jack_port_disconnect (jack_client_t *, jack_port_t *) JACK_OPTIONAL_WEAK_EXPORT;
00879 
00888 int jack_port_name_size(void) JACK_OPTIONAL_WEAK_EXPORT;
00889 
00894 int jack_port_type_size(void) JACK_OPTIONAL_WEAK_EXPORT;
00895 
00901 size_t jack_port_type_get_buffer_size (jack_client_t *client, const char *port_type) JACK_WEAK_EXPORT;
00902 
00969 void jack_port_set_latency (jack_port_t *, jack_nframes_t) JACK_OPTIONAL_WEAK_DEPRECATED_EXPORT;
00970         
00980 void jack_port_get_latency_range (jack_port_t *port, jack_latency_callback_mode_t mode, jack_latency_range_t *range) JACK_WEAK_EXPORT;
00981 
01049 void jack_port_set_latency_range (jack_port_t *port, jack_latency_callback_mode_t mode, jack_latency_range_t *range) JACK_WEAK_EXPORT;
01050 
01064 int jack_recompute_total_latencies (jack_client_t*) JACK_OPTIONAL_WEAK_EXPORT;
01065 
01081 jack_nframes_t jack_port_get_latency (jack_port_t *port) JACK_OPTIONAL_WEAK_DEPRECATED_EXPORT;
01082 
01093 jack_nframes_t jack_port_get_total_latency (jack_client_t *,
01094                                             jack_port_t *port) JACK_OPTIONAL_WEAK_DEPRECATED_EXPORT;
01095 
01112 int jack_recompute_total_latency (jack_client_t*, jack_port_t* port) JACK_OPTIONAL_WEAK_DEPRECATED_EXPORT;
01113 
01137 const char **jack_get_ports (jack_client_t *, 
01138                              const char *port_name_pattern, 
01139                              const char *type_name_pattern, 
01140                              unsigned long flags) JACK_OPTIONAL_WEAK_EXPORT;
01141 
01147 jack_port_t *jack_port_by_name (jack_client_t *, const char *port_name) JACK_OPTIONAL_WEAK_EXPORT;
01148 
01152 jack_port_t *jack_port_by_id (jack_client_t *client,
01153                               jack_port_id_t port_id) JACK_OPTIONAL_WEAK_EXPORT;
01154 
01171 jack_nframes_t jack_frames_since_cycle_start (const jack_client_t *) JACK_OPTIONAL_WEAK_EXPORT;
01172 
01179 jack_nframes_t jack_frame_time (const jack_client_t *) JACK_OPTIONAL_WEAK_EXPORT;
01180 
01195 jack_nframes_t jack_last_frame_time (const jack_client_t *client) JACK_OPTIONAL_WEAK_EXPORT;
01196 
01240 int jack_get_cycle_times (const jack_client_t *client,
01241                           jack_nframes_t *current_frames,
01242                           jack_time_t    *current_usecs,
01243                           jack_time_t    *next_usecs,
01244                           float          *period_usecs) JACK_OPTIONAL_WEAK_EXPORT;
01245 
01249 jack_time_t jack_frames_to_time(const jack_client_t *client, jack_nframes_t) JACK_OPTIONAL_WEAK_EXPORT;
01250 
01254 jack_nframes_t jack_time_to_frames(const jack_client_t *client, jack_time_t) JACK_OPTIONAL_WEAK_EXPORT;
01255 
01262 jack_time_t jack_get_time() JACK_OPTIONAL_WEAK_EXPORT;
01263 
01270 
01279 extern void (*jack_error_callback)(const char *msg) JACK_OPTIONAL_WEAK_EXPORT;
01280 
01287 void jack_set_error_function (void (*func)(const char *)) JACK_OPTIONAL_WEAK_EXPORT;
01288 
01297 extern void (*jack_info_callback)(const char *msg) JACK_OPTIONAL_WEAK_EXPORT;
01298 
01302 void jack_set_info_function (void (*func)(const char *)) JACK_OPTIONAL_WEAK_EXPORT;
01312 void jack_free(void* ptr) JACK_OPTIONAL_WEAK_EXPORT;
01313 
01314 #ifdef __cplusplus
01315 }
01316 #endif
01317 
01318 #endif /* __jack_h__ */
01319