mirror of
https://github.com/cookiengineer/audacity
synced 2025-06-16 08:09:32 +02:00
Bug 2431 - Mac: Real-time effects - Enable checkbox has no effect
This commit is contained in:
parent
2272055d44
commit
5e8cfb0c5a
@ -87,9 +87,13 @@ BlackList[] =
|
||||
};
|
||||
|
||||
struct CFReleaser
|
||||
{ void operator () (const void *p) const { if (p) CFRelease(p); } };
|
||||
template <typename T>
|
||||
using CFunique_ptr = std::unique_ptr<T, CFReleaser>;
|
||||
{
|
||||
void operator () (const void *p) const
|
||||
{
|
||||
if (p) CFRelease(p);
|
||||
}
|
||||
};
|
||||
template <typename T> using CFunique_ptr = std::unique_ptr<T, CFReleaser>;
|
||||
|
||||
// Uncomment to include parameter IDs in the final name. Only needed if it's
|
||||
// discovered that many effects have duplicate names. It could even be done
|
||||
@ -361,16 +365,20 @@ unsigned AudioUnitEffectsModule::DiscoverPluginsAtPath(
|
||||
}
|
||||
|
||||
if (callback)
|
||||
{
|
||||
callback(this, &effect);
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
bool AudioUnitEffectsModule::IsPluginValid(
|
||||
const PluginPath & path, bool bFast)
|
||||
bool AudioUnitEffectsModule::IsPluginValid(const PluginPath & path, bool bFast)
|
||||
{
|
||||
if (bFast)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
wxString name;
|
||||
return FindAudioUnit(path, name) != NULL;
|
||||
}
|
||||
@ -854,6 +862,8 @@ AudioUnitEffect::AudioUnitEffect(const PluginPath & path,
|
||||
mUnitInitialized = false;
|
||||
|
||||
mEventListenerRef = NULL;
|
||||
|
||||
mReady = false;
|
||||
}
|
||||
|
||||
AudioUnitEffect::~AudioUnitEffect()
|
||||
@ -1349,14 +1359,18 @@ bool AudioUnitEffect::RealtimeAddProcessor(unsigned numChannels, float sampleRat
|
||||
{
|
||||
auto slave = std::make_unique<AudioUnitEffect>(mPath, mName, mComponent, this);
|
||||
if (!slave->SetHost(NULL))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
slave->SetBlockSize(mBlockSize);
|
||||
slave->SetChannelCount(numChannels);
|
||||
slave->SetSampleRate(sampleRate);
|
||||
|
||||
if (!CopyParameters(mUnit, slave->mUnit))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
auto pSlave = slave.get();
|
||||
mSlaves.push_back(std::move(slave));
|
||||
@ -1367,7 +1381,9 @@ bool AudioUnitEffect::RealtimeAddProcessor(unsigned numChannels, float sampleRat
|
||||
bool AudioUnitEffect::RealtimeFinalize()
|
||||
{
|
||||
for (size_t i = 0, cnt = mSlaves.size(); i < cnt; i++)
|
||||
{
|
||||
mSlaves[i]->ProcessFinalize();
|
||||
}
|
||||
mSlaves.clear();
|
||||
|
||||
mMasterIn.reset();
|
||||
@ -1378,26 +1394,46 @@ bool AudioUnitEffect::RealtimeFinalize()
|
||||
|
||||
bool AudioUnitEffect::RealtimeSuspend()
|
||||
{
|
||||
if (!BypassEffect(true))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
for (size_t i = 0, cnt = mSlaves.size(); i < cnt; i++)
|
||||
{
|
||||
if (!mSlaves[i]->BypassEffect(true))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool AudioUnitEffect::RealtimeResume()
|
||||
{
|
||||
OSStatus result;
|
||||
|
||||
result = AudioUnitReset(mUnit, kAudioUnitScope_Global, 0);
|
||||
if (result != noErr)
|
||||
if (!BypassEffect(false))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
for (size_t i = 0, cnt = mSlaves.size(); i < cnt; i++)
|
||||
{
|
||||
if (!mSlaves[i]->BypassEffect(false))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool AudioUnitEffect::RealtimeProcessStart()
|
||||
{
|
||||
for (size_t i = 0; i < mAudioIns; i++)
|
||||
{
|
||||
memset(mMasterIn[i].get(), 0, mBlockSize * sizeof(float));
|
||||
}
|
||||
|
||||
mNumSamples = 0;
|
||||
|
||||
@ -1425,21 +1461,23 @@ size_t AudioUnitEffect::RealtimeProcess(int group,
|
||||
|
||||
bool AudioUnitEffect::RealtimeProcessEnd()
|
||||
{
|
||||
ProcessBlock(
|
||||
reinterpret_cast<float**>(mMasterIn.get()),
|
||||
ProcessBlock(reinterpret_cast<float**>(mMasterIn.get()),
|
||||
reinterpret_cast<float**>(mMasterOut.get()),
|
||||
mNumSamples);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool AudioUnitEffect::ShowInterface(
|
||||
wxWindow &parent, const EffectDialogFactory &factory, bool forceModal)
|
||||
bool AudioUnitEffect::ShowInterface(wxWindow &parent,
|
||||
const EffectDialogFactory &factory,
|
||||
bool forceModal)
|
||||
{
|
||||
if (mDialog)
|
||||
{
|
||||
if (mDialog->Close(true))
|
||||
{
|
||||
mDialog = nullptr;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -1447,7 +1485,10 @@ bool AudioUnitEffect::ShowInterface(
|
||||
auto cleanup = valueRestorer(mDialog);
|
||||
|
||||
if (factory)
|
||||
{
|
||||
mDialog = factory(parent, mHost, this);
|
||||
}
|
||||
|
||||
if (!mDialog)
|
||||
{
|
||||
return false;
|
||||
@ -2649,4 +2690,24 @@ void AudioUnitEffect::GetChannelCounts()
|
||||
return;
|
||||
}
|
||||
|
||||
bool AudioUnitEffect::BypassEffect(bool bypass)
|
||||
{
|
||||
OSStatus result;
|
||||
|
||||
UInt32 value = (bypass ? 1 : 0);
|
||||
|
||||
result = AudioUnitSetProperty(mUnit,
|
||||
kAudioUnitProperty_BypassEffect,
|
||||
kAudioUnitScope_Global,
|
||||
0,
|
||||
&value,
|
||||
sizeof(value));
|
||||
if (result != noErr)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@ -172,6 +172,8 @@ private:
|
||||
bool CreatePlain(wxWindow *parent);
|
||||
#endif
|
||||
|
||||
bool BypassEffect(bool bypass);
|
||||
|
||||
private:
|
||||
|
||||
PluginPath mPath;
|
||||
|
Loading…
x
Reference in New Issue
Block a user