diff options
author | Chris Robinson <[email protected]> | 2018-12-23 08:51:28 -0800 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2018-12-23 08:51:28 -0800 |
commit | 3fe38fed7c29869a43b42d634417452b1a5fedbc (patch) | |
tree | b61cd690dbaced50afef8ff69c880d9a99136149 /Alc/effects/compressor.cpp | |
parent | e218999b4f408b7fd35daa9d021288b68f5b4ab5 (diff) |
Mix effect slot output to the effect target if it's set
Diffstat (limited to 'Alc/effects/compressor.cpp')
-rw-r--r-- | Alc/effects/compressor.cpp | 24 |
1 files changed, 17 insertions, 7 deletions
diff --git a/Alc/effects/compressor.cpp b/Alc/effects/compressor.cpp index d502be43..8505f161 100644 --- a/Alc/effects/compressor.cpp +++ b/Alc/effects/compressor.cpp @@ -74,15 +74,25 @@ ALboolean ALcompressorState::deviceUpdate(const ALCdevice *device) void ALcompressorState::update(const ALCcontext *context, const ALeffectslot *slot, const ALeffectProps *props) { - const ALCdevice *device = context->Device; - mEnabled = props->Compressor.OnOff; - mOutBuffer = device->FOAOut.Buffer; - mOutChannels = device->FOAOut.NumChannels; - for(ALsizei i{0};i < 4;i++) - ComputePanGains(&device->FOAOut, alu::Matrix::Identity()[i].data(), - slot->Params.Gain, mGain[i]); + if(ALeffectslot *target{slot->Params.Target}) + { + mOutBuffer = target->WetBuffer; + mOutChannels = target->NumChannels; + for(ALsizei i{0};i < MAX_EFFECT_CHANNELS;i++) + ComputePanGains(target, alu::Matrix::Identity()[i].data(), slot->Params.Gain, + mGain[i]); + } + else + { + const ALCdevice *device{context->Device}; + mOutBuffer = device->FOAOut.Buffer; + mOutChannels = device->FOAOut.NumChannels; + for(ALsizei i{0};i < 4;i++) + ComputePanGains(&device->FOAOut, alu::Matrix::Identity()[i].data(), + slot->Params.Gain, mGain[i]); + } } void ALcompressorState::process(ALsizei SamplesToDo, const ALfloat (*RESTRICT SamplesIn)[BUFFERSIZE], ALfloat (*RESTRICT SamplesOut)[BUFFERSIZE], ALsizei NumChannels) |