# 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 951 2006-05-15 21:32:08Z pbd $
    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,
    00053         JackBBTFrameOffset =      0x40,
    00054         JackAudioVideoRatio =     0x80,
    00055         JackVideoFrameOffset =   0x100
    00056 } jack_position_bits_t;
    00057
    00059 #define JACK_POSITION_MASK (JackPositionBBT|JackPositionTimecode|JackBBTFrameOffset|JackAudioVideoRatio|JackVideoFrameOffset)
    00060 #define EXTENDED_TIME_INFO
    00061
    00065 typedef struct {
    00066
    00067     /* these four cannot be set from clients: the server sets them */
    00068     jack_unique_t       unique_1;
    00069     jack_time_t         usecs;
    00070     jack_nframes_t      frame_rate;
    00071     jack_nframes_t      frame;
    00073     jack_position_bits_t valid;
    00075     /* JackPositionBBT fields: */
    00076     int32_t             bar;
    00077     int32_t             beat;
    00078     int32_t             tick;
    00079     double              bar_start_tick;
    00080
    00081     float               beats_per_bar;
    00082     float               beat_type;
    00083     double              ticks_per_beat;
    00084     double              beats_per_minute;
    00085
    00086     /* JackPositionTimecode fields:     (EXPERIMENTAL: could change) */
    00087     double              frame_time;
    00088     double              next_time;
    00091     /* JackBBTFrameOffset fields: */
    00092     jack_nframes_t      bbt_offset;
    00107     /* JACK video positional data (experimental) */
    00108
    00109     float               audio_frames_per_video_frame;
    00116     jack_nframes_t      video_offset;
    00123     /* For binary compatibility, new fields should be allocated from
    00124      * this padding area with new valid bits controlling access, so
    00125      * the existing structure size and offsets are preserved. */
    00126     int32_t             padding[7];
    00127
    00128     /* When (unique_1 == unique_2) the contents are consistent. */
    00129     jack_unique_t       unique_2;
    00131 } jack_position_t;
    00132
    00149 int  jack_release_timebase (jack_client_t *client);
    00150
    00172 typedef int  (*JackSyncCallback)(jack_transport_state_t state,
    00173                                  jack_position_t *pos,
    00174                                  void *arg);
    00175
    00196 int  jack_set_sync_callback (jack_client_t *client,
    00197                              JackSyncCallback sync_callback,
    00198                              void *arg);
    00199
    00217 int  jack_set_sync_timeout (jack_client_t *client,
    00218                             jack_time_t timeout);
    00219
    00249 typedef void (*JackTimebaseCallback)(jack_transport_state_t state,
    00250                                      jack_nframes_t nframes,
    00251                                      jack_position_t *pos,
    00252                                      int new_pos,
    00253                                      void *arg);
    00254
    00280 int  jack_set_timebase_callback (jack_client_t *client,
    00281                                  int conditional,
    00282                                  JackTimebaseCallback timebase_callback,
    00283                                  void *arg);
    00284
    00301 int  jack_transport_locate (jack_client_t *client,
    00302                             jack_nframes_t frame);
    00303
    00319 jack_transport_state_t jack_transport_query (const jack_client_t *client,
    00320                                              jack_position_t *pos);
    00321
    00329 jack_nframes_t jack_get_current_transport_frame (const jack_client_t *client);
    00330
    00347 int  jack_transport_reposition (jack_client_t *client,
    00348                                 jack_position_t *pos);
    00349
    00361 void jack_transport_start (jack_client_t *client);
    00362
    00371 void jack_transport_stop (jack_client_t *client);
    00372
    00373
    00374 /*********************************************************************
    00375  * The following interfaces are DEPRECATED.  They are only provided
    00376  * for compatibility with the earlier JACK transport implementation.
    00377  *********************************************************************/
    00378
    00384 typedef enum {
    00385
    00386         JackTransportState =    0x1,
    00387         JackTransportPosition = 0x2,
    00388         JackTransportLoop =     0x4,
    00389         JackTransportSMPTE =    0x8,
    00390         JackTransportBBT =      0x10
    00392 } jack_transport_bits_t;
    00393
    00400 typedef struct {
    00401
    00402     /* these two cannot be set from clients: the server sets them */
    00403
    00404     jack_nframes_t frame_rate;
    00405     jack_time_t    usecs;
    00407     jack_transport_bits_t  valid;
    00408     jack_transport_state_t transport_state;
    00409     jack_nframes_t         frame;
    00410     jack_nframes_t         loop_start;
    00411     jack_nframes_t         loop_end;
    00412
    00413     long           smpte_offset;
    00414     float          smpte_frame_rate;
    00416     int            bar;
    00417     int            beat;
    00418     int            tick;
    00419     double         bar_start_tick;
    00420
    00421     float          beats_per_bar;
    00422     float          beat_type;
    00423     double         ticks_per_beat;
    00424     double         beats_per_minute;
    00425
    00426 } jack_transport_info_t;
    00427
    00440 void jack_get_transport_info (jack_client_t *client,
    00441                               jack_transport_info_t *tinfo);
    00442
    00450 void jack_set_transport_info (jack_client_t *client,
    00451                               jack_transport_info_t *tinfo);
    00452
    00453 #ifdef __cplusplus
    00454 }
    00455 #endif
    00456
    00457 #endif /* __jack_transport_h__ */