From e0fc77f51b40dcedefa4ecd77f456e1991bfd621 Mon Sep 17 00:00:00 2001 From: Takeshi Yokemura Date: Sun, 14 Jan 2024 22:44:50 +0900 Subject: [PATCH] Fixed deprecated getCurrentPosition --- Source/PluginProcessor.cpp | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/Source/PluginProcessor.cpp b/Source/PluginProcessor.cpp index 3e6a866..a18572f 100644 --- a/Source/PluginProcessor.cpp +++ b/Source/PluginProcessor.cpp @@ -241,15 +241,10 @@ void Magical8bitPlug2AudioProcessor::setupVoice() double Magical8bitPlug2AudioProcessor::getCurrentBPM() { - auto ph = getPlayHead(); - if (ph == NULL) - { - return 120.0; - } - juce::AudioPlayHead::CurrentPositionInfo result; - ph->getCurrentPosition(result); - - return result.bpm > 0 ? result.bpm : 120.0; + double bpm { 120 }; // default fallback when host does not provide info + if (auto bpmFromHost = *getPlayHead()->getPosition()->getBpm()) + bpm = bpmFromHost; + return bpm; } //==============================================================================