transport.h
Go to the documentation of this file.
/*
Copyright (C) 2002 Paul Davis
Copyright (C) 2003 Jack O'Quin
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2.1 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#ifndef __jack_transport_h__
#define __jack_transport_h__
#ifdef __cplusplus
extern "C" {
#endif
#include <jack/types.h>
#include <jack/weakmacros.h>
#ifndef
#ifdef __GNUC__
/* needs to be a macro which
expands into a compiler directive. The directive must
tell the compiler to arrange the preceding structure
declaration so that it is packed on byte-boundaries rather
than use the natural alignment of the processor and/or
compiler.
*/
#define __attribute__((__packed__))
#else
/* Add other things here for non-gcc platforms */
#endif
#endif
typedef enum {
/* the order matters for binary compatibility */
JackTransportStopped = 0,
JackTransportRolling = 1,
JackTransportLooping = 2,
JackTransportStarting = 3
} jack_transport_state_t;
typedef uint64_t jack_unique_t;
typedef enum {
JackPositionBBT = 0x10,
JackPositionTimecode = 0x20,
JackBBTFrameOffset = 0x40,
JackAudioVideoRatio = 0x80,
JackVideoFrameOffset = 0x100
} jack_position_bits_t;
#define JACK_POSITION_MASK (JackPositionBBT|JackPositionTimecode|JackBBTFrameOffset|JackAudioVideoRatio|JackVideoFrameOffset)
#define EXTENDED_TIME_INFO
typedef struct {
jack_unique_t unique_1;
jack_time_t usecs;
jack_nframes_t frame_rate;
/*}@*/
jack_nframes_t frame;
jack_position_bits_t valid;
/*}@*/
int32_t bar;
int32_t beat;
int32_t tick;
double bar_start_tick;
float beats_per_bar;
float beat_type;
double ticks_per_beat;
double beats_per_minute;
/*}@*/
double frame_time;
double next_time;
/*}@*/
/* JackBBTFrameOffset fields */
jack_nframes_t bbt_offset;
/*}@*/
/* JACK video positional data
* EXPERIMENTAL: could change */
float audio_frames_per_video_frame;
jack_nframes_t video_offset;
/*}@*/
/* For binary compatibility, new fields should be allocated from
* this padding area with new valid bits controlling access, so
* the existing structure size and offsets are preserved. */
int32_t padding[7];
/*}@*/
/* When (unique_1 == unique_2) the contents are consistent. */
jack_unique_t unique_2;
} jack_position_t;
int jack_release_timebase (jack_client_t *client) JACK_OPTIONAL_WEAK_EXPORT;
typedef int (*JackSyncCallback)(jack_transport_state_t state,
jack_position_t *pos,
void *arg);
int jack_set_sync_callback (jack_client_t *client,
JackSyncCallback sync_callback,
void *arg) JACK_OPTIONAL_WEAK_EXPORT;
int jack_set_sync_timeout (jack_client_t *client,
jack_time_t timeout) JACK_OPTIONAL_WEAK_EXPORT;
typedef void (*JackTimebaseCallback)(jack_transport_state_t state,
jack_nframes_t nframes,
jack_position_t *pos,
int new_pos,
void *arg);
int jack_set_timebase_callback (jack_client_t *client,
int conditional,
JackTimebaseCallback timebase_callback,
void *arg) JACK_OPTIONAL_WEAK_EXPORT;
int jack_transport_locate (jack_client_t *client,
jack_nframes_t frame) JACK_OPTIONAL_WEAK_EXPORT;
jack_transport_state_t jack_transport_query (const jack_client_t *client,
jack_position_t *pos) JACK_OPTIONAL_WEAK_EXPORT;
jack_nframes_t jack_get_current_transport_frame (const jack_client_t *client) JACK_OPTIONAL_WEAK_EXPORT;
int jack_transport_reposition (jack_client_t *client,
jack_position_t *pos) JACK_OPTIONAL_WEAK_EXPORT;
void jack_transport_start (jack_client_t *client) JACK_OPTIONAL_WEAK_EXPORT;
void jack_transport_stop (jack_client_t *client) JACK_OPTIONAL_WEAK_EXPORT;
/*********************************************************************
* The following interfaces are DEPRECATED. They are only provided
* for compatibility with the earlier JACK transport implementation.
*********************************************************************/
typedef enum {
JackTransportState = 0x1,
JackTransportPosition = 0x2,
JackTransportLoop = 0x4,
JackTransportSMPTE = 0x8,
JackTransportBBT = 0x10
} jack_transport_bits_t;
typedef struct {
/* these two cannot be set from clients: the server sets them */
jack_nframes_t frame_rate;
jack_time_t usecs;
jack_transport_bits_t valid;
jack_transport_state_t transport_state;
jack_nframes_t frame;
jack_nframes_t loop_start;
jack_nframes_t loop_end;
long smpte_offset;
float smpte_frame_rate;
int bar;
int beat;
int tick;
double bar_start_tick;
float beats_per_bar;
float beat_type;
double ticks_per_beat;
double beats_per_minute;
} jack_transport_info_t;
void jack_get_transport_info (jack_client_t *client,
jack_transport_info_t *tinfo) JACK_OPTIONAL_WEAK_DEPRECATED_EXPORT;
void jack_set_transport_info (jack_client_t *client,
jack_transport_info_t *tinfo) JACK_OPTIONAL_WEAK_DEPRECATED_EXPORT;
#ifdef __cplusplus
}
#endif
#endif /* __jack_transport_h__ */