fix sync delay

This commit is contained in:
Armin 2026-08-15 13:54:42 +02:00
commit 2e85d45983
4 changed files with 35 additions and 3 deletions

View file

@ -84,6 +84,11 @@ bool MindballAudioProcessor::isBusesLayoutSupported (const BusesLayout& layouts)
&& (mainIn == juce::AudioChannelSet::mono() || mainIn == juce::AudioChannelSet::stereo());
}
double MindballAudioProcessor::getCurrentBpm() const
{
return lastBpm.load (std::memory_order_relaxed);
}
void MindballAudioProcessor::processBlock (juce::AudioBuffer<float>& buffer, juce::MidiBuffer&)
{
juce::ScopedNoDenormals noDenormals;
@ -109,13 +114,14 @@ void MindballAudioProcessor::processBlock (juce::AudioBuffer<float>& buffer, juc
}
wasBypassed = false;
double bpm = 120.0;
double bpm = lastBpm.load (std::memory_order_relaxed);
if (auto* playHead = getPlayHead())
{
juce::AudioPlayHead::CurrentPositionInfo pos;
if (playHead->getCurrentPosition (pos))
bpm = pos.bpm > 0 ? pos.bpm : 120.0;
if (playHead->getCurrentPosition (pos) && pos.bpm > 0)
bpm = pos.bpm;
}
lastBpm.store (bpm, std::memory_order_relaxed);
mindball::DelayEngine::Params p;
p.feedback = *apvts.getRawParameterValue (ParameterIDs::feedback);