aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Alc/alc.cpp7
-rw-r--r--Alc/alu.cpp28
-rw-r--r--Alc/effects/autowah.cpp4
-rw-r--r--Alc/effects/chorus.cpp2
-rw-r--r--Alc/effects/compressor.cpp4
-rw-r--r--Alc/effects/dedicated.cpp2
-rw-r--r--Alc/effects/distortion.cpp2
-rw-r--r--Alc/effects/echo.cpp2
-rw-r--r--Alc/effects/equalizer.cpp6
-rw-r--r--Alc/effects/fshifter.cpp2
-rw-r--r--Alc/effects/modulator.cpp6
-rw-r--r--Alc/effects/pshifter.cpp2
-rw-r--r--Alc/effects/reverb.cpp2
-rw-r--r--Alc/panning.cpp19
-rw-r--r--OpenAL32/Include/alMain.h5
-rw-r--r--OpenAL32/alAuxEffectSlot.cpp2
16 files changed, 46 insertions, 49 deletions
diff --git a/Alc/alc.cpp b/Alc/alc.cpp
index 866bc4d9..5d2b2020 100644
--- a/Alc/alc.cpp
+++ b/Alc/alc.cpp
@@ -1903,8 +1903,7 @@ static ALCenum UpdateDeviceParams(ALCdevice *device, const ALCint *attrList)
device->ChannelDelay.clear();
device->Dry.AmbiMap.fill(BFChannelConfig{});
- device->Dry.Buffer = nullptr;
- device->Dry.NumChannels = 0;
+ device->Dry.Buffer = {};
std::fill(std::begin(device->NumChannelsPerOrder), std::end(device->NumChannelsPerOrder), 0u);
device->RealOut.ChannelIndex.fill(-1);
device->RealOut.Buffer = {};
@@ -2158,7 +2157,7 @@ static ALCenum UpdateDeviceParams(ALCdevice *device, const ALCint *attrList)
aluInitEffectPanning(slot, device);
EffectState *state{slot->Effect.State};
- state->mOutTarget = {device->Dry.Buffer, device->Dry.NumChannels};
+ state->mOutTarget = device->Dry.Buffer;
if(state->deviceUpdate(device) == AL_FALSE)
update_failed = AL_TRUE;
else
@@ -2180,7 +2179,7 @@ static ALCenum UpdateDeviceParams(ALCdevice *device, const ALCint *attrList)
aluInitEffectPanning(slot, device);
EffectState *state{slot->Effect.State};
- state->mOutTarget = {device->Dry.Buffer, device->Dry.NumChannels};
+ state->mOutTarget = device->Dry.Buffer;
if(state->deviceUpdate(device) == AL_FALSE)
update_failed = AL_TRUE;
else
diff --git a/Alc/alu.cpp b/Alc/alu.cpp
index b447fce8..b12559d7 100644
--- a/Alc/alu.cpp
+++ b/Alc/alu.cpp
@@ -140,14 +140,14 @@ void ProcessHrtf(ALCdevice *device, const ALsizei SamplesToDo)
ASSUME(lidx >= 0 && ridx >= 0);
DirectHrtfState *state{device->mHrtfState.get()};
- MixDirectHrtf(device->RealOut.Buffer[lidx], device->RealOut.Buffer[ridx],
- {device->Dry.Buffer, device->Dry.NumChannels}, device->HrtfAccumData, state, SamplesToDo);
+ MixDirectHrtf(device->RealOut.Buffer[lidx], device->RealOut.Buffer[ridx], device->Dry.Buffer,
+ device->HrtfAccumData, state, SamplesToDo);
}
void ProcessAmbiDec(ALCdevice *device, const ALsizei SamplesToDo)
{
BFormatDec *ambidec{device->AmbiDecoder.get()};
- ambidec->process(device->RealOut.Buffer, device->Dry.Buffer, SamplesToDo);
+ ambidec->process(device->RealOut.Buffer, device->Dry.Buffer.data(), SamplesToDo);
}
void ProcessUhj(ALCdevice *device, const ALsizei SamplesToDo)
@@ -160,14 +160,14 @@ void ProcessUhj(ALCdevice *device, const ALsizei SamplesToDo)
/* Encode to stereo-compatible 2-channel UHJ output. */
Uhj2Encoder *uhj2enc{device->Uhj_Encoder.get()};
uhj2enc->encode(device->RealOut.Buffer[lidx], device->RealOut.Buffer[ridx],
- device->Dry.Buffer, SamplesToDo);
+ device->Dry.Buffer.data(), SamplesToDo);
}
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->Dry.Buffer, SamplesToDo);
+ ambidec->process(device->RealOut.Buffer, device->Dry.Buffer.data(), SamplesToDo);
/* BS2B is stereo output only. */
const int lidx{device->RealOut.ChannelIndex[FrontLeft]};
@@ -811,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.data())
+ if(Device->Dry.Buffer.data() == Device->RealOut.Buffer.data())
{
int idx = GetChannelIdxByName(Device->RealOut, chans[c].channel);
if(idx != -1) voice->mChans[c].mDryParams.Gains.Target[idx] = DryGain;
@@ -858,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.data())
+ if(Device->Dry.Buffer.data() == Device->RealOut.Buffer.data())
{
int idx = GetChannelIdxByName(Device->RealOut, chans[c].channel);
if(idx != -1) voice->mChans[c].mDryParams.Gains.Target[idx] = DryGain;
@@ -936,7 +936,7 @@ void CalcNonAttnSourceParams(ALvoice *voice, const ALvoicePropsBase *props, cons
const ALCdevice *Device{ALContext->Device};
ALeffectslot *SendSlots[MAX_SENDS];
- voice->mDirect.Buffer = {Device->Dry.Buffer, static_cast<size_t>(Device->Dry.NumChannels)};
+ voice->mDirect.Buffer = Device->Dry.Buffer;
for(ALsizei i{0};i < Device->NumAuxSends;i++)
{
SendSlots[i] = props->Send[i].Slot;
@@ -948,9 +948,7 @@ void CalcNonAttnSourceParams(ALvoice *voice, const ALvoicePropsBase *props, cons
voice->mSend[i].Buffer = {};
}
else
- {
- voice->mSend[i].Buffer = {SendSlots[i]->Wet.Buffer, SendSlots[i]->Wet.NumChannels};
- }
+ voice->mSend[i].Buffer = SendSlots[i]->Wet.Buffer;
}
/* Calculate the stepping value */
@@ -994,7 +992,7 @@ void CalcAttnSourceParams(ALvoice *voice, const ALvoicePropsBase *props, const A
const ALlistener &Listener = ALContext->Listener;
/* Set mixing buffers and get send parameters. */
- voice->mDirect.Buffer = {Device->Dry.Buffer, Device->Dry.NumChannels};
+ voice->mDirect.Buffer = Device->Dry.Buffer;
ALeffectslot *SendSlots[MAX_SENDS];
ALfloat RoomRolloff[MAX_SENDS];
ALfloat DecayDistance[MAX_SENDS];
@@ -1051,7 +1049,7 @@ void CalcAttnSourceParams(ALvoice *voice, const ALvoicePropsBase *props, const A
if(!SendSlots[i])
voice->mSend[i].Buffer = {};
else
- voice->mSend[i].Buffer = {SendSlots[i]->Wet.Buffer, SendSlots[i]->Wet.NumChannels};
+ voice->mSend[i].Buffer = SendSlots[i]->Wet.Buffer;
}
/* Transform source to listener space (convert to head relative) */
@@ -1424,8 +1422,8 @@ void ProcessContext(ALCcontext *ctx, const ALsizei SamplesToDo)
[SamplesToDo](const ALeffectslot *slot) -> void
{
EffectState *state{slot->Params.mEffectState};
- state->process(SamplesToDo, slot->Wet.Buffer, slot->Wet.NumChannels,
- state->mOutTarget);
+ state->process(SamplesToDo, slot->Wet.Buffer.data(),
+ static_cast<ALsizei>(slot->Wet.Buffer.size()), state->mOutTarget);
}
);
}
diff --git a/Alc/effects/autowah.cpp b/Alc/effects/autowah.cpp
index 90af6134..f1160804 100644
--- a/Alc/effects/autowah.cpp
+++ b/Alc/effects/autowah.cpp
@@ -119,8 +119,8 @@ void ALautowahState::update(const ALCcontext *context, const ALeffectslot *slot,
mFreqMinNorm = MIN_FREQ / device->Frequency;
mBandwidthNorm = (MAX_FREQ-MIN_FREQ) / device->Frequency;
- mOutTarget = {target.Main->Buffer, target.Main->NumChannels};
- for(ALuint i{0u};i < slot->Wet.NumChannels;++i)
+ mOutTarget = target.Main->Buffer;
+ for(size_t i{0u};i < slot->Wet.Buffer.size();++i)
{
auto coeffs = GetAmbiIdentityRow(i);
ComputePanGains(target.Main, coeffs.data(), slot->Params.Gain, mChans[i].TargetGains);
diff --git a/Alc/effects/chorus.cpp b/Alc/effects/chorus.cpp
index b77c3439..a2a34008 100644
--- a/Alc/effects/chorus.cpp
+++ b/Alc/effects/chorus.cpp
@@ -159,7 +159,7 @@ void ChorusState::update(const ALCcontext *Context, const ALeffectslot *Slot, co
CalcDirectionCoeffs({-1.0f, 0.0f, 0.0f}, 0.0f, coeffs[0]);
CalcDirectionCoeffs({ 1.0f, 0.0f, 0.0f}, 0.0f, coeffs[1]);
- mOutTarget = {target.Main->Buffer, target.Main->NumChannels};
+ mOutTarget = target.Main->Buffer;
ComputePanGains(target.Main, coeffs[0], Slot->Params.Gain, mGains[0].Target);
ComputePanGains(target.Main, coeffs[1], Slot->Params.Gain, mGains[1].Target);
diff --git a/Alc/effects/compressor.cpp b/Alc/effects/compressor.cpp
index 883488cb..542ef684 100644
--- a/Alc/effects/compressor.cpp
+++ b/Alc/effects/compressor.cpp
@@ -78,8 +78,8 @@ void CompressorState::update(const ALCcontext* UNUSED(context), const ALeffectsl
{
mEnabled = props->Compressor.OnOff;
- mOutTarget = {target.Main->Buffer, target.Main->NumChannels};
- for(ALuint i{0u};i < slot->Wet.NumChannels;++i)
+ mOutTarget = target.Main->Buffer;
+ for(size_t i{0u};i < slot->Wet.Buffer.size();++i)
{
auto coeffs = GetAmbiIdentityRow(i);
ComputePanGains(target.Main, coeffs.data(), slot->Params.Gain, mGain[i]);
diff --git a/Alc/effects/dedicated.cpp b/Alc/effects/dedicated.cpp
index 12040af9..b5fdb626 100644
--- a/Alc/effects/dedicated.cpp
+++ b/Alc/effects/dedicated.cpp
@@ -81,7 +81,7 @@ void DedicatedState::update(const ALCcontext* UNUSED(context), const ALeffectslo
ALfloat coeffs[MAX_AMBI_CHANNELS];
CalcDirectionCoeffs({0.0f, 0.0f, -1.0f}, 0.0f, coeffs);
- mOutTarget = {target.Main->Buffer, target.Main->NumChannels};
+ mOutTarget = target.Main->Buffer;
ComputePanGains(target.Main, coeffs, Gain, mTargetGains);
}
}
diff --git a/Alc/effects/distortion.cpp b/Alc/effects/distortion.cpp
index 3b8b73b7..a58ac5a6 100644
--- a/Alc/effects/distortion.cpp
+++ b/Alc/effects/distortion.cpp
@@ -90,7 +90,7 @@ void DistortionState::update(const ALCcontext *context, const ALeffectslot *slot
ALfloat coeffs[MAX_AMBI_CHANNELS];
CalcDirectionCoeffs({0.0f, 0.0f, -1.0f}, 0.0f, coeffs);
- mOutTarget = {target.Main->Buffer, target.Main->NumChannels};
+ mOutTarget = target.Main->Buffer;
ComputePanGains(target.Main, coeffs, slot->Params.Gain*props->Distortion.Gain, mGain);
}
diff --git a/Alc/effects/echo.cpp b/Alc/effects/echo.cpp
index 594d2a7c..0211520b 100644
--- a/Alc/effects/echo.cpp
+++ b/Alc/effects/echo.cpp
@@ -113,7 +113,7 @@ void EchoState::update(const ALCcontext *context, const ALeffectslot *slot, cons
CalcAngleCoeffs(-angle, 0.0f, 0.0f, coeffs[0]);
CalcAngleCoeffs( angle, 0.0f, 0.0f, coeffs[1]);
- mOutTarget = {target.Main->Buffer, target.Main->NumChannels};
+ mOutTarget = target.Main->Buffer;
ComputePanGains(target.Main, coeffs[0], slot->Params.Gain, mGains[0].Target);
ComputePanGains(target.Main, coeffs[1], slot->Params.Gain, mGains[1].Target);
}
diff --git a/Alc/effects/equalizer.cpp b/Alc/effects/equalizer.cpp
index 14013aad..995f03df 100644
--- a/Alc/effects/equalizer.cpp
+++ b/Alc/effects/equalizer.cpp
@@ -141,7 +141,7 @@ void EqualizerState::update(const ALCcontext *context, const ALeffectslot *slot,
BiquadFilter::rcpQFromSlope(gain, 0.75f));
/* Copy the filter coefficients for the other input channels. */
- for(ALuint i{1u};i < slot->Wet.NumChannels;++i)
+ for(size_t i{1u};i < slot->Wet.Buffer.size();++i)
{
mChans[i].filter[0].copyParamsFrom(mChans[0].filter[0]);
mChans[i].filter[1].copyParamsFrom(mChans[0].filter[1]);
@@ -149,8 +149,8 @@ void EqualizerState::update(const ALCcontext *context, const ALeffectslot *slot,
mChans[i].filter[3].copyParamsFrom(mChans[0].filter[3]);
}
- mOutTarget = {target.Main->Buffer, target.Main->NumChannels};
- for(ALuint i{0u};i < slot->Wet.NumChannels;++i)
+ mOutTarget = target.Main->Buffer;
+ for(size_t i{0u};i < slot->Wet.Buffer.size();++i)
{
auto coeffs = GetAmbiIdentityRow(i);
ComputePanGains(target.Main, coeffs.data(), slot->Params.Gain, mChans[i].TargetGains);
diff --git a/Alc/effects/fshifter.cpp b/Alc/effects/fshifter.cpp
index 0bbcc859..6378db89 100644
--- a/Alc/effects/fshifter.cpp
+++ b/Alc/effects/fshifter.cpp
@@ -133,7 +133,7 @@ void FshifterState::update(const ALCcontext *context, const ALeffectslot *slot,
ALfloat coeffs[MAX_AMBI_CHANNELS];
CalcDirectionCoeffs({0.0f, 0.0f, -1.0f}, 0.0f, coeffs);
- mOutTarget = {target.Main->Buffer, target.Main->NumChannels};
+ mOutTarget = target.Main->Buffer;
ComputePanGains(target.Main, coeffs, slot->Params.Gain, mTargetGains);
}
diff --git a/Alc/effects/modulator.cpp b/Alc/effects/modulator.cpp
index 12974faa..46d17d1c 100644
--- a/Alc/effects/modulator.cpp
+++ b/Alc/effects/modulator.cpp
@@ -129,11 +129,11 @@ void ModulatorState::update(const ALCcontext *context, const ALeffectslot *slot,
/* Bandwidth value is constant in octaves. */
mChans[0].Filter.setParams(BiquadType::HighPass, 1.0f, f0norm,
BiquadFilter::rcpQFromBandwidth(f0norm, 0.75f));
- for(ALuint i{1u};i < slot->Wet.NumChannels;++i)
+ for(size_t i{1u};i < slot->Wet.Buffer.size();++i)
mChans[i].Filter.copyParamsFrom(mChans[0].Filter);
- mOutTarget = {target.Main->Buffer, target.Main->NumChannels};
- for(ALuint i{0u};i < slot->Wet.NumChannels;++i)
+ mOutTarget = target.Main->Buffer;
+ for(size_t i{0u};i < slot->Wet.Buffer.size();++i)
{
auto coeffs = GetAmbiIdentityRow(i);
ComputePanGains(target.Main, coeffs.data(), slot->Params.Gain, mChans[i].TargetGains);
diff --git a/Alc/effects/pshifter.cpp b/Alc/effects/pshifter.cpp
index 619bde34..5a1e3817 100644
--- a/Alc/effects/pshifter.cpp
+++ b/Alc/effects/pshifter.cpp
@@ -192,7 +192,7 @@ void PshifterState::update(const ALCcontext* UNUSED(context), const ALeffectslot
ALfloat coeffs[MAX_AMBI_CHANNELS];
CalcDirectionCoeffs({0.0f, 0.0f, -1.0f}, 0.0f, coeffs);
- mOutTarget = {target.Main->Buffer, target.Main->NumChannels};
+ mOutTarget = target.Main->Buffer;
ComputePanGains(target.Main, coeffs, slot->Params.Gain, mTargetGains);
}
diff --git a/Alc/effects/reverb.cpp b/Alc/effects/reverb.cpp
index da8be835..01f5c476 100644
--- a/Alc/effects/reverb.cpp
+++ b/Alc/effects/reverb.cpp
@@ -889,7 +889,7 @@ void ReverbState::update3DPanning(const ALfloat *ReflectionsPan, const ALfloat *
const alu::Matrix earlymat{GetTransformFromVector(ReflectionsPan)};
const alu::Matrix latemat{GetTransformFromVector(LateReverbPan)};
- mOutTarget = {target.Main->Buffer, target.Main->NumChannels};
+ mOutTarget = target.Main->Buffer;
for(ALsizei i{0};i < NUM_LINES;i++)
{
const ALfloat coeffs[MAX_AMBI_CHANNELS]{earlymat[0][i], earlymat[1][i], earlymat[2][i],
diff --git a/Alc/panning.cpp b/Alc/panning.cpp
index 44b6053a..d1add5d5 100644
--- a/Alc/panning.cpp
+++ b/Alc/panning.cpp
@@ -116,13 +116,17 @@ void AllocChannels(ALCdevice *device, const ALuint main_chans, const ALuint real
TRACE("Allocating %u channels, %zu bytes\n", num_chans,
num_chans*sizeof(device->MixBuffer[0]));
device->MixBuffer.resize(num_chans);
+ al::span<FloatBufferLine> buffer{device->MixBuffer.data(), device->MixBuffer.size()};
- device->Dry.Buffer = device->MixBuffer.data();
- device->Dry.NumChannels = main_chans;
+ device->Dry.Buffer = buffer.first(main_chans);
+ buffer = buffer.subspan(main_chans);
if(real_chans != 0)
- device->RealOut.Buffer = {device->Dry.Buffer+device->Dry.NumChannels, real_chans};
+ {
+ device->RealOut.Buffer = buffer.first(real_chans);
+ buffer = buffer.subspan(real_chans);
+ }
else
- device->RealOut.Buffer = {device->Dry.Buffer, device->Dry.NumChannels};
+ device->RealOut.Buffer = device->Dry.Buffer;
}
@@ -850,8 +854,7 @@ void aluInitEffectPanning(ALeffectslot *slot, ALCdevice *device)
{ return BFChannelConfig{1.0f, acn}; }
);
std::fill(iter, slot->Wet.AmbiMap.end(), BFChannelConfig{});
- slot->Wet.Buffer = slot->MixBuffer.data();
- slot->Wet.NumChannels = static_cast<ALuint>(count);
+ slot->Wet.Buffer = {slot->MixBuffer.data(), slot->MixBuffer.size()};
}
@@ -950,10 +953,8 @@ void CalcAmbiCoeffs(const ALfloat y, const ALfloat z, const ALfloat x, const ALf
void ComputePanGains(const MixParams *mix, const ALfloat *RESTRICT coeffs, ALfloat ingain, ALfloat (&gains)[MAX_OUTPUT_CHANNELS])
{
auto ambimap = mix->AmbiMap.cbegin();
- const ALuint numchans{mix->NumChannels};
- ASSUME(numchans > 0);
- auto iter = std::transform(ambimap, ambimap+numchans, std::begin(gains),
+ auto iter = std::transform(ambimap, ambimap+mix->Buffer.size(), std::begin(gains),
[coeffs,ingain](const BFChannelConfig &chanmap) noexcept -> ALfloat
{
ASSUME(chanmap.Index >= 0);
diff --git a/OpenAL32/Include/alMain.h b/OpenAL32/Include/alMain.h
index d7c22546..2237d3c8 100644
--- a/OpenAL32/Include/alMain.h
+++ b/OpenAL32/Include/alMain.h
@@ -308,10 +308,9 @@ using FloatBufferLine = std::array<float,BUFFERSIZE>;
struct MixParams {
/* Coefficient channel mapping for mixing to the buffer. */
- std::array<BFChannelConfig,MAX_OUTPUT_CHANNELS> AmbiMap;
+ std::array<BFChannelConfig,MAX_OUTPUT_CHANNELS> AmbiMap{};
- FloatBufferLine *Buffer{nullptr};
- ALuint NumChannels{0u};
+ al::span<FloatBufferLine> Buffer;
};
struct RealMixParams {
diff --git a/OpenAL32/alAuxEffectSlot.cpp b/OpenAL32/alAuxEffectSlot.cpp
index 249f7cf3..55fbc622 100644
--- a/OpenAL32/alAuxEffectSlot.cpp
+++ b/OpenAL32/alAuxEffectSlot.cpp
@@ -643,7 +643,7 @@ ALenum InitializeEffect(ALCcontext *Context, ALeffectslot *EffectSlot, ALeffect
FPUCtl mixer_mode{};
ALCdevice *Device{Context->Device};
std::unique_lock<std::mutex> statelock{Device->StateLock};
- State->mOutTarget = {Device->Dry.Buffer, Device->Dry.NumChannels};
+ State->mOutTarget = Device->Dry.Buffer;
if(State->deviceUpdate(Device) == AL_FALSE)
{
statelock.unlock();