diff options
author | Chris Robinson <[email protected]> | 2019-02-20 21:01:08 -0800 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2019-02-20 21:01:08 -0800 |
commit | c43381d811f436187b99c51951365c33fc735dc5 (patch) | |
tree | d7c542ccf07bd04f45902b4dfa1f5cf401951ce5 /Alc/panning.cpp | |
parent | 77ba61ecb3973dab4fff5fdc8bc237a6f4cd0056 (diff) |
Allocate the effect slot wet buffer dynamically
Diffstat (limited to 'Alc/panning.cpp')
-rw-r--r-- | Alc/panning.cpp | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/Alc/panning.cpp b/Alc/panning.cpp index 01ac5ad7..d92570f3 100644 --- a/Alc/panning.cpp +++ b/Alc/panning.cpp @@ -861,7 +861,7 @@ void ComputePanningGainsBF(const BFChannelConfig *chanmap, ALsizei numchans, con } void ComputePanGains(const ALeffectslot *slot, const ALfloat*RESTRICT coeffs, ALfloat ingain, ALfloat (&gains)[MAX_OUTPUT_CHANNELS]) -{ ComputePanningGainsBF(slot->ChanMap, slot->NumChannels, coeffs, ingain, gains); } +{ ComputePanningGainsBF(slot->ChanMap, slot->WetBuffer.size(), coeffs, ingain, gains); } void aluInitRenderer(ALCdevice *device, ALint hrtf_id, HrtfRequestMode hrtf_appreq, HrtfRequestMode hrtf_userreq) @@ -1121,10 +1121,12 @@ no_hrtf: void aluInitEffectPanning(ALeffectslot *slot) { - const size_t count{countof(slot->ChanMap)}; + const size_t count{4u}; + slot->WetBuffer.resize(count); + slot->WetBuffer.shrink_to_fit(); + auto acnmap_end = AmbiIndex::From3D.begin() + count; - std::transform(AmbiIndex::From3D.begin(), acnmap_end, std::begin(slot->ChanMap), - [](const ALsizei &acn) noexcept { return BFChannelConfig{1.0f, acn}; } - ); - slot->NumChannels = static_cast<ALsizei>(count); + auto iter = std::transform(AmbiIndex::From3D.begin(), acnmap_end, std::begin(slot->ChanMap), + [](const ALsizei &acn) noexcept { return BFChannelConfig{1.0f, acn}; }); + std::fill(iter, std::end(slot->ChanMap), BFChannelConfig{}); } |