commit bbe8abf4bb5f7c1975e3fbc94de7a36e183dcf2c
parent 10d2fe481ad58860d5f2529e608015a43ccce948
Author: dsp56300 <dsp56300@users.noreply.github.com>
Date: Sat, 12 Feb 2022 14:10:10 +0100
fix midi clock timing issue because midi clock start event was missing
Diffstat:
2 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/source/synthLib/plugin.cpp b/source/synthLib/plugin.cpp
@@ -115,8 +115,6 @@ namespace synthLib
if(_bpm < 1.0f)
return;
- auto needsStart = false;
-
if(_isPlaying && !m_isPlaying)
{
const uint32_t beat = dsp56k::floor_int(_ppqPos);
@@ -125,7 +123,7 @@ namespace synthLib
{
// start
m_isPlaying = true;
- needsStart = true;
+ m_needsStart = true;
}
m_lastKnownBeat = beat;
}
@@ -174,7 +172,7 @@ namespace synthLib
{
if(static_cast<int>(it->offset) > insertPos)
{
- evClock.a = needsStart ? M_START : M_TIMINGCLOCK;
+ evClock.a = m_needsStart ? M_START : M_TIMINGCLOCK;
evClock.offset = insertPos;
m_midiIn.insert(it, evClock);
found = true;
@@ -185,13 +183,14 @@ namespace synthLib
if(midiEventsEmpty || !found)
{
- evClock.a = needsStart ? M_START : M_TIMINGCLOCK;
+ evClock.a = m_needsStart ? M_START : M_TIMINGCLOCK;
evClock.offset = insertPos;
m_midiIn.push_back(evClock);
}
- needsStart = false;
m_clockTickPos += 1.0f;
+
+ m_needsStart = false;
}
}
}
diff --git a/source/synthLib/plugin.h b/source/synthLib/plugin.h
@@ -63,6 +63,7 @@ namespace synthLib
// MIDI Clock
bool m_isPlaying = false;
+ bool m_needsStart = false;
uint32_t m_lastKnownBeat = 0;
float m_clockTickPos = 0.0f;
};