JACK-AUDIO-CONNECTION-KIT 0.121.2
|
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 00086 jack_unique_t unique_1; 00087 jack_time_t usecs; 00095 jack_nframes_t frame_rate; 00096 /*}@*/ 00097 00101 jack_nframes_t frame; 00107 jack_position_bits_t valid; 00110 /*}@*/ 00111 00119 int32_t bar; 00123 int32_t beat; 00128 int32_t tick; 00132 double bar_start_tick; 00136 float beats_per_bar; 00137 float beat_type; 00138 double ticks_per_beat; 00143 double beats_per_minute; 00151 /*}@*/ 00152 00156 double frame_time; 00157 double next_time; 00159 /*}@*/ 00160 00162 /* JackBBTFrameOffset fields */ 00163 jack_nframes_t bbt_offset; 00177 /*}@*/ 00178 00180 /* JACK video positional data 00181 * EXPERIMENTAL: could change */ 00182 float audio_frames_per_video_frame; 00189 jack_nframes_t video_offset; 00195 /*}@*/ 00196 00199 /* For binary compatibility, new fields should be allocated from 00200 * this padding area with new valid bits controlling access, so 00201 * the existing structure size and offsets are preserved. */ 00202 int32_t padding[7]; 00203 /*}@*/ 00204 00205 /* When (unique_1 == unique_2) the contents are consistent. */ 00206 jack_unique_t unique_2; 00208 } jack_position_t; 00209 00231 int jack_release_timebase (jack_client_t *client) JACK_OPTIONAL_WEAK_EXPORT; 00232 00254 typedef int (*JackSyncCallback)(jack_transport_state_t state, 00255 jack_position_t *pos, 00256 void *arg); 00257 00278 int jack_set_sync_callback (jack_client_t *client, 00279 JackSyncCallback sync_callback, 00280 void *arg) JACK_OPTIONAL_WEAK_EXPORT; 00281 00299 int jack_set_sync_timeout (jack_client_t *client, 00300 jack_time_t timeout) JACK_OPTIONAL_WEAK_EXPORT; 00301 00331 typedef void (*JackTimebaseCallback)(jack_transport_state_t state, 00332 jack_nframes_t nframes, 00333 jack_position_t *pos, 00334 int new_pos, 00335 void *arg); 00336 00364 int jack_set_timebase_callback (jack_client_t *client, 00365 int conditional, 00366 JackTimebaseCallback timebase_callback, 00367 void *arg) JACK_OPTIONAL_WEAK_EXPORT; 00368 00385 int jack_transport_locate (jack_client_t *client, 00386 jack_nframes_t frame) JACK_OPTIONAL_WEAK_EXPORT; 00387 00403 jack_transport_state_t jack_transport_query (const jack_client_t *client, 00404 jack_position_t *pos) JACK_OPTIONAL_WEAK_EXPORT; 00405 00413 jack_nframes_t jack_get_current_transport_frame (const jack_client_t *client) JACK_OPTIONAL_WEAK_EXPORT; 00414 00433 int jack_transport_reposition (jack_client_t *client, 00434 jack_position_t *pos) JACK_OPTIONAL_WEAK_EXPORT; 00435 00447 void jack_transport_start (jack_client_t *client) JACK_OPTIONAL_WEAK_EXPORT; 00448 00457 void jack_transport_stop (jack_client_t *client) JACK_OPTIONAL_WEAK_EXPORT; 00458 00461 /********************************************************************* 00462 * The following interfaces are DEPRECATED. They are only provided 00463 * for compatibility with the earlier JACK transport implementation. 00464 *********************************************************************/ 00465 00471 typedef enum { 00472 00473 JackTransportState = 0x1, 00474 JackTransportPosition = 0x2, 00475 JackTransportLoop = 0x4, 00476 JackTransportSMPTE = 0x8, 00477 JackTransportBBT = 0x10 00479 } jack_transport_bits_t; 00480 00487 typedef struct { 00488 00489 /* these two cannot be set from clients: the server sets them */ 00490 00491 jack_nframes_t frame_rate; 00492 jack_time_t usecs; 00494 jack_transport_bits_t valid; 00495 jack_transport_state_t transport_state; 00496 jack_nframes_t frame; 00497 jack_nframes_t loop_start; 00498 jack_nframes_t loop_end; 00499 00500 long smpte_offset; 00501 float smpte_frame_rate; 00503 int bar; 00504 int beat; 00505 int tick; 00506 double bar_start_tick; 00507 00508 float beats_per_bar; 00509 float beat_type; 00510 double ticks_per_beat; 00511 double beats_per_minute; 00512 00513 } jack_transport_info_t; 00514 00527 void jack_get_transport_info (jack_client_t *client, 00528 jack_transport_info_t *tinfo) JACK_OPTIONAL_WEAK_DEPRECATED_EXPORT; 00529 00537 void jack_set_transport_info (jack_client_t *client, 00538 jack_transport_info_t *tinfo) JACK_OPTIONAL_WEAK_DEPRECATED_EXPORT; 00539 00540 #ifdef __cplusplus 00541 } 00542 #endif 00543 00544 #endif /* __jack_transport_h__ */ 00545