Browse Source

changes to transport utils to use video and BBT offset info

git-svn-id: svn+ssh://jackaudio.org/trunk/jack@953 0c269be4-1314-0410-8aa9-9f06e86f4224
tags/0.109.0
pbd 20 years ago
parent
commit
8760fe93c3
2 changed files with 40 additions and 1 deletions
  1. +17
    -0
      example-clients/showtime.c
  2. +23
    -1
      example-clients/transport.c

+ 17
- 0
example-clients/showtime.c View File

@@ -43,6 +43,23 @@ showtime ()
if (current.valid & JackPositionTimecode)
printf ("\tTC: (%.6f, %.6f)",
current.frame_time, current.next_time);

if (current.valid & JackBBTFrameOffset)
printf ("\tBBT offset: (%" PRIi32 ")",
current.bbt_offset);

if (current.valid & JackAudioVideoRatio)
printf ("\taudio/video: (%f)",
current.audio_frames_per_video_frame);

if (current.valid & JackVideoFrameOffset) {
if (current.video_offset) {
printf ("\t video@: (%" PRIi32 ")", current.video_offset);
} else {
printf ("\t no video");
}
}
printf ("\n");
}



+ 23
- 1
example-clients/transport.c View File

@@ -42,6 +42,8 @@ float time_beat_type = 4.0;
double time_ticks_per_beat = 1920.0;
double time_beats_per_minute = 120.0;
volatile int time_reset = 1; /* true when time values change */
volatile int avr_set = 0;
float audio_frames_per_video_frame;

/* JACK timebase callback.
*
@@ -67,7 +69,8 @@ void timebase(jack_transport_state_t state, jack_nframes_t nframes,
/* Compute BBT info from frame number. This is relatively
* simple here, but would become complex if we supported tempo
* or time signature changes at specific locations in the
* transport timeline. */
* transport timeline.
*/

min = pos->frame / ((double) pos->frame_rate * 60.0);
abs_tick = min * pos->beats_per_minute * pos->ticks_per_beat;
@@ -105,6 +108,11 @@ void timebase(jack_transport_state_t state, jack_nframes_t nframes,
}
}
}

if (avr_set) {
pos->valid |= JackAudioVideoRatio;
pos->audio_frames_per_video_frame = audio_frames_per_video_frame;
}
}

void jack_shutdown(void *arg)
@@ -204,6 +212,19 @@ void com_timeout(char *arg)
}


/* Change the tempo for the entire timeline, not just from the current
* location. */
void com_av_ratio(char *arg)
{
float avr = 0;

if (*arg != '\0')
avr = atof(arg);

audio_frames_per_video_frame = avr;
avr_set = 1;
}

/* Command parsing based on GNU readline info examples. */

typedef void cmd_function_t(char *); /* command function type */
@@ -218,6 +239,7 @@ typedef struct {
/* command table must be in alphabetical order */
command_t commands[] = {
{"activate", com_activate, "Call jack_activate()"},
{"avr", com_av_ratio, "Set audio/video frame ratio <audio frames per video frame>"},
{"exit", com_exit, "Exit transport program"},
{"deactivate", com_deactivate, "Call jack_deactivate()"},
{"help", com_help, "Display help text [<command>]"},


Loading…
Cancel
Save