aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--NEWS3
-rw-r--r--src/jalv.c5
-rw-r--r--src/jalv_internal.h1
3 files changed, 7 insertions, 2 deletions
diff --git a/NEWS b/NEWS
index b432542..6f653a1 100644
--- a/NEWS
+++ b/NEWS
@@ -1,8 +1,9 @@
jalv (1.2.1) unstable;
+ * Send new time information to plugin when Jack tempo changes
* Add menu bar and pass parent widget in Qt version for true UI embedding
- -- David Robillard <d@drobilla.net> Tue, 13 Nov 2012 22:02:45 -0500
+ -- David Robillard <d@drobilla.net> Thu, 15 Nov 2012 20:16:15 -0500
jalv (1.2.0) stable;
diff --git a/src/jalv.c b/src/jalv.c
index b88f1e3..70e9028 100644
--- a/src/jalv.c
+++ b/src/jalv.c
@@ -362,7 +362,8 @@ jack_process_cb(jack_nframes_t nframes, void* data)
/* If transport state is not as expected, then something has changed */
const bool xport_changed = (rolling != jalv->rolling ||
- pos.frame != jalv->position);
+ pos.frame != jalv->position ||
+ pos.beats_per_minute != jalv->bpm);
uint8_t pos_buf[256];
LV2_Atom* lv2_pos = (LV2_Atom*)pos_buf;
@@ -401,6 +402,7 @@ jack_process_cb(jack_nframes_t nframes, void* data)
/* Update transport state to expected values for next cycle */
jalv->position = rolling ? pos.frame + nframes : pos.frame;
+ jalv->bpm = pos.beats_per_minute;
jalv->rolling = rolling;
switch (jalv->play_state) {
@@ -753,6 +755,7 @@ main(int argc, char** argv)
jalv.block_length = 4096; // Should be set by jack_buffer_size_cb
jalv.midi_buf_size = 1024; // Should be set by jack_buffer_size_cb
jalv.play_state = JALV_PAUSED;
+ jalv.bpm = 120.0f;
if (jalv_init(&argc, &argv, &jalv.opts)) {
return EXIT_FAILURE;
diff --git a/src/jalv_internal.h b/src/jalv_internal.h
index 4bb600a..3c66f68 100644
--- a/src/jalv_internal.h
+++ b/src/jalv_internal.h
@@ -181,6 +181,7 @@ typedef struct {
jack_nframes_t event_delta_t; ///< Frames since last update sent to UI
uint32_t midi_event_id; ///< MIDI event class ID in event context
jack_nframes_t position; ///< Transport position in frames
+ float bpm; ///< Transport tempo in beats per minute
bool rolling; ///< Transport speed (0=stop, 1=play)
bool buf_size_set; ///< True iff buffer size callback fired
bool exit; ///< True iff execution is finished