1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-12-18 14:41:20 +01: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();
@@ -654,6 +648,13 @@ void EffectManager::RealtimeResume()
// This will be called in a different thread than the main GUI thread.
//
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++)
{
@@ -661,6 +662,9 @@ void EffectManager::RealtimeProcessStart()
}
}
mRealtimeLock.Leave();
}
//
// This will be called in a different thread than the main GUI thread.
//
@@ -740,6 +744,13 @@ sampleCount EffectManager::RealtimeProcess(int group, int chans, float **buffers
// This will be called in a different thread than the main GUI thread.
//
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++)
{
@@ -747,6 +758,9 @@ void EffectManager::RealtimeProcessEnd()
}
}
mRealtimeLock.Leave();
}
int EffectManager::GetRealtimeLatency()
{
return mRealtimeLatency;