Ardour  9.0-pre0-582-g084a23a80d
weak_libjack.h
Go to the documentation of this file.
1 /* runtime/weak dynamic JACK linking
2  *
3  * (C) 2014 Robin Gareus <robin@gareus.org>
4  *
5  * The wrapped jack API itself is
6  * (C) 2001 Paul Davis
7  * (C) 2004 Jack O'Quin
8  *
9  * This program is free software; you can redistribute it and/or modify
10  * it under the terms of the GNU General Public License as published by
11  * the Free Software Foundation; either version 2 of the License, or
12  * (at your option) any later version.
13  *
14  * This program is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17  * GNU General Public License for more details.
18  *
19  * You should have received a copy of the GNU General Public License along
20  * with this program; if not, write to the Free Software Foundation, Inc.,
21  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
22  */
23 #ifndef _WEAK_JACK_H
24 #define _WEAK_JACK_H
25 
26 #ifdef __cplusplus
27 extern "C"
28 {
29 #endif
30 
42 int have_libjack(void);
43 
44 #ifdef __cplusplus
45 }
46 #endif
47 
48 #ifdef USE_WEAK_JACK
49 
50 /* <jack/jack.h> */
51 #define jack_client_close WJACK_client_close
52 #define jack_get_client_name WJACK_get_client_name
53 #define jack_get_sample_rate WJACK_get_sample_rate
54 #define jack_get_buffer_size WJACK_get_buffer_size
55 #define jack_frames_since_cycle_start WJACK_frames_since_cycle_start
56 #define jack_frame_time WJACK_frame_time
57 #define jack_last_frame_time WJACK_last_frame_time
58 #define jack_get_time WJACK_get_time
59 #define jack_cpu_load WJACK_cpu_load
60 #define jack_is_realtime WJACK_is_realtime
61 
62 #define jack_client_name_size WJACK_client_name_size
63 
64 #define jack_set_freewheel WJACK_set_freewheel
65 #define jack_set_buffer_size WJACK_set_buffer_size
66 
67 #define jack_on_shutdown WJACK_on_shutdown
68 #define jack_on_info_shutdown WJACK_on_info_shutdown
69 #define jack_set_process_callback WJACK_set_process_callback
70 #define jack_set_freewheel_callback WJACK_set_freewheel_callback
71 #define jack_set_buffer_size_callback WJACK_set_buffer_size_callback
72 #define jack_set_sample_rate_callback WJACK_set_sample_rate_callback
73 #define jack_set_port_registration_callback WJACK_set_port_registration_callback
74 #define jack_set_port_connect_callback WJACK_set_port_connect_callback
75 #define jack_set_graph_order_callback WJACK_set_graph_order_callback
76 #define jack_set_xrun_callback WJACK_set_xrun_callback
77 #define jack_set_latency_callback WJACK_set_latency_callback
78 #define jack_set_error_function WJACK_set_error_function
79 #define jack_set_info_function WJACK_set_info_function
80 
81 #define jack_activate WJACK_activate
82 #define jack_deactivate WJACK_deactivate
83 
84 #define jack_recompute_total_latencies WJACK_recompute_total_latencies
85 #define jack_port_get_total_latency WJACK_port_get_total_latency
86 #define jack_port_get_latency_range WJACK_port_get_latency_range
87 #define jack_port_set_latency_range WJACK_port_set_latency_range
88 #define jack_port_get_buffer WJACK_port_get_buffer
89 #define jack_port_request_monitor WJACK_port_request_monitor
90 #define jack_port_ensure_monitor WJACK_port_ensure_monitor
91 #define jack_port_monitoring_input WJACK_port_monitoring_input
92 
93 #define jack_port_name WJACK_port_name
94 #define jack_port_short_name WJACK_port_short_name
95 #define jack_port_flags WJACK_port_flags
96 #define jack_port_is_mine WJACK_port_is_mine
97 #define jack_port_connected WJACK_port_connected
98 #define jack_get_ports WJACK_get_ports
99 #define jack_port_name_size WJACK_port_name_size
100 #define jack_port_type_size WJACK_port_type_size
101 #define jack_port_type_get_buffer_size WJACK_port_type_get_buffer_size
102 #define jack_port_by_name WJACK_port_by_name
103 #define jack_port_by_id WJACK_port_by_id
104 #define jack_port_set_name WJACK_port_set_name
105 #define jack_port_get_aliases WJACK_port_get_aliases
106 #define jack_port_rename WJACK_port_rename
107 #define jack_port_disconnect WJACK_port_disconnect
108 #define jack_port_register WJACK_port_register
109 #define jack_port_unregister WJACK_port_unregister
110 #define jack_port_type WJACK_port_type
111 #define jack_port_get_connections WJACK_port_get_connections
112 #define jack_port_get_all_connections WJACK_port_get_all_connections
113 #define jack_connect WJACK_connect
114 #define jack_disconnect WJACK_disconnect
115 #define jack_free WJACK_free
116 
117 #define jack_cycle_wait WJACK_cycle_wait
118 #define jack_cycle_signal WJACK_cycle_signal
119 #define jack_set_process_thread WJACK_set_process_thread
120 #define jack_set_thread_init_callback WJACK_set_thread_init_callback
121 
122 /* <jack/transport.h> */
123 #define jack_get_current_transport_frame WJACK_get_current_transport_frame
124 #define jack_transport_locate WJACK_transport_locate
125 #define jack_transport_start WJACK_transport_start
126 #define jack_transport_stop WJACK_transport_stop
127 #define jack_transport_query WJACK_transport_query
128 #define jack_set_sync_callback WJACK_set_sync_callback
129 #define jack_set_timebase_callback WJACK_set_timebase_callback
130 #define jack_release_timebase WJACK_release_timebase
131 
132 /* <jack/midiport.h> */
133 #define jack_midi_get_event_count WJACK_midi_get_event_count
134 #define jack_midi_event_get WJACK_midi_event_get
135 #define jack_midi_event_write WJACK_midi_event_write
136 #define jack_midi_clear_buffer WJACK_midi_clear_buffer
137 
138 /* <jack/session.h> */
139 #define jack_set_session_callback WJACK_set_session_callback
140 #define jack_session_reply WJACK_session_reply
141 #define jack_session_event_free WJACK_session_event_free
142 
143 /* <jack/ringbuffer.h> */
144 #define jack_ringbuffer_create WJACK_ringbuffer_create
145 #define jack_ringbuffer_free WJACK_ringbuffer_free
146 #define jack_ringbuffer_reset WJACK_ringbuffer_reset
147 #define jack_ringbuffer_read_advance WJACK_ringbuffer_read_advance
148 #define jack_ringbuffer_write_advance WJACK_ringbuffer_write_advance
149 #define jack_ringbuffer_read_space WJACK_ringbuffer_read_space
150 #define jack_ringbuffer_write_space WJACK_ringbuffer_write_space
151 #define jack_ringbuffer_read WJACK_ringbuffer_read
152 #define jack_ringbuffer_write WJACK_ringbuffer_write
153 #define jack_ringbuffer_mlock WJACK_ringbuffer_mlock
154 #define jack_ringbuffer_get_read_vector WJACK_ringbuffer_get_read_vector
155 #define jack_ringbuffer_get_write_vector WJACK_ringbuffer_get_write_vector
156 #define jack_ringbuffer_peek WJACK_ringbuffer_peek
157 
158 /* <jack/thread.h> */
159 #define jack_client_real_time_priority WJACK_client_real_time_priority
160 #define jack_client_max_real_time_priority WJACK_client_max_real_time_priority
161 #define jack_acquire_real_time_scheduling WJACK_acquire_real_time_scheduling
162 #define jack_client_create_thread WJACK_client_create_thread
163 #define jack_drop_real_time_scheduling WJACK_drop_real_time_scheduling
164 #define jack_client_stop_thread WJACK_client_stop_thread
165 #define jack_client_kill_thread WJACK_client_kill_thread
166 #define jack_set_thread_creator WJACK_set_thread_creator
167 
168 #define jack_client_open WJACK_client_client_openXXX
169 
170 #ifdef HAVE_JACK_METADATA
171 /* <jack/metadata.h> */
172 #define jack_get_uuid_for_client_name WJACK_get_uuid_for_client_name
173 #define jack_get_client_name_by_uuid WJACK_get_client_name_by_uuid
174 #define jack_port_uuid WJACK_port_uuid
175 
176 #define jack_set_property WJACK_set_property
177 #define jack_get_property WJACK_get_property
178 #define jack_free_description WJACK_free_description
179 #define jack_get_properties WJACK_get_properties
180 #define jack_get_all_properties WJACK_get_all_properties
181 #define jack_remove_property WJACK_remove_property
182 #define jack_remove_properties WJACK_remove_properties
183 #define jack_remove_all_properties WJACK_remove_all_properties
184 #define jack_set_property_change_callback WJACK_set_property_change_callback
185 #endif
186 
187 /* <jack/statistics.h> */
188 #define jack_get_max_delayed_usecs WJACK_get_max_delayed_usecs
189 #define jack_get_xrun_delayed_usecs WJACK_get_xrun_delayed_usecs
190 #define jack_reset_max_delayed_usecs WJACK_reset_max_delayed_usecs
191 
192 #endif // end USE_WEAK_JACK
193 
194 #include <jack/jack.h>
195 #include <jack/transport.h>
196 #include <jack/ringbuffer.h>
197 #include <jack/midiport.h>
198 #include <jack/session.h>
199 #include <jack/thread.h>
200 #include <jack/statistics.h>
201 
202 #ifdef HAVE_JACK_METADATA
203 #include <jack/metadata.h>
204 #endif
205 
206 // prototype for function which is not available in older jack headers
207 #ifdef __cplusplus
208 extern "C" {
209 #endif
210  int jack_port_rename (jack_client_t* client, jack_port_t *port, const char *port_name);
211 #ifdef __cplusplus
212 }
213 #endif
214 
215 #ifdef USE_WEAK_JACK
216 
217 #undef jack_client_open
218 
219 /* var-args hack */
220 
221 #ifdef __cplusplus
222 extern "C" {
223 #endif
224 void (* WJACK_get_client_open (void)) (void);
225 jack_client_t * WJACK_no_client_open (const char *client_name, jack_options_t options, jack_status_t *status, ...);
226 #ifdef __cplusplus
227 }
228 #endif
229 
230 #define jack_client_open(...) \
231 ( \
232  (WJACK_get_client_open() != NULL) \
233  ? ((jack_client_t* (*)(const char *, jack_options_t, jack_status_t *, ...))(WJACK_get_client_open()))(__VA_ARGS__) \
234  : WJACK_no_client_open(__VA_ARGS__) \
235 )
236 
237 #endif // end USE_WEAK_JACK
238 
239 #endif // _WEAK_JACK_H
int jack_port_rename(jack_client_t *client, jack_port_t *port, const char *port_name)
int have_libjack(void)