1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-06-23 15:50:05 +02:00

Fix for opening effect while play is active

Stupid Leland didn't test all cases...grrrr!!!
This commit is contained in:
lllucius@gmail.com 2015-01-03 17:55:36 +00:00
parent 38f27a76a1
commit fcf2a28867

View File

@ -511,7 +511,7 @@ void EffectManager::RealtimeAddEffect(Effect *effect)
// Add the required processors
for (size_t i = 0, cnt = mRealtimeChans.GetCount(); i < cnt; i++)
{
RealtimeAddProcessor(i, mRealtimeChans[i], mRealtimeRates[i]);
effect->RealtimeAddProcessor(i, mRealtimeChans[i], mRealtimeRates[i]);
}
}
@ -544,12 +544,6 @@ void EffectManager::RealtimeRemoveEffect(Effect *effect)
void EffectManager::RealtimeInitialize()
{
// No need to do anything if there are no effects
if (mRealtimeEffects.IsEmpty())
{
return;
}
// The audio thread should not be running yet, but protect anyway
RealtimeSuspend();
@ -655,10 +649,20 @@ void EffectManager::RealtimeResume()
//
void EffectManager::RealtimeProcessStart()
{
// Protect ourselves from the main thread
mRealtimeLock.Enter();
// Can be suspended because of the audio stream being paused or because effects
// have been suspended.
if (!mRealtimeSuspended)
{
for (size_t i = 0, cnt = mRealtimeEffects.GetCount(); i < cnt; i++)
{
mRealtimeEffects[i]->RealtimeProcessStart();
}
}
mRealtimeLock.Leave();
}
//
@ -741,10 +745,20 @@ sampleCount EffectManager::RealtimeProcess(int group, int chans, float **buffers
//
void EffectManager::RealtimeProcessEnd()
{
// Protect ourselves from the main thread
mRealtimeLock.Enter();
// Can be suspended because of the audio stream being paused or because effects
// have been suspended.
if (!mRealtimeSuspended)
{
for (size_t i = 0, cnt = mRealtimeEffects.GetCount(); i < cnt; i++)
{
mRealtimeEffects[i]->RealtimeProcessEnd();
}
}
mRealtimeLock.Leave();
}
int EffectManager::GetRealtimeLatency()