From bd008fb87cff9f002df7681ccb22be4b493dfbde Mon Sep 17 00:00:00 2001 From: Todd Naugle Date: Tue, 10 Aug 2021 16:20:36 -0500 Subject: [PATCH] Mackie Control: Fix logic in timecode display update Old and new strings are compared before sending to keep traffic down. To ensure that we send all the required characters be sure to init the last value to characters that are never going to appear in a real string. Space is a bad choice since it is a valid character. Use NUL instead. --- libs/surfaces/mackie/mackie_control_protocol.cc | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/libs/surfaces/mackie/mackie_control_protocol.cc b/libs/surfaces/mackie/mackie_control_protocol.cc index 033fc4afff..d597a8a58f 100644 --- a/libs/surfaces/mackie/mackie_control_protocol.cc +++ b/libs/surfaces/mackie/mackie_control_protocol.cc @@ -121,6 +121,7 @@ MackieControlProtocol::MackieControlProtocol (Session& session) : ControlProtocol (session, X_("Mackie")) , AbstractUI (name()) , _current_initial_bank (0) + , _timecode_last (10, '\0') , _sample_last (0) , _timecode_type (ARDOUR::AnyTime::BBT) , _gui (0) @@ -1211,14 +1212,15 @@ MackieControlProtocol::update_timecode_display() return; } + string timecode; + // do assignment here so current_sample is fixed samplepos_t current_sample = session->transport_sample(); - string timecode; // For large jumps in play head possition do full reset int moved = (current_sample - _sample_last) / session->sample_rate (); if (moved) { DEBUG_TRACE (DEBUG::MackieControl, "Timecode reset\n"); - _timecode_last = string (10, ' '); + _timecode_last = string (10, '\0'); } _sample_last = current_sample; @@ -1375,7 +1377,7 @@ MackieControlProtocol::notify_transport_state_changed() update_global_button (Button::Ffwd, ffwd_button_onoff ()); // sometimes a return to start leaves time code at old time - _timecode_last = string (10, ' '); + _timecode_last = string (10, '\0'); notify_metering_state_changed (); }