diff options
author | Chris Robinson <[email protected]> | 2019-05-17 20:39:28 -0700 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2019-05-17 20:39:28 -0700 |
commit | 515a201e30272826bd2bab58eecf42a5fa263230 (patch) | |
tree | 03ea283dbd7c9ce332282e85b19d4f1f54efd927 /Alc/mixvoice.cpp | |
parent | 5ac19673db211d1bee7687335af96cee4e6b40d8 (diff) |
Restructure some voice fields
Diffstat (limited to 'Alc/mixvoice.cpp')
-rw-r--r-- | Alc/mixvoice.cpp | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/Alc/mixvoice.cpp b/Alc/mixvoice.cpp index 293de0b5..cee0df5f 100644 --- a/Alc/mixvoice.cpp +++ b/Alc/mixvoice.cpp @@ -550,14 +550,15 @@ void MixVoice(ALvoice *voice, ALvoice::State vstate, const ALuint SourceID, ALCc auto &SrcData = Device->SourceData; /* Load the previous samples into the source data first, and clear the rest. */ - auto srciter = std::copy_n(voice->mPrevSamples[chan].begin(), MAX_RESAMPLE_PADDING, - std::begin(SrcData)); + auto srciter = std::copy_n(voice->mResampleData[chan].mPrevSamples.begin(), + MAX_RESAMPLE_PADDING, std::begin(SrcData)); std::fill(srciter, std::end(SrcData), 0.0f); auto srcdata_end = std::begin(SrcData) + SrcBufferSize; if(!BufferListItem) - srciter = std::copy(voice->mPrevSamples[chan].begin()+MAX_RESAMPLE_PADDING, - voice->mPrevSamples[chan].end(), srciter); + srciter = std::copy( + voice->mResampleData[chan].mPrevSamples.begin()+MAX_RESAMPLE_PADDING, + voice->mResampleData[chan].mPrevSamples.end(), srciter); else if(isstatic) srciter = LoadBufferStatic(BufferListItem, BufferLoopItem, NumChannels, SampleSize, chan, DataPosInt, srciter, srcdata_end); @@ -585,7 +586,8 @@ void MixVoice(ALvoice *voice, ALvoice::State vstate, const ALuint SourceID, ALCc /* Store the last source samples used for next time. */ std::copy_n(&SrcData[(increment*DstBufferSize + DataPosFrac)>>FRACTIONBITS], - voice->mPrevSamples[chan].size(), std::begin(voice->mPrevSamples[chan])); + voice->mResampleData[chan].mPrevSamples.size(), + voice->mResampleData[chan].mPrevSamples.begin()); /* Resample, then apply ambisonic upsampling as needed. */ const ALfloat *ResampledData{Resample(&voice->mResampleState, @@ -593,15 +595,15 @@ void MixVoice(ALvoice *voice, ALvoice::State vstate, const ALuint SourceID, ALCc Device->ResampledData, DstBufferSize)}; if((voice->mFlags&VOICE_IS_AMBISONIC)) { - const ALfloat hfscale{voice->mAmbiScales[chan]}; + const ALfloat hfscale{voice->mResampleData[chan].mAmbiScale}; /* Beware the evil const_cast. It's safe since it's pointing to * either SrcData or Device->ResampledData (both non-const), * but the resample method takes its input as const float* and * may return it without copying to output, making it currently * unavoidable. */ - voice->mAmbiSplitter[chan].applyHfScale(const_cast<ALfloat*>(ResampledData), - hfscale, DstBufferSize); + voice->mResampleData[chan].mAmbiSplitter.applyHfScale( + const_cast<ALfloat*>(ResampledData), hfscale, DstBufferSize); } /* Now filter and mix to the appropriate outputs. */ |