JACK-AUDIO-CONNECTION-KIT: transport.h Source File

# 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     $Id: transport.h,v 1.20 2004/10/26 16:08:52 joq Exp $
    00020 */
    00021
    00022 #ifndef __jack_transport_h__
    00023 #define __jack_transport_h__
    00024
    00025 #ifdef __cplusplus
    00026 extern "C" {
    00027 #endif
    00028
    00029 #include <jack/types.h>
    00030
    00034 typedef enum {
    00035
    00036         /* the order matters for binary compatibility */
    00037         JackTransportStopped = 0,
    00038         JackTransportRolling = 1,
    00039         JackTransportLooping = 2,
    00040         JackTransportStarting = 3
    00042 } jack_transport_state_t;
    00043
    00044 typedef uint64_t jack_unique_t;
    00049 typedef enum {
    00050
    00051         JackPositionBBT =       0x10,
    00052         JackPositionTimecode =  0x20
    00054 } jack_position_bits_t;
    00055
    00057 #define JACK_POSITION_MASK (JackPositionBBT|JackPositionTimecode)
    00058 #define EXTENDED_TIME_INFO
    00059
    00063 typedef struct {
    00064
    00065     /* these four cannot be set from clients: the server sets them */
    00066     jack_unique_t       unique_1;
    00067     jack_time_t         usecs;
    00068     jack_nframes_t      frame_rate;
    00069     jack_nframes_t      frame;
    00071     jack_position_bits_t valid;
    00073     /* JackPositionBBT fields: */
    00074     int32_t             bar;
    00075     int32_t             beat;
    00076     int32_t             tick;
    00077     double              bar_start_tick;
    00078
    00079     float               beats_per_bar;
    00080     float               beat_type;
    00081     double              ticks_per_beat;
    00082     double              beats_per_minute;
    00083
    00084     /* JackPositionTimecode fields:     (EXPERIMENTAL: could change) */
    00085     double              frame_time;
    00086     double              next_time;
    00089     /* For binary compatibility, new fields should be allocated from
    00090      * this padding area with new valid bits controlling access, so
    00091      * the existing structure size and offsets are preserved. */
    00092     int32_t             padding[10];
    00093
    00094     /* When (unique_1 == unique_2) the contents are consistent. */
    00095     jack_unique_t       unique_2;
    00097 } jack_position_t;
    00098
    00115 int  jack_release_timebase (jack_client_t *client);
    00116
    00138 typedef int  (*JackSyncCallback)(jack_transport_state_t state,
    00139                                  jack_position_t *pos,
    00140                                  void *arg);
    00141
    00162 int  jack_set_sync_callback (jack_client_t *client,
    00163                              JackSyncCallback sync_callback,
    00164                              void *arg);
    00165
    00183 int  jack_set_sync_timeout (jack_client_t *client,
    00184                             jack_time_t timeout);
    00185
    00215 typedef void (*JackTimebaseCallback)(jack_transport_state_t state,
    00216                                      jack_nframes_t nframes,
    00217                                      jack_position_t *pos,
    00218                                      int new_pos,
    00219                                      void *arg);
    00220
    00246 int  jack_set_timebase_callback (jack_client_t *client,
    00247                                  int conditional,
    00248                                  JackTimebaseCallback timebase_callback,
    00249                                  void *arg);
    00250
    00267 int  jack_transport_locate (jack_client_t *client,
    00268                             jack_nframes_t frame);
    00269
    00285 jack_transport_state_t jack_transport_query (const jack_client_t *client,
    00286                                              jack_position_t *pos);
    00287
    00295 jack_nframes_t jack_get_current_transport_frame (const jack_client_t *client);
    00296
    00313 int  jack_transport_reposition (jack_client_t *client,
    00314                                 jack_position_t *pos);
    00315
    00327 void jack_transport_start (jack_client_t *client);
    00328
    00337 void jack_transport_stop (jack_client_t *client);
    00338
    00339
    00340 /*********************************************************************
    00341  * The following interfaces are DEPRECATED.  They are only provided
    00342  * for compatibility with the earlier JACK transport implementation.
    00343  *********************************************************************/
    00344
    00350 typedef enum {
    00351
    00352         JackTransportState =    0x1,
    00353         JackTransportPosition = 0x2,
    00354         JackTransportLoop =     0x4,
    00355         JackTransportSMPTE =    0x8,
    00356         JackTransportBBT =      0x10
    00358 } jack_transport_bits_t;
    00359
    00366 typedef struct {
    00367
    00368     /* these two cannot be set from clients: the server sets them */
    00369
    00370     jack_nframes_t frame_rate;
    00371     jack_time_t    usecs;
    00373     jack_transport_bits_t  valid;
    00374     jack_transport_state_t transport_state;
    00375     jack_nframes_t         frame;
    00376     jack_nframes_t         loop_start;
    00377     jack_nframes_t         loop_end;
    00378
    00379     long           smpte_offset;
    00380     float          smpte_frame_rate;
    00382     int            bar;
    00383     int            beat;
    00384     int            tick;
    00385     double         bar_start_tick;
    00386
    00387     float          beats_per_bar;
    00388     float          beat_type;
    00389     double         ticks_per_beat;
    00390     double         beats_per_minute;
    00391
    00392 } jack_transport_info_t;
    00393
    00406 void jack_get_transport_info (jack_client_t *client,
    00407                               jack_transport_info_t *tinfo);
    00408
    00416 void jack_set_transport_info (jack_client_t *client,
    00417                               jack_transport_info_t *tinfo);
    00418
    00419 #ifdef __cplusplus
    00420 }
    00421 #endif
    00422
    00423 #endif /* __jack_transport_h__ */