mirror of
https://github.com/juce-framework/JUCE.git
synced 2026-01-10 23:44:24 +00:00
AU/AUv3: Ensured that prepareToPlay is called when an AU host enables/disables non-realtime mode
This commit is contained in:
parent
331bd17aa5
commit
55a917ebe5
2 changed files with 28 additions and 2 deletions
|
|
@ -610,10 +610,24 @@ public:
|
|||
}
|
||||
|
||||
case kAudioUnitProperty_OfflineRender:
|
||||
{
|
||||
auto shouldBeRealtime = (*reinterpret_cast<const UInt32*> (inData) != 0);
|
||||
|
||||
if (juceFilter != nullptr)
|
||||
juceFilter->setNonRealtime ((*(UInt32*) inData) != 0);
|
||||
{
|
||||
auto isCurrentlyRealtime = juceFilter->isNonRealtime();
|
||||
|
||||
if (isCurrentlyRealtime != shouldBeRealtime)
|
||||
{
|
||||
const ScopedLock sl (juceFilter->getCallbackLock());
|
||||
|
||||
juceFilter->setNonRealtime (shouldBeRealtime);
|
||||
juceFilter->prepareToPlay (getSampleRate(), (int) GetMaxFramesPerSlice());
|
||||
}
|
||||
}
|
||||
|
||||
return noErr;
|
||||
}
|
||||
|
||||
default: break;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -692,7 +692,19 @@ public:
|
|||
//==============================================================================
|
||||
AUInternalRenderBlock getInternalRenderBlock() override { return internalRenderBlock; }
|
||||
bool getRenderingOffline() override { return getAudioProcessor().isNonRealtime(); }
|
||||
void setRenderingOffline (bool offline) override { getAudioProcessor().setNonRealtime (offline); }
|
||||
void setRenderingOffline (bool offline) override
|
||||
{
|
||||
auto& processor = getAudioProcessor();
|
||||
auto isCurrentlyNonRealtime = processor.isNonRealtime();
|
||||
|
||||
if (isCurrentlyNonRealtime != offline)
|
||||
{
|
||||
ScopedLock callbackLock (processor.getCallbackLock());
|
||||
|
||||
processor.setNonRealtime (offline);
|
||||
processor.prepareToPlay (processor.getSampleRate(), processor.getBlockSize());
|
||||
}
|
||||
}
|
||||
|
||||
//==============================================================================
|
||||
NSString* getContextName() const override { return juceStringToNS (contextName); }
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue