Jack2  1.9.9
types.h
1 /*
2  Copyright (C) 2001 Paul Davis
3  Copyright (C) 2004 Jack O'Quin
4 
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.
9 
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.
14 
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.
18 
19 */
20 
21 #ifndef __jack_types_h__
22 #define __jack_types_h__
23 
24 #include <jack/systemdeps.h>
25 
26 typedef int32_t jack_shmsize_t;
27 
31 typedef uint32_t jack_nframes_t;
32 
36 #define JACK_MAX_FRAMES (4294967295U) /* This should be UINT32_MAX, but C++ has a problem with that. */
37 
42 typedef uint64_t jack_time_t;
43 
48 #define JACK_LOAD_INIT_LIMIT 1024
49 
55 typedef uint64_t jack_intclient_t;
56 
61 typedef struct _jack_port jack_port_t;
62 
67 typedef struct _jack_client jack_client_t;
68 
73 typedef uint32_t jack_port_id_t;
74 
75 typedef uint32_t jack_port_type_id_t;
76 
80 enum JackOptions {
81 
85  JackNullOption = 0x00,
86 
93  JackNoStartServer = 0x01,
94 
99  JackUseExactName = 0x02,
100 
104  JackServerName = 0x04,
105 
110  JackLoadName = 0x08,
111 
116  JackLoadInit = 0x10,
117 
121  JackSessionID = 0x20
122 };
123 
125 #define JackOpenOptions (JackSessionID|JackServerName|JackNoStartServer|JackUseExactName)
126 
128 #define JackLoadOptions (JackLoadInit|JackLoadName|JackUseExactName)
129 
134 typedef enum JackOptions jack_options_t;
135 
139 enum JackStatus {
140 
144  JackFailure = 0x01,
145 
149  JackInvalidOption = 0x02,
150 
160  JackNameNotUnique = 0x04,
161 
168  JackServerStarted = 0x08,
169 
173  JackServerFailed = 0x10,
174 
178  JackServerError = 0x20,
179 
183  JackNoSuchClient = 0x40,
184 
188  JackLoadFailure = 0x80,
189 
193  JackInitFailure = 0x100,
194 
198  JackShmFailure = 0x200,
199 
203  JackVersionError = 0x400,
204 
208  JackBackendError = 0x800,
209 
213  JackClientZombie = 0x1000
214 };
215 
220 typedef enum JackStatus jack_status_t;
221 
225 enum JackLatencyCallbackMode {
226 
232  JackCaptureLatency,
233 
239  JackPlaybackLatency
240 
241 };
242 
246 typedef enum JackLatencyCallbackMode jack_latency_callback_mode_t;
247 
257 typedef void (*JackLatencyCallback)(jack_latency_callback_mode_t mode, void *arg);
258 
262 PRE_PACKED_STRUCTURE
264 {
268  jack_nframes_t min;
272  jack_nframes_t max;
273 } POST_PACKED_STRUCTURE;
274 
276 
289 typedef int (*JackProcessCallback)(jack_nframes_t nframes, void *arg);
290 
298 typedef void *(*JackThreadCallback)(void* arg);
299 
312 typedef void (*JackThreadInitCallback)(void *arg);
313 
322 typedef int (*JackGraphOrderCallback)(void *arg);
323 
334 typedef int (*JackXRunCallback)(void *arg);
335 
350 typedef int (*JackBufferSizeCallback)(jack_nframes_t nframes, void *arg);
351 
361 typedef int (*JackSampleRateCallback)(jack_nframes_t nframes, void *arg);
362 
372 typedef void (*JackPortRegistrationCallback)(jack_port_id_t port, int register, void *arg);
373 
383 typedef void (*JackClientRegistrationCallback)(const char* name, int register, void *arg);
384 
395 typedef void (*JackPortConnectCallback)(jack_port_id_t a, jack_port_id_t b, int connect, void* arg);
396 
407 typedef int (*JackPortRenameCallback)(jack_port_id_t port, const char* old_name, const char* new_name, void *arg);
408 
416 typedef void (*JackFreewheelCallback)(int starting, void *arg);
417 
429 typedef void (*JackShutdownCallback)(void *arg);
430 
444 typedef void (*JackInfoShutdownCallback)(jack_status_t code, const char* reason, void *arg);
445 
450 #define JACK_DEFAULT_AUDIO_TYPE "32 bit float mono audio"
451 #define JACK_DEFAULT_MIDI_TYPE "8 bit raw midi"
452 
458 typedef float jack_default_audio_sample_t;
459 
466 enum JackPortFlags {
467 
472  JackPortIsInput = 0x1,
473 
478  JackPortIsOutput = 0x2,
479 
484  JackPortIsPhysical = 0x4,
485 
499  JackPortCanMonitor = 0x8,
500 
515  JackPortIsTerminal = 0x10,
516 
517 };
518 
522 typedef enum {
523 
524  /* the order matters for binary compatibility */
525  JackTransportStopped = 0,
526  JackTransportRolling = 1,
527  JackTransportLooping = 2,
528  JackTransportStarting = 3,
529  JackTransportNetStarting = 4,
531 } jack_transport_state_t;
532 
533 typedef uint64_t jack_unique_t;
538 typedef enum {
539 
540  JackPositionBBT = 0x10,
541  JackPositionTimecode = 0x20,
542  JackBBTFrameOffset = 0x40,
543  JackAudioVideoRatio = 0x80,
544  JackVideoFrameOffset = 0x100
546 } jack_position_bits_t;
547 
549 #define JACK_POSITION_MASK (JackPositionBBT|JackPositionTimecode)
550 #define EXTENDED_TIME_INFO
551 
552 PRE_PACKED_STRUCTURE
554 
555  /* these four cannot be set from clients: the server sets them */
556  jack_unique_t unique_1;
557  jack_time_t usecs;
558  jack_nframes_t frame_rate;
559  jack_nframes_t frame;
561  jack_position_bits_t valid;
563  /* JackPositionBBT fields: */
564  int32_t bar;
565  int32_t beat;
566  int32_t tick;
567  double bar_start_tick;
568 
570  float beat_type;
571  double ticks_per_beat;
572  double beats_per_minute;
573 
574  /* JackPositionTimecode fields: (EXPERIMENTAL: could change) */
575  double frame_time;
576  double next_time;
579  /* JackBBTFrameOffset fields: */
580  jack_nframes_t bbt_offset;
595  /* JACK video positional data (experimental) */
596 
604  jack_nframes_t video_offset;
611  /* For binary compatibility, new fields should be allocated from
612  * this padding area with new valid bits controlling access, so
613  * the existing structure size and offsets are preserved. */
614  int32_t padding[7];
615 
616  /* When (unique_1 == unique_2) the contents are consistent. */
617  jack_unique_t unique_2;
619 } POST_PACKED_STRUCTURE;
620 
621 typedef struct _jack_position jack_position_t;
622 
644 typedef int (*JackSyncCallback)(jack_transport_state_t state,
645  jack_position_t *pos,
646  void *arg);
647 
648 
678 typedef void (*JackTimebaseCallback)(jack_transport_state_t state,
679  jack_nframes_t nframes,
680  jack_position_t *pos,
681  int new_pos,
682  void *arg);
683 
684 /*********************************************************************
685  * The following interfaces are DEPRECATED. They are only provided
686  * for compatibility with the earlier JACK transport implementation.
687  *********************************************************************/
688 
694 typedef enum {
695 
696  JackTransportState = 0x1,
697  JackTransportPosition = 0x2,
698  JackTransportLoop = 0x4,
699  JackTransportSMPTE = 0x8,
700  JackTransportBBT = 0x10
702 } jack_transport_bits_t;
703 
710 typedef struct {
711 
712  /* these two cannot be set from clients: the server sets them */
713 
714  jack_nframes_t frame_rate;
715  jack_time_t usecs;
717  jack_transport_bits_t valid;
718  jack_transport_state_t transport_state;
719  jack_nframes_t frame;
720  jack_nframes_t loop_start;
721  jack_nframes_t loop_end;
722 
726  int bar;
727  int beat;
728  int tick;
729  double bar_start_tick;
730 
731  float beats_per_bar;
732  float beat_type;
733  double ticks_per_beat;
734  double beats_per_minute;
735 
737 
738 
739 #endif /* __jack_types_h__ */
double frame_time
Definition: types.h:575
jack_nframes_t video_offset
Definition: types.h:604
jack_nframes_t bbt_offset
Definition: types.h:580
jack_position_bits_t valid
Definition: types.h:561
float beat_type
Definition: types.h:570
jack_nframes_t min
Definition: types.h:268
int32_t tick
Definition: types.h:566
jack_unique_t unique_1
Definition: types.h:556
jack_nframes_t max
Definition: types.h:272
double next_time
Definition: types.h:576
float beats_per_bar
Definition: types.h:569
float audio_frames_per_video_frame
Definition: types.h:597
jack_nframes_t frame_rate
Definition: types.h:558
jack_transport_bits_t valid
Definition: types.h:717
jack_unique_t unique_2
Definition: types.h:617
jack_time_t usecs
Definition: types.h:557
jack_nframes_t frame_rate
Definition: types.h:714
jack_nframes_t frame
Definition: types.h:559
int32_t beat
Definition: types.h:565
int32_t bar
Definition: types.h:564
float smpte_frame_rate
Definition: types.h:724
jack_time_t usecs
Definition: types.h:715