Fixed deprecated getCurrentPosition

This commit is contained in:
Takeshi Yokemura 2024-01-14 22:44:50 +09:00
parent f6116fe0b4
commit e0fc77f51b

View File

@ -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;
}
//==============================================================================