Jack2 1.9.8

types.h

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_types_h__
00022 #define __jack_types_h__
00023 
00024 #include <jack/systemdeps.h>
00025 
00026 typedef int32_t jack_shmsize_t;
00027 
00031 typedef uint32_t        jack_nframes_t;
00032 
00036 #define JACK_MAX_FRAMES (4294967295U)   /* This should be UINT32_MAX, but C++ has a problem with that. */
00037 
00042 typedef uint64_t jack_time_t;
00043 
00048 #define JACK_LOAD_INIT_LIMIT 1024
00049 
00055 typedef uint64_t jack_intclient_t;
00056 
00061 typedef struct _jack_port jack_port_t;
00062 
00067 typedef struct _jack_client jack_client_t;
00068 
00073 typedef uint32_t jack_port_id_t;
00074 
00075 typedef uint32_t jack_port_type_id_t;
00076 
00080 enum JackOptions {
00081 
00085     JackNullOption = 0x00,
00086 
00093     JackNoStartServer = 0x01,
00094 
00099     JackUseExactName = 0x02,
00100 
00104     JackServerName = 0x04,
00105 
00110     JackLoadName = 0x08,
00111 
00116     JackLoadInit = 0x10,
00117 
00121     JackSessionID = 0x20
00122 };
00123 
00125 #define JackOpenOptions (JackSessionID|JackServerName|JackNoStartServer|JackUseExactName)
00126 
00128 #define JackLoadOptions (JackLoadInit|JackLoadName|JackUseExactName)
00129 
00134 typedef enum JackOptions jack_options_t;
00135 
00139 enum JackStatus {
00140 
00144     JackFailure = 0x01,
00145 
00149     JackInvalidOption = 0x02,
00150 
00160     JackNameNotUnique = 0x04,
00161 
00168     JackServerStarted = 0x08,
00169 
00173     JackServerFailed = 0x10,
00174 
00178     JackServerError = 0x20,
00179 
00183     JackNoSuchClient = 0x40,
00184 
00188     JackLoadFailure = 0x80,
00189 
00193     JackInitFailure = 0x100,
00194 
00198     JackShmFailure = 0x200,
00199 
00203     JackVersionError = 0x400,
00204 
00208     JackBackendError = 0x800,
00209 
00213     JackClientZombie = 0x1000
00214 };
00215 
00220 typedef enum JackStatus jack_status_t;
00221 
00225 enum JackLatencyCallbackMode {
00226 
00232      JackCaptureLatency,
00233 
00239      JackPlaybackLatency
00240 
00241 };
00242 
00246 typedef enum JackLatencyCallbackMode jack_latency_callback_mode_t;
00247 
00257 typedef void (*JackLatencyCallback)(jack_latency_callback_mode_t mode, void *arg);
00258 
00262 struct _jack_latency_range
00263 {
00267     jack_nframes_t min;
00271     jack_nframes_t max;
00272 };
00273 
00274 typedef struct _jack_latency_range jack_latency_range_t;
00275 
00288 typedef int (*JackProcessCallback)(jack_nframes_t nframes, void *arg);
00289 
00297 typedef void *(*JackThreadCallback)(void* arg);
00298 
00311 typedef void (*JackThreadInitCallback)(void *arg);
00312 
00321 typedef int (*JackGraphOrderCallback)(void *arg);
00322 
00333 typedef int (*JackXRunCallback)(void *arg);
00334 
00349 typedef int (*JackBufferSizeCallback)(jack_nframes_t nframes, void *arg);
00350 
00360 typedef int (*JackSampleRateCallback)(jack_nframes_t nframes, void *arg);
00361 
00371 typedef void (*JackPortRegistrationCallback)(jack_port_id_t port, int register, void *arg);
00372 
00382 typedef void (*JackClientRegistrationCallback)(const char* name, int register, void *arg);
00383 
00394 typedef void (*JackPortConnectCallback)(jack_port_id_t a, jack_port_id_t b, int connect, void* arg);
00395 
00406 typedef int (*JackPortRenameCallback)(jack_port_id_t port, const char* old_name, const char* new_name, void *arg);
00407 
00415 typedef void (*JackFreewheelCallback)(int starting, void *arg);
00416 
00428 typedef void (*JackShutdownCallback)(void *arg);
00429 
00443 typedef void (*JackInfoShutdownCallback)(jack_status_t code, const char* reason, void *arg);
00444 
00449 #define JACK_DEFAULT_AUDIO_TYPE "32 bit float mono audio"
00450 #define JACK_DEFAULT_MIDI_TYPE "8 bit raw midi"
00451 
00457 typedef float jack_default_audio_sample_t;
00458 
00465 enum JackPortFlags {
00466 
00471     JackPortIsInput = 0x1,
00472 
00477     JackPortIsOutput = 0x2,
00478 
00483     JackPortIsPhysical = 0x4,
00484 
00498     JackPortCanMonitor = 0x8,
00499 
00514     JackPortIsTerminal = 0x10,
00515 
00516 };
00517 
00521 typedef enum {
00522 
00523     /* the order matters for binary compatibility */
00524     JackTransportStopped = 0,       
00525     JackTransportRolling = 1,       
00526     JackTransportLooping = 2,       
00527     JackTransportStarting = 3,      
00528     JackTransportNetStarting = 4,       
00530 } jack_transport_state_t;
00531 
00532 typedef uint64_t jack_unique_t;         
00537 typedef enum {
00538 
00539     JackPositionBBT = 0x10,     
00540     JackPositionTimecode = 0x20,        
00541     JackBBTFrameOffset =      0x40,     
00542     JackAudioVideoRatio =     0x80, 
00543     JackVideoFrameOffset =   0x100  
00545 } jack_position_bits_t;
00546 
00548 #define JACK_POSITION_MASK (JackPositionBBT|JackPositionTimecode)
00549 #define EXTENDED_TIME_INFO
00550 
00551 typedef struct {
00552 
00553     /* these four cannot be set from clients: the server sets them */
00554     jack_unique_t       unique_1;       
00555     jack_time_t         usecs;          
00556     jack_nframes_t      frame_rate;     
00557     jack_nframes_t      frame;          
00559     jack_position_bits_t valid;         
00561     /* JackPositionBBT fields: */
00562     int32_t             bar;            
00563     int32_t             beat;           
00564     int32_t             tick;           
00565     double              bar_start_tick;
00566 
00567     float               beats_per_bar;  
00568     float               beat_type;      
00569     double              ticks_per_beat;
00570     double              beats_per_minute;
00571 
00572     /* JackPositionTimecode fields:     (EXPERIMENTAL: could change) */
00573     double              frame_time;     
00574     double              next_time;      
00577     /* JackBBTFrameOffset fields: */
00578     jack_nframes_t      bbt_offset;     
00593     /* JACK video positional data (experimental) */
00594 
00595     float               audio_frames_per_video_frame; 
00602     jack_nframes_t      video_offset;   
00609     /* For binary compatibility, new fields should be allocated from
00610      * this padding area with new valid bits controlling access, so
00611      * the existing structure size and offsets are preserved. */
00612     int32_t             padding[7];
00613 
00614     /* When (unique_1 == unique_2) the contents are consistent. */
00615     jack_unique_t       unique_2;       
00617 } jack_position_t;
00618 
00640 typedef int (*JackSyncCallback)(jack_transport_state_t state,
00641                                 jack_position_t *pos,
00642                                 void *arg);
00643 
00644 
00674 typedef void (*JackTimebaseCallback)(jack_transport_state_t state,
00675                                      jack_nframes_t nframes,
00676                                      jack_position_t *pos,
00677                                      int new_pos,
00678                                      void *arg);
00679 
00680 /*********************************************************************
00681     * The following interfaces are DEPRECATED.  They are only provided
00682     * for compatibility with the earlier JACK transport implementation.
00683     *********************************************************************/
00684 
00690 typedef enum {
00691 
00692     JackTransportState = 0x1,   
00693     JackTransportPosition = 0x2,        
00694     JackTransportLoop = 0x4,    
00695     JackTransportSMPTE = 0x8,   
00696     JackTransportBBT = 0x10     
00698 } jack_transport_bits_t;
00699 
00706 typedef struct {
00707 
00708     /* these two cannot be set from clients: the server sets them */
00709 
00710     jack_nframes_t frame_rate;          
00711     jack_time_t usecs;          
00713     jack_transport_bits_t valid;        
00714     jack_transport_state_t transport_state;
00715     jack_nframes_t frame;
00716     jack_nframes_t loop_start;
00717     jack_nframes_t loop_end;
00718 
00719     long smpte_offset;  
00720     float smpte_frame_rate;     
00722     int bar;
00723     int beat;
00724     int tick;
00725     double bar_start_tick;
00726 
00727     float beats_per_bar;
00728     float beat_type;
00729     double ticks_per_beat;
00730     double beats_per_minute;
00731 
00732 } jack_transport_info_t;
00733 
00734 
00735 #endif /* __jack_types_h__ */