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 
00033 typedef enum {
00034 
00035         /* the order matters for binary compatibility */
00036         JackTransportStopped = 0,       
00037         JackTransportRolling = 1,       
00038         JackTransportLooping = 2,       
00039         JackTransportStarting = 3       
00041 } jack_transport_state_t;
00042 
00043 typedef uint64_t jack_unique_t;         
00048 typedef enum {
00049 
00050         JackPositionBBT =         0x10, 
00051         JackPositionTimecode =    0x20, 
00052         JackBBTFrameOffset =      0x40, 
00053         JackAudioVideoRatio =     0x80, 
00054         JackVideoFrameOffset =   0x100  
00055 } jack_position_bits_t;
00056 
00058 #define JACK_POSITION_MASK (JackPositionBBT|JackPositionTimecode|JackBBTFrameOffset|JackAudioVideoRatio|JackVideoFrameOffset)
00059 #define EXTENDED_TIME_INFO
00060 
00064 typedef struct {
00065     
00066     /* these four cannot be set from clients: the server sets them */
00067     jack_unique_t       unique_1;       
00068     jack_time_t         usecs;          
00069     jack_nframes_t      frame_rate;     
00070     jack_nframes_t      frame;          
00072     jack_position_bits_t valid;         
00074     /* JackPositionBBT fields: */
00075     int32_t             bar;            
00076     int32_t             beat;           
00077     int32_t             tick;           
00078     double              bar_start_tick;            
00079 
00080     float               beats_per_bar;  
00081     float               beat_type;      
00082     double              ticks_per_beat;
00083     double              beats_per_minute;
00084 
00085     /* JackPositionTimecode fields:     (EXPERIMENTAL: could change) */
00086     double              frame_time;     
00087     double              next_time;      
00090     /* JackBBTFrameOffset fields: */
00091     jack_nframes_t      bbt_offset;     
00106     /* JACK video positional data (experimental) */
00107 
00108     float               audio_frames_per_video_frame; 
00115     jack_nframes_t      video_offset;   
00122     /* For binary compatibility, new fields should be allocated from
00123      * this padding area with new valid bits controlling access, so
00124      * the existing structure size and offsets are preserved. */
00125     int32_t             padding[7];
00126 
00127     /* When (unique_1 == unique_2) the contents are consistent. */
00128     jack_unique_t       unique_2;       
00130 } jack_position_t;
00131 
00148 int  jack_release_timebase (jack_client_t *client);
00149 
00171 typedef int  (*JackSyncCallback)(jack_transport_state_t state,
00172                                  jack_position_t *pos,
00173                                  void *arg);
00174 
00195 int  jack_set_sync_callback (jack_client_t *client,
00196                              JackSyncCallback sync_callback,
00197                              void *arg);
00198 
00216 int  jack_set_sync_timeout (jack_client_t *client,
00217                             jack_time_t timeout);
00218 
00248 typedef void (*JackTimebaseCallback)(jack_transport_state_t state,
00249                                      jack_nframes_t nframes, 
00250                                      jack_position_t *pos,
00251                                      int new_pos,
00252                                      void *arg);
00253 
00279 int  jack_set_timebase_callback (jack_client_t *client,
00280                                  int conditional,
00281                                  JackTimebaseCallback timebase_callback,
00282                                  void *arg);
00283 
00300 int  jack_transport_locate (jack_client_t *client,
00301                             jack_nframes_t frame);
00302 
00318 jack_transport_state_t jack_transport_query (const jack_client_t *client,
00319                                              jack_position_t *pos);
00320 
00328 jack_nframes_t jack_get_current_transport_frame (const jack_client_t *client);
00329                                                  
00346 int  jack_transport_reposition (jack_client_t *client,
00347                                 jack_position_t *pos);
00348 
00360 void jack_transport_start (jack_client_t *client);
00361 
00370 void jack_transport_stop (jack_client_t *client);
00371 
00372 
00373 /*********************************************************************
00374  * The following interfaces are DEPRECATED.  They are only provided
00375  * for compatibility with the earlier JACK transport implementation.
00376  *********************************************************************/
00377 
00383 typedef enum {
00384 
00385         JackTransportState =    0x1,    
00386         JackTransportPosition = 0x2,    
00387         JackTransportLoop =     0x4,    
00388         JackTransportSMPTE =    0x8,    
00389         JackTransportBBT =      0x10    
00391 } jack_transport_bits_t;
00392 
00399 typedef struct {
00400     
00401     /* these two cannot be set from clients: the server sets them */
00402 
00403     jack_nframes_t frame_rate;          
00404     jack_time_t    usecs;               
00406     jack_transport_bits_t  valid;       
00407     jack_transport_state_t transport_state;         
00408     jack_nframes_t         frame;
00409     jack_nframes_t         loop_start;
00410     jack_nframes_t         loop_end;
00411 
00412     long           smpte_offset;        
00413     float          smpte_frame_rate;    
00415     int            bar;
00416     int            beat;
00417     int            tick;
00418     double         bar_start_tick;            
00419 
00420     float          beats_per_bar;
00421     float          beat_type;
00422     double         ticks_per_beat;
00423     double         beats_per_minute;
00424 
00425 } jack_transport_info_t;
00426         
00439 void jack_get_transport_info (jack_client_t *client,
00440                               jack_transport_info_t *tinfo);
00441 
00449 void jack_set_transport_info (jack_client_t *client,
00450                               jack_transport_info_t *tinfo);
00451 
00452 #ifdef __cplusplus
00453 }
00454 #endif
00455 
00456 #endif /* __jack_transport_h__ */

Generated on Sat Feb 2 08:53:11 2008 for JACK-AUDIO-CONNECTION-KIT by  doxygen 1.5.4