diff options
-rw-r--r-- | Alc/alc.cpp | 9 | ||||
-rw-r--r-- | Alc/alu.cpp | 23 | ||||
-rw-r--r-- | Alc/effects/dedicated.cpp | 4 | ||||
-rw-r--r-- | Alc/panning.cpp | 10 | ||||
-rw-r--r-- | OpenAL32/Include/alMain.h | 3 |
5 files changed, 19 insertions, 30 deletions
diff --git a/Alc/alc.cpp b/Alc/alc.cpp index d61d8233..866bc4d9 100644 --- a/Alc/alc.cpp +++ b/Alc/alc.cpp @@ -1637,9 +1637,9 @@ static void alcSetError(ALCdevice *device, ALCenum errorCode) static std::unique_ptr<Compressor> CreateDeviceLimiter(const ALCdevice *device, const ALfloat threshold) { - return CompressorInit(device->RealOut.NumChannels, device->Frequency, - AL_TRUE, AL_TRUE, AL_TRUE, AL_TRUE, AL_TRUE, 0.001f, 0.002f, - 0.0f, 0.0f, threshold, INFINITY, 0.0f, 0.020f, 0.200f); + return CompressorInit(static_cast<ALuint>(device->RealOut.Buffer.size()), device->Frequency, + AL_TRUE, AL_TRUE, AL_TRUE, AL_TRUE, AL_TRUE, 0.001f, 0.002f, 0.0f, 0.0f, threshold, + INFINITY, 0.0f, 0.020f, 0.200f); } /* UpdateClockBase @@ -1907,8 +1907,7 @@ static ALCenum UpdateDeviceParams(ALCdevice *device, const ALCint *attrList) device->Dry.NumChannels = 0; std::fill(std::begin(device->NumChannelsPerOrder), std::end(device->NumChannelsPerOrder), 0u); device->RealOut.ChannelIndex.fill(-1); - device->RealOut.Buffer = nullptr; - device->RealOut.NumChannels = 0; + device->RealOut.Buffer = {}; device->MixBuffer.clear(); device->MixBuffer.shrink_to_fit(); diff --git a/Alc/alu.cpp b/Alc/alu.cpp index b57a304d..b447fce8 100644 --- a/Alc/alu.cpp +++ b/Alc/alu.cpp @@ -147,8 +147,7 @@ void ProcessHrtf(ALCdevice *device, const ALsizei SamplesToDo) void ProcessAmbiDec(ALCdevice *device, const ALsizei SamplesToDo) { BFormatDec *ambidec{device->AmbiDecoder.get()}; - ambidec->process({device->RealOut.Buffer, device->RealOut.NumChannels}, device->Dry.Buffer, - SamplesToDo); + ambidec->process(device->RealOut.Buffer, device->Dry.Buffer, SamplesToDo); } void ProcessUhj(ALCdevice *device, const ALsizei SamplesToDo) @@ -168,8 +167,7 @@ void ProcessBs2b(ALCdevice *device, const ALsizei SamplesToDo) { /* First, decode the ambisonic mix to the "real" output. */ BFormatDec *ambidec{device->AmbiDecoder.get()}; - ambidec->process({device->RealOut.Buffer, device->RealOut.NumChannels}, device->Dry.Buffer, - SamplesToDo); + ambidec->process(device->RealOut.Buffer, device->Dry.Buffer, SamplesToDo); /* BS2B is stereo output only. */ const int lidx{device->RealOut.ChannelIndex[FrontLeft]}; @@ -666,7 +664,7 @@ void CalcPanningAndFilters(ALvoice *voice, const ALfloat xpos, const ALfloat ypo /* Direct source channels always play local. Skip the virtual channels * and write inputs to the matching real outputs. */ - voice->mDirect.Buffer = {Device->RealOut.Buffer, Device->RealOut.NumChannels}; + voice->mDirect.Buffer = Device->RealOut.Buffer; for(ALsizei c{0};c < num_channels;c++) { @@ -695,7 +693,7 @@ void CalcPanningAndFilters(ALvoice *voice, const ALfloat xpos, const ALfloat ypo /* Full HRTF rendering. Skip the virtual channels and render to the * real outputs. */ - voice->mDirect.Buffer = {Device->RealOut.Buffer, Device->RealOut.NumChannels}; + voice->mDirect.Buffer = Device->RealOut.Buffer; if(Distance > std::numeric_limits<float>::epsilon()) { @@ -813,7 +811,7 @@ void CalcPanningAndFilters(ALvoice *voice, const ALfloat xpos, const ALfloat ypo /* Special-case LFE */ if(chans[c].channel == LFE) { - if(Device->Dry.Buffer == Device->RealOut.Buffer) + if(Device->Dry.Buffer == Device->RealOut.Buffer.data()) { int idx = GetChannelIdxByName(Device->RealOut, chans[c].channel); if(idx != -1) voice->mChans[c].mDryParams.Gains.Target[idx] = DryGain; @@ -860,7 +858,7 @@ void CalcPanningAndFilters(ALvoice *voice, const ALfloat xpos, const ALfloat ypo /* Special-case LFE */ if(chans[c].channel == LFE) { - if(Device->Dry.Buffer == Device->RealOut.Buffer) + if(Device->Dry.Buffer == Device->RealOut.Buffer.data()) { int idx = GetChannelIdxByName(Device->RealOut, chans[c].channel); if(idx != -1) voice->mChans[c].mDryParams.Gains.Target[idx] = DryGain; @@ -1678,6 +1676,7 @@ void aluMixData(ALCdevice *device, ALvoid *OutBuffer, ALsizei NumSamples) */ if(LIKELY(device->PostProcess)) device->PostProcess(device, SamplesToDo); + const al::span<FloatBufferLine> RealOut{device->RealOut.Buffer}; /* Apply front image stablization for surround sound, if applicable. */ if(device->Stablizer) @@ -1687,16 +1686,14 @@ void aluMixData(ALCdevice *device, ALvoid *OutBuffer, ALsizei NumSamples) const int cidx{GetChannelIdxByName(device->RealOut, FrontCenter)}; assert(lidx >= 0 && ridx >= 0 && cidx >= 0); - ApplyStablizer(device->Stablizer.get(), device->RealOut.Buffer, lidx, ridx, cidx, - SamplesToDo, device->RealOut.NumChannels); + ApplyStablizer(device->Stablizer.get(), RealOut.data(), lidx, ridx, cidx, SamplesToDo, + static_cast<ALuint>(RealOut.size())); } /* Apply compression, limiting sample amplitude if needed or desired. */ if(Compressor *comp{device->Limiter.get()}) - comp->process(SamplesToDo, device->RealOut.Buffer); + comp->process(SamplesToDo, RealOut.data()); - const al::span<FloatBufferLine> RealOut{device->RealOut.Buffer, - device->RealOut.NumChannels}; /* Apply delays and attenuation for mismatched speaker distances. */ ApplyDistanceComp(RealOut, SamplesToDo, device->ChannelDelay.as_span().cbegin()); diff --git a/Alc/effects/dedicated.cpp b/Alc/effects/dedicated.cpp index eb4076b2..12040af9 100644 --- a/Alc/effects/dedicated.cpp +++ b/Alc/effects/dedicated.cpp @@ -62,7 +62,7 @@ void DedicatedState::update(const ALCcontext* UNUSED(context), const ALeffectslo const int idx{!target.RealOut ? -1 : GetChannelIdxByName(*target.RealOut, LFE)}; if(idx != -1) { - mOutTarget = {target.RealOut->Buffer, target.RealOut->NumChannels}; + mOutTarget = target.RealOut->Buffer; mTargetGains[idx] = Gain; } } @@ -73,7 +73,7 @@ void DedicatedState::update(const ALCcontext* UNUSED(context), const ALeffectslo const int idx{!target.RealOut ? -1 : GetChannelIdxByName(*target.RealOut, FrontCenter)}; if(idx != -1) { - mOutTarget = {target.RealOut->Buffer, target.RealOut->NumChannels}; + mOutTarget = target.RealOut->Buffer; mTargetGains[idx] = Gain; } else diff --git a/Alc/panning.cpp b/Alc/panning.cpp index 13114c5f..ba0b76ec 100644 --- a/Alc/panning.cpp +++ b/Alc/panning.cpp @@ -120,15 +120,9 @@ void AllocChannels(ALCdevice *device, const ALuint main_chans, const ALuint real device->Dry.Buffer = device->MixBuffer.data(); device->Dry.NumChannels = main_chans; if(real_chans != 0) - { - device->RealOut.Buffer = device->Dry.Buffer + device->Dry.NumChannels; - device->RealOut.NumChannels = real_chans; - } + device->RealOut.Buffer = {device->Dry.Buffer+device->Dry.NumChannels, real_chans}; else - { - device->RealOut.Buffer = device->Dry.Buffer; - device->RealOut.NumChannels = device->Dry.NumChannels; - } + device->RealOut.Buffer = {device->Dry.Buffer, device->Dry.NumChannels}; } diff --git a/OpenAL32/Include/alMain.h b/OpenAL32/Include/alMain.h index 3008aeca..d7c22546 100644 --- a/OpenAL32/Include/alMain.h +++ b/OpenAL32/Include/alMain.h @@ -317,8 +317,7 @@ struct MixParams { struct RealMixParams { std::array<ALint,MaxChannels> ChannelIndex{}; - FloatBufferLine *Buffer{nullptr}; - ALuint NumChannels{0u}; + al::span<FloatBufferLine> Buffer; }; using POSTPROCESS = void(*)(ALCdevice *device, const ALsizei SamplesToDo); |