stop MIDIClock transport master reporting continued timestamps
This commit is contained in:
parent
58e9bb0a14
commit
f0a395e7cd
|
@ -102,8 +102,7 @@ MIDIClock_TransportMaster::pre_process (MIDI::pframes_t nframes, samplepos_t now
|
|||
|
||||
/* no clock messages ever, or no clock messages for 1/4 second ? conclude that its stopped */
|
||||
|
||||
if (!last_timestamp || (now > last_timestamp && ((now - last_timestamp) > (ENGINE->sample_rate() / 4)))) {
|
||||
current.update (current.position, 0, 0);
|
||||
if (!current.timestamp || (now > current.timestamp && ((now - current.timestamp) > (ENGINE->sample_rate() / 4)))) {
|
||||
_bpm = 0.0;
|
||||
_running = false;
|
||||
_current_delta = 0;
|
||||
|
@ -113,11 +112,6 @@ MIDIClock_TransportMaster::pre_process (MIDI::pframes_t nframes, samplepos_t now
|
|||
return;
|
||||
}
|
||||
|
||||
if (!_running && midi_clock_count == 0 && session_pos) {
|
||||
current.update (*session_pos, now, current.speed);
|
||||
DEBUG_TRACE (DEBUG::MidiClock, string_compose ("set sbp to %1\n", current.position));
|
||||
}
|
||||
|
||||
if (session_pos) {
|
||||
const samplepos_t current_pos = current.position + ((now - current.timestamp) * current.speed);
|
||||
_current_delta = current_pos - *session_pos;
|
||||
|
@ -196,7 +190,7 @@ MIDIClock_TransportMaster::update_midi_clock (Parser& /*parser*/, samplepos_t ti
|
|||
* (quarters per minute, and fully initialize the DLL
|
||||
*/
|
||||
|
||||
e = timestamp - last_timestamp;
|
||||
e = timestamp - current.timestamp;
|
||||
|
||||
const samplecnt_t samples_per_quarter = e * 24;
|
||||
_bpm = (ENGINE->sample_rate() * 60.0) / samples_per_quarter;
|
||||
|
@ -223,7 +217,7 @@ MIDIClock_TransportMaster::update_midi_clock (Parser& /*parser*/, samplepos_t ti
|
|||
t1 += b * e + e2;
|
||||
e2 += c * e;
|
||||
|
||||
const double samples_per_quarter = (timestamp - last_timestamp) * 24.0;
|
||||
const double samples_per_quarter = (timestamp - current.timestamp) * 24.0;
|
||||
const double instantaneous_bpm = (ENGINE->sample_rate() * 60.0) / samples_per_quarter;
|
||||
const double lpf_coeff = 0.05;
|
||||
|
||||
|
@ -266,7 +260,7 @@ MIDIClock_TransportMaster::update_midi_clock (Parser& /*parser*/, samplepos_t ti
|
|||
_session->transport_sample(), // transport
|
||||
e, // error
|
||||
(t1 - t0) / one_ppqn_in_samples, // appspeed
|
||||
timestamp - last_timestamp, // read delta
|
||||
timestamp - current.timestamp, // read delta
|
||||
one_ppqn_in_samples, // should-be delta
|
||||
(t1 - t0), // t1-t0
|
||||
t0, // t0
|
||||
|
@ -276,8 +270,6 @@ MIDIClock_TransportMaster::update_midi_clock (Parser& /*parser*/, samplepos_t ti
|
|||
_running
|
||||
|
||||
));
|
||||
|
||||
last_timestamp = timestamp;
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -318,8 +310,6 @@ MIDIClock_TransportMaster::stop (Parser& /*parser*/, samplepos_t timestamp)
|
|||
|
||||
if (_running) {
|
||||
_running = false;
|
||||
_speed = 0;
|
||||
last_timestamp = 0;
|
||||
|
||||
// we need to go back to the last MIDI beat (6 ppqn)
|
||||
// and lets hope the tempo didnt change in the meantime :)
|
||||
|
@ -331,7 +321,7 @@ MIDIClock_TransportMaster::stop (Parser& /*parser*/, samplepos_t timestamp)
|
|||
//
|
||||
// find out the last MIDI beat: go back #midi_clocks mod 6
|
||||
// and lets hope the tempo didnt change in those last 6 beats :)
|
||||
current.update (current.position - (midi_clock_count % 6) * one_ppqn_in_samples, timestamp, current.speed);
|
||||
current.update (current.position - (midi_clock_count % 6) * one_ppqn_in_samples, 0, 0);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -402,7 +392,10 @@ std::string
|
|||
MIDIClock_TransportMaster::delta_string() const
|
||||
{
|
||||
char delta[80];
|
||||
if (last_timestamp == 0 || starting()) {
|
||||
SafeTime last;
|
||||
current.safe_read (last);
|
||||
|
||||
if (last.timestamp == 0 || starting()) {
|
||||
snprintf(delta, sizeof(delta), "\u2012\u2012\u2012\u2012");
|
||||
} else {
|
||||
snprintf(delta, sizeof(delta), "\u0394<span foreground=\"green\" face=\"monospace\" >%s%s%" PRIi64 "</span>sm",
|
||||
|
|
Loading…
Reference in New Issue
Block a user