1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-11-21 08:27:13 +01:00

Bug2431: Enable checkbox for ALL realtime effects should work...

... not just for AudioUnits, but also WahWah, VST, etc.
This commit is contained in:
Paul Licameli
2020-05-29 20:52:50 -04:00
parent c973f0d8ed
commit 3646bb8afe
3 changed files with 28 additions and 2 deletions

View File

@@ -1351,7 +1351,7 @@ void EffectUIHost::Resume()
mEnableCb->SetValue(mEnabled); mEnableCb->SetValue(mEnabled);
return; return;
} }
mEffect->RealtimeResume(); RealtimeEffectManager::Get().RealtimeResumeOne( *mEffect );
} }
void EffectUIHost::OnEnable(wxCommandEvent & WXUNUSED(evt)) void EffectUIHost::OnEnable(wxCommandEvent & WXUNUSED(evt))
@@ -1364,7 +1364,7 @@ void EffectUIHost::OnEnable(wxCommandEvent & WXUNUSED(evt))
} }
else else
{ {
mEffect->RealtimeSuspend(); RealtimeEffectManager::Get().RealtimeSuspendOne( *mEffect );
mNeedsResume = true; mNeedsResume = true;
} }

View File

@@ -237,6 +237,18 @@ void RealtimeEffectManager::RealtimeSuspend()
mRealtimeLock.Leave(); mRealtimeLock.Leave();
} }
void RealtimeEffectManager::RealtimeSuspendOne( EffectClientInterface &effect )
{
auto begin = mStates.begin(), end = mStates.end();
auto found = std::find_if( begin, end,
[&effect]( const decltype( mStates )::value_type &state ){
return state && &state->GetEffect() == &effect;
}
);
if ( found != end )
(*found)->RealtimeSuspend();
}
void RealtimeEffectManager::RealtimeResume() void RealtimeEffectManager::RealtimeResume()
{ {
mRealtimeLock.Enter(); mRealtimeLock.Enter();
@@ -258,6 +270,18 @@ void RealtimeEffectManager::RealtimeResume()
mRealtimeLock.Leave(); mRealtimeLock.Leave();
} }
void RealtimeEffectManager::RealtimeResumeOne( EffectClientInterface &effect )
{
auto begin = mStates.begin(), end = mStates.end();
auto found = std::find_if( begin, end,
[&effect]( const decltype( mStates )::value_type &state ){
return state && &state->GetEffect() == &effect;
}
);
if ( found != end )
(*found)->RealtimeResume();
}
// //
// This will be called in a different thread than the main GUI thread. // This will be called in a different thread than the main GUI thread.
// //

View File

@@ -36,7 +36,9 @@ public:
void RealtimeAddProcessor(int group, unsigned chans, float rate); void RealtimeAddProcessor(int group, unsigned chans, float rate);
void RealtimeFinalize(); void RealtimeFinalize();
void RealtimeSuspend(); void RealtimeSuspend();
void RealtimeSuspendOne( EffectClientInterface &effect );
void RealtimeResume(); void RealtimeResume();
void RealtimeResumeOne( EffectClientInterface &effect );
void RealtimeProcessStart(); void RealtimeProcessStart();
size_t RealtimeProcess(int group, unsigned chans, float **buffers, size_t numSamples); size_t RealtimeProcess(int group, unsigned chans, float **buffers, size_t numSamples);
void RealtimeProcessEnd(); void RealtimeProcessEnd();