mirror of
https://github.com/cookiengineer/audacity
synced 2025-07-15 16:17:41 +02:00
Fix for opening effect while play is active
Stupid Leland didn't test all cases...grrrr!!!
This commit is contained in:
parent
38f27a76a1
commit
fcf2a28867
@ -511,7 +511,7 @@ void EffectManager::RealtimeAddEffect(Effect *effect)
|
|||||||
// Add the required processors
|
// Add the required processors
|
||||||
for (size_t i = 0, cnt = mRealtimeChans.GetCount(); i < cnt; i++)
|
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()
|
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
|
// The audio thread should not be running yet, but protect anyway
|
||||||
RealtimeSuspend();
|
RealtimeSuspend();
|
||||||
|
|
||||||
@ -654,6 +648,13 @@ void EffectManager::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.
|
||||||
//
|
//
|
||||||
void EffectManager::RealtimeProcessStart()
|
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++)
|
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.
|
// 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.
|
// This will be called in a different thread than the main GUI thread.
|
||||||
//
|
//
|
||||||
void EffectManager::RealtimeProcessEnd()
|
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++)
|
for (size_t i = 0, cnt = mRealtimeEffects.GetCount(); i < cnt; i++)
|
||||||
{
|
{
|
||||||
@ -747,6 +758,9 @@ void EffectManager::RealtimeProcessEnd()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
mRealtimeLock.Leave();
|
||||||
|
}
|
||||||
|
|
||||||
int EffectManager::GetRealtimeLatency()
|
int EffectManager::GetRealtimeLatency()
|
||||||
{
|
{
|
||||||
return mRealtimeLatency;
|
return mRealtimeLatency;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user