diff options
author | David Robillard <d@drobilla.net> | 2022-08-10 12:22:01 -0400 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2022-08-17 13:50:55 -0400 |
commit | 3651d42e50e4c2519718d5e33b22222c01848b87 (patch) | |
tree | fad9da38c7ce398533470b4afdec0d25c4dab043 | |
parent | e4880c661a1cb0273d6bbc3cfbc0c4a26bf6c4ab (diff) | |
download | jalv-3651d42e50e4c2519718d5e33b22222c01848b87.tar.gz jalv-3651d42e50e4c2519718d5e33b22222c01848b87.tar.bz2 jalv-3651d42e50e4c2519718d5e33b22222c01848b87.zip |
Fix spurious transport messages
The beats_per_minute from JACK is only valid if JackPositionBBT is set. On
some JACK implementations (at least pipewire), this value is otherwise garbage,
which causes a lot of transport message spam.
-rw-r--r-- | NEWS | 3 | ||||
-rw-r--r-- | src/jack.c | 7 |
2 files changed, 6 insertions, 4 deletions
@@ -12,13 +12,14 @@ jalv (1.6.7) unstable; urgency=medium * Fix man page headers * Fix memory leaks * Fix outdated man pages + * Fix spurious transport messages * Flush stdout after printing control values in console interface * Print status information consistently to stdout * Remove Gtkmm interface * Remove Qt4 support * Switch to meson build system - -- David Robillard <d@drobilla.net> Mon, 08 Aug 2022 22:39:54 +0000 + -- David Robillard <d@drobilla.net> Wed, 10 Aug 2022 16:17:35 +0000 jalv (1.6.6) stable; urgency=medium @@ -94,9 +94,10 @@ jack_process_cb(jack_nframes_t nframes, void* data) (jack_transport_query(client, &pos) == JackTransportRolling); // If transport state is not as expected, then something has changed + const bool has_bbt = (pos.valid & JackPositionBBT); const bool xport_changed = (rolling != jalv->rolling || pos.frame != jalv->position || - pos.beats_per_minute != jalv->bpm); + (has_bbt && pos.beats_per_minute != jalv->bpm)); uint8_t pos_buf[256]; LV2_Atom* lv2_pos = (LV2_Atom*)pos_buf; @@ -110,7 +111,7 @@ jack_process_cb(jack_nframes_t nframes, void* data) lv2_atom_forge_long(forge, pos.frame); lv2_atom_forge_key(forge, jalv->urids.time_speed); lv2_atom_forge_float(forge, rolling ? 1.0 : 0.0); - if (pos.valid & JackPositionBBT) { + if (has_bbt) { lv2_atom_forge_key(forge, jalv->urids.time_barBeat); lv2_atom_forge_float(forge, pos.beat - 1 + (pos.tick / pos.ticks_per_beat)); @@ -142,7 +143,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->bpm = has_bbt ? pos.beats_per_minute : jalv->bpm; jalv->rolling = rolling; switch (jalv->play_state) { |