1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-07-17 17:17:40 +02:00

Make EXPERIMENTAL_EFFECTS_RACK compilable

This commit is contained in:
Paul Licameli 2016-04-03 09:42:16 -04:00
parent 8ae361d415
commit 2e5d24ab02
2 changed files with 10 additions and 27 deletions

View File

@ -359,26 +359,17 @@ void EffectManager::ShowRack()
void EffectManager::RealtimeSetEffects(const EffectArray & effects) void EffectManager::RealtimeSetEffects(const EffectArray & effects)
{ {
int newCount = (int) effects.GetCount();
Effect **newEffects = new Effect *[newCount];
for (int i = 0; i < newCount; i++)
{
newEffects[i] = effects[i];
}
// Block RealtimeProcess() // Block RealtimeProcess()
RealtimeSuspend(); RealtimeSuspend();
// Tell any effects no longer in the chain to clean up // Tell any effects no longer in the chain to clean up
for (int i = 0; i < mRealtimeCount; i++) for (auto e: mRealtimeEffects)
{ {
Effect *e = mRealtimeEffects[i];
// Scan the NEW chain for the effect // Scan the NEW chain for the effect
for (int j = 0; j < newCount; j++) for (auto e1: effects)
{ {
// Found it so we're done // Found it so we're done
if (e == newEffects[j]) if (e == e1)
{ {
e = NULL; e = NULL;
break; break;
@ -393,17 +384,16 @@ void EffectManager::RealtimeSetEffects(const EffectArray & effects)
} }
// Tell any NEW effects to get ready // Tell any NEW effects to get ready
for (int i = 0; i < newCount; i++) for (auto e : effects)
{ {
Effect *e = newEffects[i];
// Scan the old chain for the effect // Scan the old chain for the effect
for (int j = 0; j < mRealtimeCount; j++) for (auto e1 : mRealtimeEffects)
{ {
// Found it so tell effect to get ready // Found it so tell effect to get ready
if (e == mRealtimeEffects[j]) if (e == e1)
{ {
e = NULL; e = NULL;
break;
} }
} }
@ -414,15 +404,8 @@ void EffectManager::RealtimeSetEffects(const EffectArray & effects)
} }
} }
// Get rid of the old chain
if (mRealtimeEffects)
{
delete [] mRealtimeEffects;
}
// And install the NEW one // And install the NEW one
mRealtimeEffects = newEffects; mRealtimeEffects = effects;
mRealtimeCount = newCount;
// Allow RealtimeProcess() to, well, process // Allow RealtimeProcess() to, well, process
RealtimeResume(); RealtimeResume();

View File

@ -114,7 +114,7 @@ EffectRack::EffectRack()
{ {
auto bs = std::make_unique<wxBoxSizer>(wxVERTICAL); auto bs = std::make_unique<wxBoxSizer>(wxVERTICAL);
{ {
auto hs = std::make_uniqie<wxBoxSizer>(wxHORIZONTAL); auto hs = std::make_unique<wxBoxSizer>(wxHORIZONTAL);
wxASSERT(mPanel); // To justify safenew wxASSERT(mPanel); // To justify safenew
hs->Add(safenew wxButton(mPanel, wxID_APPLY, _("&Apply")), 0, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL); hs->Add(safenew wxButton(mPanel, wxID_APPLY, _("&Apply")), 0, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL);
hs->AddStretchSpacer(); hs->AddStretchSpacer();
@ -127,7 +127,7 @@ EffectRack::EffectRack()
bs->Add(safenew wxStaticLine(mPanel, wxID_ANY), 0, wxEXPAND); bs->Add(safenew wxStaticLine(mPanel, wxID_ANY), 0, wxEXPAND);
{ {
auto uMainSizer = make_uniqie<wxFlexGridSizer>(7); auto uMainSizer = std::make_unique<wxFlexGridSizer>(7);
uMainSizer->AddGrowableCol(6); uMainSizer->AddGrowableCol(6);
uMainSizer->SetHGap(0); uMainSizer->SetHGap(0);
uMainSizer->SetVGap(0); uMainSizer->SetVGap(0);