1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-11-21 16:37:12 +01:00

Revert "Bug 2431 - Mac: Real-time effects - Enable checkbox has no effect"

... so I can make a more general fix, for more than only AudioUnit effects

This reverts commit 5e8cfb0c5a.
This commit is contained in:
Paul Licameli
2020-05-29 20:42:18 -04:00
parent a4b0635dd5
commit 9894abc4f4
2 changed files with 36 additions and 99 deletions

View File

@@ -87,13 +87,9 @@ 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
@@ -363,20 +359,16 @@ 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;
}
@@ -860,8 +852,6 @@ AudioUnitEffect::AudioUnitEffect(const PluginPath & path,
mUnitInitialized = false;
mEventListenerRef = NULL;
mReady = false;
}
AudioUnitEffect::~AudioUnitEffect()
@@ -1357,18 +1347,14 @@ 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));
@@ -1379,9 +1365,7 @@ 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();
@@ -1392,36 +1376,18 @@ 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()
{
if (!BypassEffect(false))
{
return false;
}
OSStatus result;
for (size_t i = 0, cnt = mSlaves.size(); i < cnt; i++)
{
if (!mSlaves[i]->BypassEffect(false))
result = AudioUnitReset(mUnit, kAudioUnitScope_Global, 0);
if (result != noErr)
{
return false;
}
}
return true;
}
@@ -1429,9 +1395,7 @@ bool AudioUnitEffect::RealtimeResume()
bool AudioUnitEffect::RealtimeProcessStart()
{
for (size_t i = 0; i < mAudioIns; i++)
{
memset(mMasterIn[i].get(), 0, mBlockSize * sizeof(float));
}
mNumSamples = 0;
@@ -1459,23 +1423,21 @@ 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;
}
@@ -1483,10 +1445,7 @@ bool AudioUnitEffect::ShowInterface(wxWindow &parent,
auto cleanup = valueRestorer( mDialog );
if ( factory )
{
mDialog = factory(parent, mHost, this);
}
if (!mDialog)
{
return false;
@@ -2688,24 +2647,4 @@ 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

View File

@@ -172,8 +172,6 @@ private:
bool CreatePlain(wxWindow *parent);
#endif
bool BypassEffect(bool bypass);
private:
PluginPath mPath;