Provide (mostly) lockless updates for effect slots
commitef0d4f8210fe6aa65b9df96f3b64bf6f355e845a
authorChris Robinson <chris.kcat@gmail.com>
Fri, 13 May 2016 01:26:33 +0000 (12 18:26 -0700)
committerChris Robinson <chris.kcat@gmail.com>
Fri, 13 May 2016 01:41:33 +0000 (12 18:41 -0700)
tree401b74c7c7291229397883c73d4ad2c382275b7e
parent186b54aa3d5f1398a384fa318aa000210d82437e
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.
15 files changed:
Alc/ALc.c
Alc/ALu.c
Alc/effects/autowah.c
Alc/effects/chorus.c
Alc/effects/compressor.c
Alc/effects/dedicated.c
Alc/effects/distortion.c
Alc/effects/echo.c
Alc/effects/equalizer.c
Alc/effects/flanger.c
Alc/effects/modulator.c
Alc/effects/null.c
Alc/effects/reverb.c
OpenAL32/Include/alAuxEffectSlot.h
OpenAL32/alAuxEffectSlot.c