transport.h

Go to the documentation of this file.
00001 /*
00002     Copyright (C) 2002 Paul Davis
00003     Copyright (C) 2003 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_transport_h__
00022 #define __jack_transport_h__
00023 
00024 #ifdef __cplusplus
00025 extern "C" {
00026 #endif
00027 
00028 #include <jack/types.h>
00029 #include <jack/weakmacros.h>
00030 
00031 #ifndef 
00032 #ifdef __GNUC__
00033 /*  needs to be a macro which
00034    expands into a compiler directive. The directive must
00035    tell the compiler to arrange the preceding structure
00036    declaration so that it is packed on byte-boundaries rather 
00037    than use the natural alignment of the processor and/or
00038    compiler.
00039 */
00040 #define  __attribute__((__packed__))
00041 #else
00042 /* Add other things here for non-gcc platforms */
00043 #endif
00044 #endif
00045 
00046 
00050 typedef enum {
00051 
00052         /* the order matters for binary compatibility */
00053         JackTransportStopped = 0,       
00054         JackTransportRolling = 1,       
00055         JackTransportLooping = 2,       
00056         JackTransportStarting = 3       
00058 } jack_transport_state_t;
00059 
00060 typedef uint64_t jack_unique_t;         
00065 typedef enum {
00066 
00067         JackPositionBBT =         0x10, 
00068         JackPositionTimecode =    0x20, 
00069         JackBBTFrameOffset =      0x40, 
00070         JackAudioVideoRatio =     0x80, 
00071         JackVideoFrameOffset =   0x100  
00072 } jack_position_bits_t;
00073 
00075 #define JACK_POSITION_MASK (JackPositionBBT|JackPositionTimecode|JackBBTFrameOffset|JackAudioVideoRatio|JackVideoFrameOffset)
00076 #define EXTENDED_TIME_INFO
00077 
00081 typedef struct {
00082     
00083     /* these four cannot be set from clients: the server sets them */
00084     jack_unique_t       unique_1;       
00085     jack_time_t         usecs;          
00086     jack_nframes_t      frame_rate;     
00087     jack_nframes_t      frame;          
00089     jack_position_bits_t valid;         
00091     /* JackPositionBBT fields: */
00092     int32_t             bar;            
00093     int32_t             beat;           
00094     int32_t             tick;           
00095     double              bar_start_tick;            
00096 
00097     float               beats_per_bar;  
00098     float               beat_type;      
00099     double              ticks_per_beat;
00100     double              beats_per_minute;
00101 
00102     /* JackPositionTimecode fields:     (EXPERIMENTAL: could change) */
00103     double              frame_time;     
00104     double              next_time;      
00107     /* JackBBTFrameOffset fields: */
00108     jack_nframes_t      bbt_offset;     
00123     /* JACK video positional data (experimental) */
00124 
00125     float               audio_frames_per_video_frame; 
00132     jack_nframes_t      video_offset;   
00139     /* For binary compatibility, new fields should be allocated from
00140      * this padding area with new valid bits controlling access, so
00141      * the existing structure size and offsets are preserved. */
00142     int32_t             padding[7];
00143 
00144     /* When (unique_1 == unique_2) the contents are consistent. */
00145     jack_unique_t       unique_2;       
00147 }  jack_position_t;
00148 
00170 int  jack_release_timebase (jack_client_t *client) JACK_OPTIONAL_WEAK_EXPORT;
00171 
00193 typedef int  (*JackSyncCallback)(jack_transport_state_t state,
00194                                  jack_position_t *pos,
00195                                  void *arg);
00196 
00217 int  jack_set_sync_callback (jack_client_t *client,
00218                              JackSyncCallback sync_callback,
00219                              void *arg) JACK_OPTIONAL_WEAK_EXPORT;
00220 
00238 int  jack_set_sync_timeout (jack_client_t *client,
00239                             jack_time_t timeout) JACK_OPTIONAL_WEAK_EXPORT;
00240 
00270 typedef void (*JackTimebaseCallback)(jack_transport_state_t state,
00271                                      jack_nframes_t nframes, 
00272                                      jack_position_t *pos,
00273                                      int new_pos,
00274                                      void *arg);
00275 
00301 int  jack_set_timebase_callback (jack_client_t *client,
00302                                  int conditional,
00303                                  JackTimebaseCallback timebase_callback,
00304                                  void *arg) JACK_OPTIONAL_WEAK_EXPORT;
00305 
00322 int  jack_transport_locate (jack_client_t *client,
00323                             jack_nframes_t frame) JACK_OPTIONAL_WEAK_EXPORT;
00324 
00340 jack_transport_state_t jack_transport_query (const jack_client_t *client,
00341                                              jack_position_t *pos) JACK_OPTIONAL_WEAK_EXPORT;
00342 
00350 jack_nframes_t jack_get_current_transport_frame (const jack_client_t *client) JACK_OPTIONAL_WEAK_EXPORT;
00351                                                  
00368 int  jack_transport_reposition (jack_client_t *client,
00369                                 jack_position_t *pos) JACK_OPTIONAL_WEAK_EXPORT;
00370 
00382 void jack_transport_start (jack_client_t *client) JACK_OPTIONAL_WEAK_EXPORT;
00383 
00392 void jack_transport_stop (jack_client_t *client) JACK_OPTIONAL_WEAK_EXPORT;
00393 
00396 /*********************************************************************
00397  * The following interfaces are DEPRECATED.  They are only provided
00398  * for compatibility with the earlier JACK transport implementation.
00399  *********************************************************************/
00400 
00406 typedef enum {
00407 
00408         JackTransportState =    0x1,    
00409         JackTransportPosition = 0x2,    
00410         JackTransportLoop =     0x4,    
00411         JackTransportSMPTE =    0x8,    
00412         JackTransportBBT =      0x10    
00414 } jack_transport_bits_t;
00415 
00422 typedef struct {
00423     
00424     /* these two cannot be set from clients: the server sets them */
00425 
00426     jack_nframes_t frame_rate;          
00427     jack_time_t    usecs;               
00429     jack_transport_bits_t  valid;       
00430     jack_transport_state_t transport_state;         
00431     jack_nframes_t         frame;
00432     jack_nframes_t         loop_start;
00433     jack_nframes_t         loop_end;
00434 
00435     long           smpte_offset;        
00436     float          smpte_frame_rate;    
00438     int            bar;
00439     int            beat;
00440     int            tick;
00441     double         bar_start_tick;            
00442 
00443     float          beats_per_bar;
00444     float          beat_type;
00445     double         ticks_per_beat;
00446     double         beats_per_minute;
00447 
00448 } jack_transport_info_t;
00449         
00462 void jack_get_transport_info (jack_client_t *client,
00463                               jack_transport_info_t *tinfo) JACK_OPTIONAL_WEAK_DEPRECATED_EXPORT;
00464 
00472 void jack_set_transport_info (jack_client_t *client,
00473                               jack_transport_info_t *tinfo) JACK_OPTIONAL_WEAK_DEPRECATED_EXPORT;
00474 
00475 #ifdef __cplusplus
00476 }
00477 #endif
00478 
00479 #endif /* __jack_transport_h__ */
00480 

Generated for JACK-AUDIO-CONNECTION-KIT by  doxygen1.6.1