aboutsummaryrefslogtreecommitdiffstats
path: root/Alc/mixvoice.cpp
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2019-02-21 17:48:08 -0800
committerChris Robinson <[email protected]>2019-02-21 17:48:08 -0800
commit7a9d67934fbbe9ce8220e23d82fd0b5bababee50 (patch)
tree32669171d90b3095b32e3dd0f9a0880e4f5f84ac /Alc/mixvoice.cpp
parent1eea3cb2d1e555752b8096dd4f235c1e56242452 (diff)
Mix B-Format sources directly to the dry buffer
Now the only thing that utilizes FOAOut is reverb output.
Diffstat (limited to 'Alc/mixvoice.cpp')
-rw-r--r--Alc/mixvoice.cpp21
1 files changed, 19 insertions, 2 deletions
diff --git a/Alc/mixvoice.cpp b/Alc/mixvoice.cpp
index a0518ed5..78ceea26 100644
--- a/Alc/mixvoice.cpp
+++ b/Alc/mixvoice.cpp
@@ -539,13 +539,30 @@ ALboolean MixSource(ALvoice *voice, const ALuint SourceID, ALCcontext *Context,
/* Store the last source samples used for next time. */
std::copy_n(&SrcData[(increment*DstBufferSize + DataPosFrac)>>FRACTIONBITS],
- voice->PrevSamples[chan].size(), std::begin(voice->PrevSamples[chan]));
+ voice->PrevSamples[chan].size(), std::begin(voice->PrevSamples[chan]));
- /* Now resample, then filter and mix to the appropriate outputs. */
+ /* Resample, then apply ambisonic upsampling as needed. */
const ALfloat *ResampledData{Resample(&voice->ResampleState,
&SrcData[MAX_RESAMPLE_PADDING], DataPosFrac, increment,
Device->TempBuffer[RESAMPLED_BUF], DstBufferSize
)};
+ if((voice->Flags&VOICE_IS_AMBISONIC))
+ {
+ /* TODO: Does not properly handle HOA sources. Currently only
+ * first-order sources are possible, but in the future it would
+ * be desirable.
+ */
+ const ALfloat hfscale{(chan==0) ? voice->AmbiScales[0] : voice->AmbiScales[1]};
+ ALfloat (&hfbuf)[BUFFERSIZE] = Device->TempBuffer[SOURCE_DATA_BUF];
+ ALfloat (&lfbuf)[BUFFERSIZE] = Device->TempBuffer[RESAMPLED_BUF];
+
+ voice->AmbiSplitter[chan].process(hfbuf, lfbuf, ResampledData, DstBufferSize);
+ MixRowSamples(lfbuf, &hfscale, &hfbuf, 1, 0, DstBufferSize);
+
+ ResampledData = lfbuf;
+ }
+
+ /* Now filter and mix to the appropriate outputs. */
{
DirectParams &parms = voice->Direct.Params[chan];
const ALfloat *samples{DoFilters(&parms.LowPass, &parms.HighPass,