diff options
author | Chris Robinson <[email protected]> | 2018-11-30 21:23:43 -0800 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2018-11-30 21:23:43 -0800 |
commit | 1e6e84374b9928b614e7f36a26499d806f3c89cc (patch) | |
tree | 07bf7ef1fb385a7b4209aa6f2b04f4837bbd7e48 /Alc/mixvoice.cpp | |
parent | c7569c31ad4b731f1b6c86cbc1833f8b0af4bf82 (diff) |
Use std::array for the voice's PrevSamples
Diffstat (limited to 'Alc/mixvoice.cpp')
-rw-r--r-- | Alc/mixvoice.cpp | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/Alc/mixvoice.cpp b/Alc/mixvoice.cpp index 1aa3000b..f0ee8bb6 100644 --- a/Alc/mixvoice.cpp +++ b/Alc/mixvoice.cpp @@ -356,13 +356,14 @@ ALboolean MixSource(ALvoice *voice, ALuint SourceID, ALCcontext *Context, ALsize for(ALsizei chan{0};chan < NumChannels;chan++) { - ALfloat *SrcData{Device->TempBuffer[SOURCE_DATA_BUF]}; + ALfloat (&SrcData)[BUFFERSIZE] = Device->TempBuffer[SOURCE_DATA_BUF]; /* Load the previous samples into the source data first, and clear the rest. */ - std::copy_n(voice->PrevSamples[chan], MAX_RESAMPLE_PADDING, SrcData); - std::fill_n(SrcData+MAX_RESAMPLE_PADDING, BUFFERSIZE-MAX_RESAMPLE_PADDING, 0.0f); - ALsizei FilledAmt{MAX_RESAMPLE_PADDING}; + auto srciter = std::copy(std::begin(voice->PrevSamples[chan]), + std::end(voice->PrevSamples[chan]), std::begin(SrcData)); + std::fill(srciter, std::end(SrcData), 0.0f); + auto FilledAmt = static_cast<ALsizei>(voice->PrevSamples[chan].size()); if(isstatic) { /* TODO: For static sources, loop points are taken from the @@ -501,7 +502,7 @@ ALboolean MixSource(ALvoice *voice, ALuint SourceID, ALCcontext *Context, ALsize /* Store the last source samples used for next time. */ std::copy_n(&SrcData[(increment*DstBufferSize + DataPosFrac)>>FRACTIONBITS], - MAX_RESAMPLE_PADDING, voice->PrevSamples[chan]); + voice->PrevSamples[chan].size(), std::begin(voice->PrevSamples[chan])); /* Now resample, then filter and mix to the appropriate outputs. */ const ALfloat *ResampledData{Resample(&voice->ResampleState, |