aboutsummaryrefslogtreecommitdiffstats
path: root/Alc/mixvoice.cpp
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2019-05-29 23:06:24 -0700
committerChris Robinson <[email protected]>2019-05-29 23:06:24 -0700
commitdbdf516dbf628c65d4115a00c78f5679308a0573 (patch)
treed0dbef5d52259e47385b8a98b1d04220475e6e12 /Alc/mixvoice.cpp
parent2909f263fd1a2e7122b0345c6d11209084815fd1 (diff)
Use a span for the voice's buffer references
Diffstat (limited to 'Alc/mixvoice.cpp')
-rw-r--r--Alc/mixvoice.cpp18
1 files changed, 8 insertions, 10 deletions
diff --git a/Alc/mixvoice.cpp b/Alc/mixvoice.cpp
index d3b76492..fc70fa2e 100644
--- a/Alc/mixvoice.cpp
+++ b/Alc/mixvoice.cpp
@@ -561,7 +561,7 @@ void MixVoice(ALvoice *voice, ALvoice::State vstate, const ALuint SourceID, ALCc
parms.Hrtf.Old = parms.Hrtf.Target;
auto set_current = [chan](ALvoice::SendData &send) -> void
{
- if(!send.Buffer)
+ if(send.Buffer.empty())
return;
SendParams &parms = send.Params[chan];
@@ -801,7 +801,7 @@ void MixVoice(ALvoice *voice, ALvoice::State vstate, const ALuint SourceID, ALCc
SilentTarget : parms.Gains.Target};
const auto outcount = static_cast<size_t>(voice->mDirect.ChannelsPerOrder[0]);
- MixSamples(samples, {voice->mDirect.Buffer, outcount}, parms.Gains.Current,
+ MixSamples(samples, voice->mDirect.Buffer.first(outcount), parms.Gains.Current,
TargetGains, Counter, OutPos, DstBufferSize);
ALfloat (&nfcsamples)[BUFFERSIZE] = Device->NfcSampleData;
@@ -813,7 +813,7 @@ void MixVoice(ALvoice *voice, ALvoice::State vstate, const ALuint SourceID, ALCc
voice->mDirect.ChannelsPerOrder[order]);
if(outcount < 1) return;
(parms.NFCtrlFilter.*process)(nfcsamples, samples, DstBufferSize);
- MixSamples(nfcsamples, {voice->mDirect.Buffer+chanoffset, outcount},
+ MixSamples(nfcsamples, voice->mDirect.Buffer.subspan(chanoffset, outcount),
parms.Gains.Current+chanoffset, TargetGains+chanoffset, Counter,
OutPos, DstBufferSize);
chanoffset += outcount;
@@ -826,16 +826,15 @@ void MixVoice(ALvoice *voice, ALvoice::State vstate, const ALuint SourceID, ALCc
{
const ALfloat *TargetGains{UNLIKELY(vstate == ALvoice::Stopping) ?
SilentTarget : parms.Gains.Target};
- const auto outcount = static_cast<size_t>(voice->mDirect.Channels);
- MixSamples(samples, {voice->mDirect.Buffer, outcount}, parms.Gains.Current,
- TargetGains, Counter, OutPos, DstBufferSize);
+ MixSamples(samples, voice->mDirect.Buffer, parms.Gains.Current, TargetGains,
+ Counter, OutPos, DstBufferSize);
}
}
ALfloat (&FilterBuf)[BUFFERSIZE] = Device->FilteredData;
auto mix_send = [vstate,Counter,OutPos,DstBufferSize,chan,ResampledData,&FilterBuf](ALvoice::SendData &send) -> void
{
- if(!send.Buffer)
+ if(send.Buffer.empty())
return;
SendParams &parms = send.Params[chan];
@@ -844,9 +843,8 @@ void MixVoice(ALvoice *voice, ALvoice::State vstate, const ALuint SourceID, ALCc
const ALfloat *TargetGains{UNLIKELY(vstate==ALvoice::Stopping) ? SilentTarget :
parms.Gains.Target};
- const auto outcount = static_cast<size_t>(send.Channels);
- MixSamples(samples, {send.Buffer, outcount}, parms.Gains.Current, TargetGains,
- Counter, OutPos, DstBufferSize);
+ MixSamples(samples, send.Buffer, parms.Gains.Current, TargetGains, Counter, OutPos,
+ DstBufferSize);
};
std::for_each(voice->mSend.begin(), voice->mSend.end(), mix_send);
}