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_types_h__
22 #define __jack_types_h__
26 typedef int32_t jack_shmsize_t
;
29 * Type used to represent sample frame counts.
31 typedef uint32_t jack_nframes_t
;
34 * Maximum value that can be stored in jack_nframes_t
36 #define JACK_MAX_FRAMES (4294967295U) /* This should be UINT32_MAX, but
37 C++ has a problem with that. */
40 * Type used to represent the value of free running
41 * monotonic clock with units of microseconds.
43 typedef uint64_t jack_time_t
;
46 * Maximum size of @a load_init string passed to an internal client
47 * jack_initialize() function via jack_internal_client_load().
49 #define JACK_LOAD_INIT_LIMIT 1024
52 * jack_intclient_t is an opaque type representing a loaded internal
53 * client. You may only access it using the API provided in @ref
54 * intclient.h "<jack/intclient.h>".
56 typedef uint64_t jack_intclient_t
;
59 * jack_port_t is an opaque type. You may only access it using the
62 typedef struct _jack_port jack_port_t
;
65 * jack_client_t is an opaque type. You may only access it using the
68 typedef struct _jack_client jack_client_t
;
71 * Ports have unique ids. A port registration callback is the only
72 * place you ever need to know their value.
74 typedef uint32_t jack_port_id_t
;
77 * Prototype for the client supplied function that is called
78 * by the engine anytime there is work to be done.
80 * @pre nframes == jack_get_buffer_size()
81 * @pre nframes == pow(2,x)
83 * @param nframes number of frames to process
84 * @param arg pointer to a client supplied data
86 * @return zero on success, non-zero on error
88 typedef int (*JackProcessCallback
)(jack_nframes_t nframes
, void *arg
);
91 * Prototype for the client supplied function that is called
92 * once after the creation of the thread in which other
93 * callbacks will be made. Special thread characteristics
94 * can be set from this callback, for example. This is a
95 * highly specialized callback and most clients will not
96 * and should not use it.
98 * @param arg pointer to a client supplied structure
102 typedef void (*JackThreadInitCallback
)(void *arg
);
105 * Prototype for the client supplied function that is called
106 * whenever the processing graph is reordered.
108 * @param arg pointer to a client supplied data
110 * @return zero on success, non-zero on error
112 typedef int (*JackGraphOrderCallback
)(void *arg
);
115 * Prototype for the client-supplied function that is called whenever
116 * an xrun has occured.
118 * @see jack_get_xrun_delayed_usecs()
120 * @param arg pointer to a client supplied data
122 * @return zero on success, non-zero on error
124 typedef int (*JackXRunCallback
)(void *arg
);
127 * Prototype for the @a bufsize_callback that is invoked whenever the
128 * JACK engine buffer size changes. Although this function is called
129 * in the JACK process thread, the normal process cycle is suspended
130 * during its operation, causing a gap in the audio flow. So, the @a
131 * bufsize_callback can allocate storage, touch memory not previously
132 * referenced, and perform other operations that are not realtime
135 * @param nframes buffer size
136 * @param arg pointer supplied by jack_set_buffer_size_callback().
138 * @return zero on success, non-zero on error
140 typedef int (*JackBufferSizeCallback
)(jack_nframes_t nframes
, void *arg
);
143 * Prototype for the client supplied function that is called
144 * when the engine sample rate changes.
146 * @param nframes new engine sample rate
147 * @param arg pointer to a client supplied data
149 * @return zero on success, non-zero on error
151 typedef int (*JackSampleRateCallback
)(jack_nframes_t nframes
, void *arg
);
154 * Prototype for the client supplied function that is called
155 * whenever a port is registered or unregistered.
157 * @param port the ID of the port
158 * @param arg pointer to a client supplied data
159 * @param register non-zero if the port is being registered,
160 * zero if the port is being unregistered
162 typedef void (*JackPortRegistrationCallback
)(jack_port_id_t port
, int register, void *arg
);
165 * Prototype for the client supplied function that is called
166 * whenever a client is registered or unregistered.
168 * @param name a null-terminated string containing the client name
169 * @param register non-zero if the client is being registered,
170 * zero if the client is being unregistered
171 * @param arg pointer to a client supplied data
173 typedef void (*JackClientRegistrationCallback
)(const char* name
, int register, void *arg
);
176 * Prototype for the client supplied function that is called
177 * whenever a client is registered or unregistered.
179 * @param a one of two ports connected or disconnected
180 * @param b one of two ports connected or disconnected
181 * @param connect non-zero if ports were connected
182 * zero if ports were disconnected
183 * @param arg pointer to a client supplied data
185 typedef void (*JackPortConnectCallback
)(jack_port_id_t a
, jack_port_id_t b
, int connect
, void* arg
);
188 * Prototype for the client supplied function that is called
189 * whenever jackd starts or stops freewheeling.
191 * @param starting non-zero if we start starting to freewheel, zero otherwise
192 * @param arg pointer to a client supplied structure
194 typedef void (*JackFreewheelCallback
)(int starting
, void *arg
);
196 typedef void *(*JackThreadCallback
)(void* arg
);
199 * Used for the type argument of jack_port_register() for default
200 * audio and midi ports.
202 #define JACK_DEFAULT_AUDIO_TYPE "32 bit float mono audio"
203 #define JACK_DEFAULT_MIDI_TYPE "8 bit raw midi"
206 * For convenience, use this typedef if you want to be able to change
207 * between float and double. You may want to typedef sample_t to
208 * jack_default_audio_sample_t in your application.
210 typedef float jack_default_audio_sample_t
;
213 * A port has a set of flags that are formed by AND-ing together the
214 * desired values from the list below. The flags "JackPortIsInput" and
215 * "JackPortIsOutput" are mutually exclusive and it is an error to use
221 * if JackPortIsInput is set, then the port can receive
224 JackPortIsInput
= 0x1,
227 * if JackPortIsOutput is set, then data can be read from
230 JackPortIsOutput
= 0x2,
233 * if JackPortIsPhysical is set, then the port corresponds
234 * to some kind of physical I/O connector.
236 JackPortIsPhysical
= 0x4,
239 * if JackPortCanMonitor is set, then a call to
240 * jack_port_request_monitor() makes sense.
242 * Precisely what this means is dependent on the client. A typical
243 * result of it being called with TRUE as the second argument is
244 * that data that would be available from an output port (with
245 * JackPortIsPhysical set) is sent to a physical output connector
246 * as well, so that it can be heard/seen/whatever.
248 * Clients that do not control physical interfaces
249 * should never create ports with this bit set.
251 JackPortCanMonitor
= 0x8,
254 * JackPortIsTerminal means:
256 * for an input port: the data received by the port
257 * will not be passed on or made
258 * available at any other port
260 * for an output port: the data available at the port
261 * does not originate from any other port
263 * Audio synthesizers, I/O hardware interface clients, HDR
264 * systems are examples of clients that would set this flag for
267 JackPortIsTerminal
= 0x10
271 * @ref jack_options_t bits
276 * Null value to use when no option bits are needed.
278 JackNullOption
= 0x00,
281 * Do not automatically start the JACK server when it is not
282 * already running. This option is always selected if
283 * \$JACK_NO_START_SERVER is defined in the calling process
286 JackNoStartServer
= 0x01,
289 * Use the exact client name requested. Otherwise, JACK
290 * automatically generates a unique one, if needed.
292 JackUseExactName
= 0x02,
295 * Open with optional <em>(char *) server_name</em> parameter.
297 JackServerName
= 0x04,
300 * Load internal client from optional <em>(char *)
301 * load_name</em>. Otherwise use the @a client_name.
306 * Pass optional <em>(char *) load_init</em> string to the
307 * jack_initialize() entry point of an internal client.
312 /** Valid options for opening an external client. */
313 #define JackOpenOptions (JackServerName|JackNoStartServer|JackUseExactName)
315 /** Valid options for loading an internal client. */
316 #define JackLoadOptions (JackLoadInit|JackLoadName|JackUseExactName)
319 * Options for several JACK operations, formed by OR-ing together the
320 * relevant @ref JackOptions bits.
322 typedef enum JackOptions jack_options_t
;
325 * @ref jack_status_t bits
330 * Overall operation failed.
335 * The operation contained an invalid or unsupported option.
337 JackInvalidOption
= 0x02,
340 * The desired client name was not unique. With the @ref
341 * JackUseExactName option this situation is fatal. Otherwise,
342 * the name was modified by appending a dash and a two-digit
343 * number in the range "-01" to "-99". The
344 * jack_get_client_name() function will return the exact string
345 * that was used. If the specified @a client_name plus these
346 * extra characters would be too long, the open fails instead.
348 JackNameNotUnique
= 0x04,
351 * The JACK server was started as a result of this operation.
352 * Otherwise, it was running already. In either case the caller
353 * is now connected to jackd, so there is no race condition.
354 * When the server shuts down, the client will find out.
356 JackServerStarted
= 0x08,
359 * Unable to connect to the JACK server.
361 JackServerFailed
= 0x10,
364 * Communication error with the JACK server.
366 JackServerError
= 0x20,
369 * Requested client does not exist.
371 JackNoSuchClient
= 0x40,
374 * Unable to load internal client
376 JackLoadFailure
= 0x80,
379 * Unable to initialize client
381 JackInitFailure
= 0x100,
384 * Unable to access shared memory
386 JackShmFailure
= 0x200,
389 * Client's protocol version does not match
391 JackVersionError
= 0x400
395 * Status word returned from several JACK operations, formed by
396 * OR-ing together the relevant @ref JackStatus bits.
398 typedef enum JackStatus jack_status_t
;
400 #endif /* __jack_types_h__ */