aboutsummaryrefslogtreecommitdiffstats
path: root/Alc/panning.cpp
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2019-03-22 19:25:55 -0700
committerChris Robinson <[email protected]>2019-03-22 19:25:55 -0700
commit3a6e741e900bbfbee99906c780402455637c223a (patch)
tree814197465cfdc027ac8c7c485f0f33ef2ffea08f /Alc/panning.cpp
parent92adfaebcecd305bc6fce43a40b41971bfe564b3 (diff)
Use MixParams for the wet buffers
Diffstat (limited to 'Alc/panning.cpp')
-rw-r--r--Alc/panning.cpp25
1 files changed, 14 insertions, 11 deletions
diff --git a/Alc/panning.cpp b/Alc/panning.cpp
index 209c650c..941e2a8b 100644
--- a/Alc/panning.cpp
+++ b/Alc/panning.cpp
@@ -740,11 +740,13 @@ void CalcAmbiCoeffs(const ALfloat y, const ALfloat z, const ALfloat x, const ALf
}
}
-
-void ComputePanningGainsBF(const BFChannelConfig *chanmap, ALsizei numchans, const ALfloat*RESTRICT coeffs, ALfloat ingain, ALfloat (&gains)[MAX_OUTPUT_CHANNELS])
+void ComputePanGains(const MixParams *mix, const ALfloat *RESTRICT coeffs, ALfloat ingain, ALfloat (&gains)[MAX_OUTPUT_CHANNELS])
{
+ auto ambimap = mix->AmbiMap.cbegin();
+ const ALsizei numchans{mix->NumChannels};
+
ASSUME(numchans > 0);
- auto iter = std::transform(chanmap, chanmap+numchans, std::begin(gains),
+ auto iter = std::transform(ambimap, ambimap+numchans, std::begin(gains),
[coeffs,ingain](const BFChannelConfig &chanmap) noexcept -> ALfloat
{
ASSUME(chanmap.Index >= 0);
@@ -754,9 +756,6 @@ void ComputePanningGainsBF(const BFChannelConfig *chanmap, ALsizei numchans, con
std::fill(iter, std::end(gains), 0.0f);
}
-void ComputePanGains(const ALeffectslot *slot, const ALfloat*RESTRICT coeffs, ALfloat ingain, ALfloat (&gains)[MAX_OUTPUT_CHANNELS])
-{ ComputePanningGainsBF(slot->ChanMap, slot->WetBuffer.size(), coeffs, ingain, gains); }
-
void aluInitRenderer(ALCdevice *device, ALint hrtf_id, HrtfRequestMode hrtf_appreq, HrtfRequestMode hrtf_userreq)
{
@@ -1015,11 +1014,15 @@ no_hrtf:
void aluInitEffectPanning(ALeffectslot *slot, ALCdevice *device)
{
const size_t count{AmbiChannelsFromOrder(device->mAmbiOrder)};
- slot->WetBuffer.resize(count);
- slot->WetBuffer.shrink_to_fit();
+ slot->MixBuffer.resize(count);
+ slot->MixBuffer.shrink_to_fit();
auto acnmap_end = AmbiIndex::From3D.begin() + 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{});
+ auto iter = std::transform(AmbiIndex::From3D.begin(), acnmap_end, slot->Wet.AmbiMap.begin(),
+ [](const ALsizei &acn) noexcept -> BFChannelConfig
+ { return BFChannelConfig{1.0f, acn}; }
+ );
+ std::fill(iter, slot->Wet.AmbiMap.end(), BFChannelConfig{});
+ slot->Wet.Buffer = &reinterpret_cast<ALfloat(&)[BUFFERSIZE]>(slot->MixBuffer[0]);
+ slot->Wet.NumChannels = static_cast<ALsizei>(count);
}