# 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 <pthread.h>
    00029
    00030 #include <jack/types.h>
    00031 #include <jack/transport.h>
    00032
    00075 jack_client_t *jack_client_open (const char *client_name,
    00076                                  jack_options_t options,
    00077                                  jack_status_t *status, ...);
    00078
    00084 jack_client_t *jack_client_new (const char *client_name);
    00085
    00091 int jack_client_close (jack_client_t *client);
    00092
    00097 int jack_client_name_size (void);
    00098
    00105 char *jack_get_client_name (jack_client_t *client);
    00106
    00128 int jack_internal_client_new (const char *client_name,
    00129                               const char *load_name,
    00130                               const char *load_init);
    00131
    00137 void jack_internal_client_close (const char *client_name);
    00138
    00145 int jack_activate (jack_client_t *client);
    00146
    00154 int jack_deactivate (jack_client_t *client);
    00155
    00160 pthread_t jack_client_thread_id (jack_client_t *);
    00161
    00171 int jack_is_realtime (jack_client_t *client);
    00172
    00185 jack_nframes_t jack_thread_wait (jack_client_t*, int status);
    00186
    00194 jack_nframes_t jack_cycle_wait (jack_client_t* client);
    00195
    00202 void jack_cycle_signal (jack_client_t* client, int status);
    00203
    00217 int jack_set_process_thread(jack_client_t* client, JackThreadCallback fun, void *arg);
    00218
    00237 int jack_set_thread_init_callback (jack_client_t *client,
    00238                                    JackThreadInitCallback thread_init_callback,
    00239                                    void *arg);
    00240
    00259 void jack_on_shutdown (jack_client_t *client,
    00260                        void (*function)(void *arg), void *arg);
    00261
    00277 int jack_set_process_callback (jack_client_t *client,
    00278                                JackProcessCallback process_callback,
    00279                                void *arg);
    00280
    00290 int jack_set_freewheel_callback (jack_client_t *client,
    00291                                  JackFreewheelCallback freewheel_callback,
    00292                                  void *arg);
    00293
    00306 int jack_set_buffer_size_callback (jack_client_t *client,
    00307                                    JackBufferSizeCallback bufsize_callback,
    00308                                    void *arg);
    00309
    00316 int jack_set_sample_rate_callback (jack_client_t *client,
    00317                                    JackSampleRateCallback srate_callback,
    00318                                    void *arg);
    00319
    00326 int jack_set_client_registration_callback (jack_client_t *,
    00327                                            JackClientRegistrationCallback
    00328                                            registration_callback, void *arg);
    00329
    00336 int jack_set_port_registration_callback (jack_client_t *,
    00337                                          JackPortRegistrationCallback
    00338                                          registration_callback, void *arg);
    00339
    00346 int jack_set_port_connect_callback (jack_client_t *,
    00347                                     JackPortConnectCallback
    00348                                     connect_callback, void *arg);
    00355 int jack_set_graph_order_callback (jack_client_t *,
    00356                                    JackGraphOrderCallback graph_callback,
    00357                                    void *);
    00358
    00365 int jack_set_xrun_callback (jack_client_t *,
    00366                             JackXRunCallback xrun_callback, void *arg);
    00367
    00399 int jack_set_freewheel(jack_client_t* client, int onoff);
    00400
    00416 int jack_set_buffer_size (jack_client_t *client, jack_nframes_t nframes);
    00417
    00422 jack_nframes_t jack_get_sample_rate (jack_client_t *);
    00423
    00433 jack_nframes_t jack_get_buffer_size (jack_client_t *);
    00434
    00445 int  jack_engine_takeover_timebase (jack_client_t *);
    00446
    00453 float jack_cpu_load (jack_client_t *client);
    00454
    00455
    00489 jack_port_t *jack_port_register (jack_client_t *client,
    00490                                  const char *port_name,
    00491                                  const char *port_type,
    00492                                  unsigned long flags,
    00493                                  unsigned long buffer_size);
    00494
    00501 int jack_port_unregister (jack_client_t *, jack_port_t *);
    00502
    00522 void *jack_port_get_buffer (jack_port_t *, jack_nframes_t);
    00523
    00530 const char *jack_port_name (const jack_port_t *port);
    00531
    00538 const char *jack_port_short_name (const jack_port_t *port);
    00539
    00543 int jack_port_flags (const jack_port_t *port);
    00544
    00549 const char *jack_port_type (const jack_port_t *port);
    00550
    00554 int jack_port_is_mine (const jack_client_t *, const jack_port_t *port);
    00555
    00561 int jack_port_connected (const jack_port_t *port);
    00562
    00569 int jack_port_connected_to (const jack_port_t *port,
    00570                             const char *port_name);
    00571
    00583 const char **jack_port_get_connections (const jack_port_t *port);
    00584
    00604 const char **jack_port_get_all_connections (const jack_client_t *client,
    00605                                             const jack_port_t *port);
    00606
    00614 int  jack_port_tie (jack_port_t *src, jack_port_t *dst);
    00615
    00623 int  jack_port_untie (jack_port_t *port);
    00624
    00635 jack_nframes_t jack_port_get_latency (jack_port_t *port);
    00636
    00642 jack_nframes_t jack_port_get_total_latency (jack_client_t *,
    00643                                             jack_port_t *port);
    00644
    00655 void jack_port_set_latency (jack_port_t *, jack_nframes_t);
    00656
    00668 int jack_recompute_total_latency (jack_client_t*, jack_port_t* port);
    00669
    00683 int jack_recompute_total_latencies (jack_client_t*);
    00684
    00692 int jack_port_set_name (jack_port_t *port, const char *port_name);
    00693
    00707 int jack_port_set_alias (jack_port_t *port, const char *alias);
    00708
    00717 int jack_port_unset_alias (jack_port_t *port, const char *alias);
    00718
    00719 /*
    00720  * Get any aliases known for @port.
    00721  *
    00722  * @return the number of aliases discovered for the port
    00723  */
    00724 int jack_port_get_aliases (const jack_port_t *port, char* const aliases[2]);
    00725
    00730 int jack_port_request_monitor (jack_port_t *port, int onoff);
    00731
    00740 int jack_port_request_monitor_by_name (jack_client_t *client,
    00741                                        const char *port_name, int onoff);
    00742
    00750 int jack_port_ensure_monitor (jack_port_t *port, int onoff);
    00751
    00755 int jack_port_monitoring_input (jack_port_t *port);
    00756
    00774 int jack_connect (jack_client_t *,
    00775                   const char *source_port,
    00776                   const char *destination_port);
    00777
    00791 int jack_disconnect (jack_client_t *,
    00792                      const char *source_port,
    00793                      const char *destination_port);
    00794
    00804 int jack_port_disconnect (jack_client_t *, jack_port_t *);
    00805
    00814 int jack_port_name_size(void);
    00815
    00820 int jack_port_type_size(void);
    00844 const char **jack_get_ports (jack_client_t *,
    00845                              const char *port_name_pattern,
    00846                              const char *type_name_pattern,
    00847                              unsigned long flags);
    00848
    00854 jack_port_t *jack_port_by_name (jack_client_t *, const char *port_name);
    00855
    00859 jack_port_t *jack_port_by_id (jack_client_t *client,
    00860                               jack_port_id_t port_id);
    00861
    00874 jack_nframes_t jack_frames_since_cycle_start (const jack_client_t *);
    00875
    00881 jack_nframes_t jack_frame_time (const jack_client_t *);
    00882
    00890 jack_nframes_t jack_last_frame_time (const jack_client_t *client);
    00891
    00895 jack_time_t jack_frames_to_time(const jack_client_t *client, jack_nframes_t);
    00896
    00900 jack_nframes_t jack_time_to_frames(const jack_client_t *client, jack_time_t);
    00901
    00910 jack_time_t jack_get_time();
    00911
    00918
    00927 extern void (*jack_error_callback)(const char *msg);
    00928
    00935 void jack_set_error_function (void (*func)(const char *));
    00936
    00945 extern void (*jack_info_callback)(const char *msg);
    00946
    00950 void jack_set_info_function (void (*func)(const char *));
    00953 #ifdef __cplusplus
    00954 }
    00955 #endif
    00956
    00957 #endif /* __jack_h__ */