Jack2 1.9.10

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 uint64_t jack_uuid_t;
00027 
00028 typedef int32_t jack_shmsize_t;
00029 
00033 typedef uint32_t        jack_nframes_t;
00034 
00038 #define JACK_MAX_FRAMES (4294967295U)   /* This should be UINT32_MAX, but C++ has a problem with that. */
00039 
00044 typedef uint64_t jack_time_t;
00045 
00050 #define JACK_LOAD_INIT_LIMIT 1024
00051 
00057 typedef uint64_t jack_intclient_t;
00058 
00063 typedef struct _jack_port jack_port_t;
00064 
00069 typedef struct _jack_client jack_client_t;
00070 
00075 typedef uint32_t jack_port_id_t;
00076 
00077 typedef uint32_t jack_port_type_id_t;
00078 
00082 enum JackOptions {
00083 
00087     JackNullOption = 0x00,
00088 
00095     JackNoStartServer = 0x01,
00096 
00101     JackUseExactName = 0x02,
00102 
00106     JackServerName = 0x04,
00107 
00112     JackLoadName = 0x08,
00113 
00118     JackLoadInit = 0x10,
00119 
00123     JackSessionID = 0x20
00124 };
00125 
00127 #define JackOpenOptions (JackSessionID|JackServerName|JackNoStartServer|JackUseExactName)
00128 
00130 #define JackLoadOptions (JackLoadInit|JackLoadName|JackUseExactName)
00131 
00136 typedef enum JackOptions jack_options_t;
00137 
00141 enum JackStatus {
00142 
00146     JackFailure = 0x01,
00147 
00151     JackInvalidOption = 0x02,
00152 
00162     JackNameNotUnique = 0x04,
00163 
00170     JackServerStarted = 0x08,
00171 
00175     JackServerFailed = 0x10,
00176 
00180     JackServerError = 0x20,
00181 
00185     JackNoSuchClient = 0x40,
00186 
00190     JackLoadFailure = 0x80,
00191 
00195     JackInitFailure = 0x100,
00196 
00200     JackShmFailure = 0x200,
00201 
00205     JackVersionError = 0x400,
00206 
00210     JackBackendError = 0x800,
00211 
00215     JackClientZombie = 0x1000
00216 };
00217 
00222 typedef enum JackStatus jack_status_t;
00223 
00227 enum JackLatencyCallbackMode {
00228 
00234      JackCaptureLatency,
00235 
00241      JackPlaybackLatency
00242 
00243 };
00244 
00248 typedef enum JackLatencyCallbackMode jack_latency_callback_mode_t;
00249 
00259 typedef void (*JackLatencyCallback)(jack_latency_callback_mode_t mode, void *arg);
00260 
00264 PRE_PACKED_STRUCTURE
00265 struct _jack_latency_range
00266 {
00270     jack_nframes_t min;
00274     jack_nframes_t max;
00275 } POST_PACKED_STRUCTURE;
00276 
00277 typedef struct _jack_latency_range jack_latency_range_t;
00278 
00291 typedef int (*JackProcessCallback)(jack_nframes_t nframes, void *arg);
00292 
00300 typedef void *(*JackThreadCallback)(void* arg);
00301 
00314 typedef void (*JackThreadInitCallback)(void *arg);
00315 
00324 typedef int (*JackGraphOrderCallback)(void *arg);
00325 
00336 typedef int (*JackXRunCallback)(void *arg);
00337 
00352 typedef int (*JackBufferSizeCallback)(jack_nframes_t nframes, void *arg);
00353 
00363 typedef int (*JackSampleRateCallback)(jack_nframes_t nframes, void *arg);
00364 
00374 typedef void (*JackPortRegistrationCallback)(jack_port_id_t port, int /* register */, void *arg);
00375 
00385 typedef void (*JackClientRegistrationCallback)(const char* name, int /* register */, void *arg);
00386 
00397 typedef void (*JackPortConnectCallback)(jack_port_id_t a, jack_port_id_t b, int connect, void* arg);
00398 
00409 typedef int (*JackPortRenameCallback)(jack_port_id_t port, const char* old_name, const char* new_name, void *arg);
00410 
00418 typedef void (*JackFreewheelCallback)(int starting, void *arg);
00419 
00431 typedef void (*JackShutdownCallback)(void *arg);
00432 
00446 typedef void (*JackInfoShutdownCallback)(jack_status_t code, const char* reason, void *arg);
00447 
00452 #define JACK_DEFAULT_AUDIO_TYPE "32 bit float mono audio"
00453 #define JACK_DEFAULT_MIDI_TYPE "8 bit raw midi"
00454 
00460 typedef float jack_default_audio_sample_t;
00461 
00468 enum JackPortFlags {
00469 
00474     JackPortIsInput = 0x1,
00475 
00480     JackPortIsOutput = 0x2,
00481 
00486     JackPortIsPhysical = 0x4,
00487 
00501     JackPortCanMonitor = 0x8,
00502 
00517     JackPortIsTerminal = 0x10,
00518 
00519 };
00520 
00524 typedef enum {
00525 
00526     /* the order matters for binary compatibility */
00527     JackTransportStopped = 0,       
00528     JackTransportRolling = 1,       
00529     JackTransportLooping = 2,       
00530     JackTransportStarting = 3,      
00531     JackTransportNetStarting = 4,       
00533 } jack_transport_state_t;
00534 
00535 typedef uint64_t jack_unique_t;         
00540 typedef enum {
00541 
00542     JackPositionBBT = 0x10,     
00543     JackPositionTimecode = 0x20,        
00544     JackBBTFrameOffset =      0x40,     
00545     JackAudioVideoRatio =     0x80, 
00546     JackVideoFrameOffset =   0x100  
00548 } jack_position_bits_t;
00549 
00551 #define JACK_POSITION_MASK (JackPositionBBT|JackPositionTimecode)
00552 #define EXTENDED_TIME_INFO
00553 
00554 PRE_PACKED_STRUCTURE
00555 struct _jack_position {
00556 
00557     /* these four cannot be set from clients: the server sets them */
00558     jack_unique_t       unique_1;       
00559     jack_time_t         usecs;          
00560     jack_nframes_t      frame_rate;     
00561     jack_nframes_t      frame;          
00563     jack_position_bits_t valid;         
00565     /* JackPositionBBT fields: */
00566     int32_t             bar;            
00567     int32_t             beat;           
00568     int32_t             tick;           
00569     double              bar_start_tick;
00570 
00571     float               beats_per_bar;  
00572     float               beat_type;      
00573     double              ticks_per_beat;
00574     double              beats_per_minute;
00575 
00576     /* JackPositionTimecode fields:     (EXPERIMENTAL: could change) */
00577     double              frame_time;     
00578     double              next_time;      
00581     /* JackBBTFrameOffset fields: */
00582     jack_nframes_t      bbt_offset;     
00597     /* JACK video positional data (experimental) */
00598 
00599     float               audio_frames_per_video_frame; 
00606     jack_nframes_t      video_offset;   
00613     /* For binary compatibility, new fields should be allocated from
00614      * this padding area with new valid bits controlling access, so
00615      * the existing structure size and offsets are preserved. */
00616     int32_t             padding[7];
00617 
00618     /* When (unique_1 == unique_2) the contents are consistent. */
00619     jack_unique_t       unique_2;       
00621 } POST_PACKED_STRUCTURE;
00622 
00623 typedef struct _jack_position jack_position_t;
00624 
00646 typedef int (*JackSyncCallback)(jack_transport_state_t state,
00647                                 jack_position_t *pos,
00648                                 void *arg);
00649 
00650 
00680 typedef void (*JackTimebaseCallback)(jack_transport_state_t state,
00681                                      jack_nframes_t nframes,
00682                                      jack_position_t *pos,
00683                                      int new_pos,
00684                                      void *arg);
00685 
00686 /*********************************************************************
00687     * The following interfaces are DEPRECATED.  They are only provided
00688     * for compatibility with the earlier JACK transport implementation.
00689     *********************************************************************/
00690 
00696 typedef enum {
00697 
00698     JackTransportState = 0x1,   
00699     JackTransportPosition = 0x2,        
00700     JackTransportLoop = 0x4,    
00701     JackTransportSMPTE = 0x8,   
00702     JackTransportBBT = 0x10     
00704 } jack_transport_bits_t;
00705 
00712 typedef struct {
00713 
00714     /* these two cannot be set from clients: the server sets them */
00715 
00716     jack_nframes_t frame_rate;          
00717     jack_time_t usecs;          
00719     jack_transport_bits_t valid;        
00720     jack_transport_state_t transport_state;
00721     jack_nframes_t frame;
00722     jack_nframes_t loop_start;
00723     jack_nframes_t loop_end;
00724 
00725     long smpte_offset;  
00726     float smpte_frame_rate;     
00728     int bar;
00729     int beat;
00730     int tick;
00731     double bar_start_tick;
00732 
00733     float beats_per_bar;
00734     float beat_type;
00735     double ticks_per_beat;
00736     double beats_per_minute;
00737 
00738 } jack_transport_info_t;
00739 
00740 
00741 #endif /* __jack_types_h__ */