fixed midi sync led

This commit is contained in:
2025-08-18 21:42:19 +02:00
parent ed737f526f
commit 7e11e3e72b
2 changed files with 13 additions and 3 deletions
+2 -1
View File
@@ -183,12 +183,13 @@ void JK_MidiClock::generateMidiclock(const AudioPlayHead::CurrentPositionInfo &p
if (m_sample_remain == 0) if (m_sample_remain == 0)
{ {
m_sample_remain = clockDistanceInSamples; m_sample_remain = clockDistanceInSamples;
#if 0
SynthDebug("posInBuffer : %d", posInBuffer); SynthDebug("posInBuffer : %d", posInBuffer);
SynthDebug("clockDistanceInSamples_f (soll) : %f", clockDistanceInSamples_f); SynthDebug("clockDistanceInSamples_f (soll) : %f", clockDistanceInSamples_f);
SynthDebug("hostPpqPosition : %f", hostPpqPosition); SynthDebug("hostPpqPosition : %f", hostPpqPosition);
SynthDebug("hostPpqPosition (Q) : %f", getNearestInPPQ(hostPpqPosition, 96)); SynthDebug("hostPpqPosition (Q) : %f", getNearestInPPQ(hostPpqPosition, 96));
SynthDebug("hostSamplePos (Q) : %f", getNearestInPPQ(hostPpqPosition, 96) * quant); SynthDebug("hostSamplePos (Q) : %f", getNearestInPPQ(hostPpqPosition, 96) * quant);
#endif
midiBuffer->addEvent(*m_clockMessage, roundToInt(posInBuffer)); midiBuffer->addEvent(*m_clockMessage, roundToInt(posInBuffer));
} }
} }
+11 -2
View File
@@ -1137,8 +1137,10 @@ void JaySynth::handleMidiEvent (const MidiMessage& m)
if (m.isSongPositionPointer()) if (m.isSongPositionPointer())
{ {
SynthDebug("SongPositionPointer\n"); SynthDebug("SongPositionPointer\n");
m_clock_cnt_bar = (6 * m.getSongPositionPointerMidiBeat()) % m_numMidiClocksPerBar; double bar_16 = 1 + ((double)m.getSongPositionPointerMidiBeat()/4);
SynthDebug("getSongPositionPointerMidiBeat(): %u -> %u clocks\n", m.getSongPositionPointerMidiBeat(), m_clock_cnt_bar); double bar_4 = (bar_16 - (int)bar_16);
m_clock_cnt_bar = (int)(bar_4*4);
SynthDebug("getSongPositionPointerMidiBeat(): %f -> %u clocks", bar_4, m_clock_cnt_bar);
} }
if (m.isQuarterFrame()) if (m.isQuarterFrame())
{ {
@@ -1171,10 +1173,17 @@ void JaySynth::handleMidiEvent (const MidiMessage& m)
info.bpm = (uint32_t)(bpm + 0.5); info.bpm = (uint32_t)(bpm + 0.5);
info.type = 1; info.type = 1;
if (m_clock_cnt_bar == 0) if (m_clock_cnt_bar == 0)
{ {
info.type = 2; info.type = 2;
SynthDebug("1111111111111111111111111");
} }
else
{
SynthDebug("-------------------------");
}
listeners.call (&JaySynthListener::synthChanged, SYNTH_CHANGED_MIDICLOCK, &info); listeners.call (&JaySynthListener::synthChanged, SYNTH_CHANGED_MIDICLOCK, &info);
} }
} }