Jack2  1.9.21
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 uint64_t jack_uuid_t;
27 
28 typedef int32_t jack_shmsize_t;
29 
33 typedef uint32_t jack_nframes_t;
34 
38 #define JACK_MAX_FRAMES (4294967295U) /* This should be UINT32_MAX, but C++ has a problem with that. */
39 
44 typedef uint64_t jack_time_t;
45 
50 #define JACK_LOAD_INIT_LIMIT 1024
51 
57 typedef uint64_t jack_intclient_t;
58 
63 typedef struct _jack_port jack_port_t;
64 
69 typedef struct _jack_client jack_client_t;
70 
75 typedef uint32_t jack_port_id_t;
76 
77 typedef uint32_t jack_port_type_id_t;
78 
82 enum JackOptions {
83 
87  JackNullOption = 0x00,
88 
95  JackNoStartServer = 0x01,
96 
101  JackUseExactName = 0x02,
102 
106  JackServerName = 0x04,
107 
112  JackLoadName = 0x08,
113 
118  JackLoadInit = 0x10,
119 
123  JackSessionID = 0x20
124 };
125 
127 #define JackOpenOptions (JackSessionID|JackServerName|JackNoStartServer|JackUseExactName)
128 
130 #define JackLoadOptions (JackLoadInit|JackLoadName|JackUseExactName)
131 
136 typedef enum JackOptions jack_options_t;
137 
141 enum JackStatus {
142 
146  JackFailure = 0x01,
147 
151  JackInvalidOption = 0x02,
152 
162  JackNameNotUnique = 0x04,
163 
170  JackServerStarted = 0x08,
171 
175  JackServerFailed = 0x10,
176 
180  JackServerError = 0x20,
181 
185  JackNoSuchClient = 0x40,
186 
190  JackLoadFailure = 0x80,
191 
195  JackInitFailure = 0x100,
196 
200  JackShmFailure = 0x200,
201 
205  JackVersionError = 0x400,
206 
210  JackBackendError = 0x800,
211 
215  JackClientZombie = 0x1000
216 };
217 
222 typedef enum JackStatus jack_status_t;
223 
227 enum JackLatencyCallbackMode {
228 
234  JackCaptureLatency,
235 
241  JackPlaybackLatency
242 
243 };
244 
248 typedef enum JackLatencyCallbackMode jack_latency_callback_mode_t;
249 
259 typedef void (*JackLatencyCallback)(jack_latency_callback_mode_t mode, void *arg);
260 
264 PRE_PACKED_STRUCTURE
266 {
270  jack_nframes_t min;
274  jack_nframes_t max;
275 } POST_PACKED_STRUCTURE;
276 
278 
291 typedef int (*JackProcessCallback)(jack_nframes_t nframes, void *arg);
292 
300 typedef void *(*JackThreadCallback)(void* arg);
301 
314 typedef void (*JackThreadInitCallback)(void *arg);
315 
324 typedef int (*JackGraphOrderCallback)(void *arg);
325 
336 typedef int (*JackXRunCallback)(void *arg);
337 
352 typedef int (*JackBufferSizeCallback)(jack_nframes_t nframes, void *arg);
353 
363 typedef int (*JackSampleRateCallback)(jack_nframes_t nframes, void *arg);
364 
374 typedef void (*JackPortRegistrationCallback)(jack_port_id_t port, int /* register */, void *arg);
375 
385 typedef void (*JackClientRegistrationCallback)(const char* name, int /* register */, void *arg);
386 
397 typedef void (*JackPortConnectCallback)(jack_port_id_t a, jack_port_id_t b, int connect, void* arg);
398 
407 typedef void (*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 
445 typedef void (*JackInfoShutdownCallback)(jack_status_t code, const char* reason, void *arg);
446 
451 #define JACK_DEFAULT_AUDIO_TYPE "32 bit float mono audio"
452 #define JACK_DEFAULT_MIDI_TYPE "8 bit raw midi"
453 
459 typedef float jack_default_audio_sample_t;
460 
467 enum JackPortFlags {
468 
473  JackPortIsInput = 0x1,
474 
479  JackPortIsOutput = 0x2,
480 
485  JackPortIsPhysical = 0x4,
486 
500  JackPortCanMonitor = 0x8,
501 
516  JackPortIsTerminal = 0x10,
517 
518 };
519 
523 typedef enum {
524 
525  /* the order matters for binary compatibility */
526  JackTransportStopped = 0,
527  JackTransportRolling = 1,
528  JackTransportLooping = 2,
529  JackTransportStarting = 3,
530  JackTransportNetStarting = 4,
532 } jack_transport_state_t;
533 
534 typedef uint64_t jack_unique_t;
539 typedef enum {
540 
541  JackPositionBBT = 0x10,
542  JackPositionTimecode = 0x20,
543  JackBBTFrameOffset = 0x40,
544  JackAudioVideoRatio = 0x80,
545  JackVideoFrameOffset = 0x100,
546  JackTickDouble = 0x200,
548 } jack_position_bits_t;
549 
551 #define JACK_POSITION_MASK (JackPositionBBT|JackPositionTimecode)
552 #define EXTENDED_TIME_INFO
553 
555 #define JACK_TICK_DOUBLE
556 
557 PRE_PACKED_STRUCTURE
559 
560  /* these four cannot be set from clients: the server sets them */
561  jack_unique_t unique_1;
562  jack_time_t usecs;
563  jack_nframes_t frame_rate;
564  jack_nframes_t frame;
566  jack_position_bits_t valid;
568  /* JackPositionBBT fields: */
569  int32_t bar;
570  int32_t beat;
571  int32_t tick;
572  double bar_start_tick;
573 
575  float beat_type;
576  double ticks_per_beat;
577  double beats_per_minute;
578 
579  /* JackPositionTimecode fields: (EXPERIMENTAL: could change) */
580  double frame_time;
581  double next_time;
584  /* JackBBTFrameOffset fields: */
585  jack_nframes_t bbt_offset;
600  /* JACK video positional data (experimental) */
601 
609  jack_nframes_t video_offset;
616  /* JACK extra transport fields */
617 
618  double tick_double;
624  /* For binary compatibility, new fields should be allocated from
625  * this padding area with new valid bits controlling access, so
626  * the existing structure size and offsets are preserved. */
627  int32_t padding[5];
628 
629  /* When (unique_1 == unique_2) the contents are consistent. */
630  jack_unique_t unique_2;
632 } POST_PACKED_STRUCTURE;
633 
634 typedef struct _jack_position jack_position_t;
635 
657 typedef int (*JackSyncCallback)(jack_transport_state_t state,
658  jack_position_t *pos,
659  void *arg);
660 
661 
691 typedef void (*JackTimebaseCallback)(jack_transport_state_t state,
692  jack_nframes_t nframes,
693  jack_position_t *pos,
694  int new_pos,
695  void *arg);
696 
697 /*********************************************************************
698  * The following interfaces are DEPRECATED. They are only provided
699  * for compatibility with the earlier JACK transport implementation.
700  *********************************************************************/
701 
707 typedef enum {
708 
709  JackTransportState = 0x1,
710  JackTransportPosition = 0x2,
711  JackTransportLoop = 0x4,
712  JackTransportSMPTE = 0x8,
713  JackTransportBBT = 0x10
715 } jack_transport_bits_t;
716 
723 typedef struct {
724 
725  /* these two cannot be set from clients: the server sets them */
726 
727  jack_nframes_t frame_rate;
728  jack_time_t usecs;
730  jack_transport_bits_t valid;
731  jack_transport_state_t transport_state;
732  jack_nframes_t frame;
733  jack_nframes_t loop_start;
734  jack_nframes_t loop_end;
735 
739  int bar;
740  int beat;
741  int tick;
742  double bar_start_tick;
743 
744  float beats_per_bar;
745  float beat_type;
746  double ticks_per_beat;
747  double beats_per_minute;
748 
750 
751 
752 #endif /* __jack_types_h__ */
double frame_time
Definition: types.h:580
jack_nframes_t video_offset
Definition: types.h:609
jack_nframes_t bbt_offset
Definition: types.h:585
jack_position_bits_t valid
Definition: types.h:566
float beat_type
Definition: types.h:575
jack_nframes_t min
Definition: types.h:270
int32_t tick
Definition: types.h:571
jack_unique_t unique_1
Definition: types.h:561
jack_nframes_t max
Definition: types.h:274
double next_time
Definition: types.h:581
float beats_per_bar
Definition: types.h:574
float audio_frames_per_video_frame
Definition: types.h:602
jack_nframes_t frame_rate
Definition: types.h:563
jack_transport_bits_t valid
Definition: types.h:730
jack_unique_t unique_2
Definition: types.h:630
jack_time_t usecs
Definition: types.h:562
jack_nframes_t frame_rate
Definition: types.h:727
jack_nframes_t frame
Definition: types.h:564
int32_t beat
Definition: types.h:570
int32_t bar
Definition: types.h:569
double tick_double
Definition: types.h:618
float smpte_frame_rate
Definition: types.h:737
jack_time_t usecs
Definition: types.h:728