Jack2 1.9.6

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 
00027 typedef int32_t jack_shmsize_t;
00028 
00032 typedef uint32_t        jack_nframes_t;
00033 
00037 #define JACK_MAX_FRAMES (4294967295U)   /* This should be UINT32_MAX, but C++ has a problem with that. */
00038 
00043 typedef uint64_t jack_time_t;
00044 
00049 #define JACK_LOAD_INIT_LIMIT 1024
00050 
00056 typedef uint64_t jack_intclient_t;
00057 
00062 typedef struct _jack_port jack_port_t;
00063 
00068 typedef struct _jack_client jack_client_t;
00069 
00074 typedef uint32_t jack_port_id_t;
00075 
00076 typedef uint32_t jack_port_type_id_t;
00077 
00090 typedef int (*JackProcessCallback)(jack_nframes_t nframes, void *arg);
00091 
00099 typedef void *(*JackThreadCallback)(void* arg);
00100 
00113 typedef void (*JackThreadInitCallback)(void *arg);
00114 
00123 typedef int (*JackGraphOrderCallback)(void *arg);
00124 
00135 typedef int (*JackXRunCallback)(void *arg);
00136 
00151 typedef int (*JackBufferSizeCallback)(jack_nframes_t nframes, void *arg);
00152 
00162 typedef int (*JackSampleRateCallback)(jack_nframes_t nframes, void *arg);
00163 
00170 typedef void (*JackPortRegistrationCallback)(jack_port_id_t port, int, void *arg);
00171 
00181 typedef void (*JackClientRegistrationCallback)(const char* name, int val, void *arg);
00182 
00193 typedef void (*JackPortConnectCallback)(jack_port_id_t a, jack_port_id_t b, int connect, void* arg);
00194 
00205 typedef int (*JackPortRenameCallback)(jack_port_id_t port, const char* old_name, const char* new_name, void *arg);
00206 
00214 typedef void (*JackFreewheelCallback)(int starting, void *arg);
00215 
00227 typedef void (*JackShutdownCallback)(void *arg);
00228 
00233 #define JACK_DEFAULT_AUDIO_TYPE "32 bit float mono audio"
00234 #define JACK_DEFAULT_MIDI_TYPE "8 bit raw midi"
00235 
00241 typedef float jack_default_audio_sample_t;
00242 
00249 enum JackPortFlags {
00250 
00255     JackPortIsInput = 0x1,
00256 
00261     JackPortIsOutput = 0x2,
00262 
00267     JackPortIsPhysical = 0x4,
00268 
00282     JackPortCanMonitor = 0x8,
00283 
00298     JackPortIsTerminal = 0x10,
00299     
00306     JackPortIsActive = 0x20
00307 };
00308 
00312 enum JackOptions {
00313 
00317     JackNullOption = 0x00,
00318 
00325     JackNoStartServer = 0x01,
00326 
00331     JackUseExactName = 0x02,
00332 
00336     JackServerName = 0x04,
00337 
00342     JackLoadName = 0x08,
00343 
00348     JackLoadInit = 0x10
00349 };
00350 
00352 #define JackOpenOptions (JackServerName|JackNoStartServer|JackUseExactName)
00353 
00355 #define JackLoadOptions (JackLoadInit|JackLoadName|JackUseExactName)
00356 
00361 typedef enum JackOptions jack_options_t;
00362 
00366 enum JackStatus {
00367 
00371     JackFailure = 0x01,
00372 
00376     JackInvalidOption = 0x02,
00377 
00387     JackNameNotUnique = 0x04,
00388 
00395     JackServerStarted = 0x08,
00396 
00400     JackServerFailed = 0x10,
00401 
00405     JackServerError = 0x20,
00406 
00410     JackNoSuchClient = 0x40,
00411 
00415     JackLoadFailure = 0x80,
00416 
00420     JackInitFailure = 0x100,
00421 
00425     JackShmFailure = 0x200,
00426 
00430     JackVersionError = 0x400,
00431     
00435     JackBackendError = 0x800,
00436     
00440     JackClientZombie = 0x1000
00441 };
00442 
00447 typedef enum JackStatus jack_status_t;
00448 
00452 typedef enum {
00453 
00454     /* the order matters for binary compatibility */
00455     JackTransportStopped = 0,       
00456     JackTransportRolling = 1,       
00457     JackTransportLooping = 2,       
00458     JackTransportStarting = 3,      
00459     JackTransportNetStarting = 4,       
00461 } jack_transport_state_t;
00462 
00463 typedef uint64_t jack_unique_t;         
00468 typedef enum {
00469 
00470     JackPositionBBT = 0x10,     
00471     JackPositionTimecode = 0x20,        
00472     JackBBTFrameOffset =      0x40,     
00473     JackAudioVideoRatio =     0x80, 
00474     JackVideoFrameOffset =   0x100  
00476 } jack_position_bits_t;
00477 
00479 #define JACK_POSITION_MASK (JackPositionBBT|JackPositionTimecode)
00480 #define EXTENDED_TIME_INFO
00481 
00482 typedef struct {
00483 
00484     /* these four cannot be set from clients: the server sets them */
00485     jack_unique_t       unique_1;       
00486     jack_time_t         usecs;          
00487     jack_nframes_t      frame_rate;     
00488     jack_nframes_t      frame;          
00490     jack_position_bits_t valid;         
00492     /* JackPositionBBT fields: */
00493     int32_t             bar;            
00494     int32_t             beat;           
00495     int32_t             tick;           
00496     double              bar_start_tick;
00497 
00498     float               beats_per_bar;  
00499     float               beat_type;      
00500     double              ticks_per_beat;
00501     double              beats_per_minute;
00502 
00503     /* JackPositionTimecode fields:     (EXPERIMENTAL: could change) */
00504     double              frame_time;     
00505     double              next_time;      
00508     /* JackBBTFrameOffset fields: */
00509     jack_nframes_t      bbt_offset;     
00524     /* JACK video positional data (experimental) */
00525 
00526     float               audio_frames_per_video_frame; 
00533     jack_nframes_t      video_offset;   
00540     /* For binary compatibility, new fields should be allocated from
00541      * this padding area with new valid bits controlling access, so
00542      * the existing structure size and offsets are preserved. */
00543     int32_t             padding[7];
00544 
00545     /* When (unique_1 == unique_2) the contents are consistent. */
00546     jack_unique_t       unique_2;       
00548 } jack_position_t;
00549 
00571 typedef int (*JackSyncCallback)(jack_transport_state_t state,
00572                                 jack_position_t *pos,
00573                                 void *arg);
00574 
00575 
00605 typedef void (*JackTimebaseCallback)(jack_transport_state_t state,
00606                                      jack_nframes_t nframes,
00607                                      jack_position_t *pos,
00608                                      int new_pos,
00609                                      void *arg);
00610 
00611 /*********************************************************************
00612     * The following interfaces are DEPRECATED.  They are only provided
00613     * for compatibility with the earlier JACK transport implementation.
00614     *********************************************************************/
00615 
00621 typedef enum {
00622 
00623     JackTransportState = 0x1,   
00624     JackTransportPosition = 0x2,        
00625     JackTransportLoop = 0x4,    
00626     JackTransportSMPTE = 0x8,   
00627     JackTransportBBT = 0x10     
00629 } jack_transport_bits_t;
00630 
00637 typedef struct {
00638 
00639     /* these two cannot be set from clients: the server sets them */
00640 
00641     jack_nframes_t frame_rate;          
00642     jack_time_t usecs;          
00644     jack_transport_bits_t valid;        
00645     jack_transport_state_t transport_state;
00646     jack_nframes_t frame;
00647     jack_nframes_t loop_start;
00648     jack_nframes_t loop_end;
00649 
00650     long smpte_offset;  
00651     float smpte_frame_rate;     
00653     int bar;
00654     int beat;
00655     int tick;
00656     double bar_start_tick;
00657 
00658     float beats_per_bar;
00659     float beat_type;
00660     double ticks_per_beat;
00661     double beats_per_minute;
00662 
00663 } jack_transport_info_t;
00664 
00678 typedef void (*JackInfoShutdownCallback)(jack_status_t code, const char* reason, void *arg);
00679 
00680 #endif /* __jack_types_h__ */