aboutsummaryrefslogtreecommitdiffstats
path: root/Alc/effects/compressor.c
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2016-05-12 18:26:33 -0700
committerChris Robinson <[email protected]>2016-05-12 18:41:33 -0700
commitef0d4f8210fe6aa65b9df96f3b64bf6f355e845a (patch)
tree401b74c7c7291229397883c73d4ad2c382275b7e /Alc/effects/compressor.c
parent186b54aa3d5f1398a384fa318aa000210d82437e (diff)
Provide (mostly) lockless updates for effect slots
Similar to the listener, separate containers are provided atomically for the mixer thread to apply updates without needing to block, and a free-list is used to reuse container objects. A couple things to note. First, the lock is still used when the effect state's deviceUpdate method is called to prevent asynchronous calls to reset the device from interfering. This can be fixed by using the list lock in ALc.c instead. Secondly, old effect states aren't immediately deleted when the effect type changes (the actual type, not just its properties). This is because the mixer thread is intended to be real-time safe, and so can't be freeing anything. They are cleared away when updates reuse the container they were kept in, and they don't incur any extra processing cost, but there may be cases where the memory is kept around until the effect slot is deleted.
Diffstat (limited to 'Alc/effects/compressor.c')
-rw-r--r--Alc/effects/compressor.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/Alc/effects/compressor.c b/Alc/effects/compressor.c
index bc4955b9..c501b3ba 100644
--- a/Alc/effects/compressor.c
+++ b/Alc/effects/compressor.c
@@ -40,8 +40,9 @@ typedef struct ALcompressorState {
ALfloat GainCtrl;
} ALcompressorState;
-static ALvoid ALcompressorState_Destruct(ALcompressorState *UNUSED(state))
+static ALvoid ALcompressorState_Destruct(ALcompressorState *state)
{
+ ALeffectState_Destruct(STATIC_CAST(ALeffectState,state));
}
static ALboolean ALcompressorState_deviceUpdate(ALcompressorState *state, ALCdevice *device)
@@ -60,7 +61,7 @@ static ALvoid ALcompressorState_update(ALcompressorState *state, const ALCdevice
aluMatrixf matrix;
ALuint i;
- state->Enabled = slot->EffectProps.Compressor.OnOff;
+ state->Enabled = slot->Params.EffectProps.Compressor.OnOff;
aluMatrixfSet(&matrix,
1.0f, 0.0f, 0.0f, 0.0f,
@@ -72,7 +73,7 @@ static ALvoid ALcompressorState_update(ALcompressorState *state, const ALCdevice
STATIC_CAST(ALeffectState,state)->OutBuffer = device->FOAOut.Buffer;
STATIC_CAST(ALeffectState,state)->OutChannels = device->FOAOut.NumChannels;
for(i = 0;i < 4;i++)
- ComputeFirstOrderGains(device->FOAOut, matrix.m[i], slot->Gain,
+ ComputeFirstOrderGains(device->FOAOut, matrix.m[i], slot->Params.Gain,
state->Gain[i]);
}