aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--al/source.cpp10
-rw-r--r--al/source.h2
-rw-r--r--alc/alc.cpp33
-rw-r--r--alc/alcmain.h2
-rw-r--r--alc/alu.cpp8
-rw-r--r--alc/mixvoice.cpp7
6 files changed, 32 insertions, 30 deletions
diff --git a/al/source.cpp b/al/source.cpp
index 09b4133c..478ee3d2 100644
--- a/al/source.cpp
+++ b/al/source.cpp
@@ -522,7 +522,7 @@ bool EnsureSources(ALCcontext *context, size_t needed)
return true;
}
-ALsource *AllocSource(ALCcontext *context, ALsizei num_sends)
+ALsource *AllocSource(ALCcontext *context, ALuint num_sends)
{
auto sublist = std::find_if(context->mSourceList.begin(), context->mSourceList.end(),
[](const SourceSubList &entry) noexcept -> bool
@@ -1315,7 +1315,7 @@ bool SetSourceiv(ALsource *Source, ALCcontext *Context, SourceProp prop, const a
slotlock = std::unique_lock<std::mutex>{Context->mEffectSlotLock};
if(values[0] && (slot=LookupEffectSlot(Context, static_cast<ALuint>(values[0]))) == nullptr)
SETERR_RETURN(Context, AL_INVALID_VALUE, false, "Invalid effect ID %u", values[0]);
- if(static_cast<ALuint>(values[1]) >= static_cast<ALuint>(device->NumAuxSends))
+ if(static_cast<ALuint>(values[1]) >= device->NumAuxSends)
SETERR_RETURN(Context, AL_INVALID_VALUE, false, "Invalid send %u", values[1]);
filtlock = std::unique_lock<std::mutex>{device->FilterLock};
@@ -2086,7 +2086,7 @@ START_API_FUNC
}
else
{
- const ALsizei num_sends{device->NumAuxSends};
+ const ALuint num_sends{device->NumAuxSends};
al::vector<ALuint> ids;
ids.reserve(static_cast<ALuint>(n));
do {
@@ -3220,7 +3220,7 @@ START_API_FUNC
END_API_FUNC
-ALsource::ALsource(ALsizei num_sends)
+ALsource::ALsource(ALuint num_sends)
{
InnerAngle = 360.0f;
OuterAngle = 360.0f;
@@ -3272,7 +3272,7 @@ ALsource::ALsource(ALsizei num_sends)
Direct.HFReference = LOWPASSFREQREF;
Direct.GainLF = 1.0f;
Direct.LFReference = HIGHPASSFREQREF;
- Send.resize(static_cast<ALuint>(num_sends));
+ Send.resize(num_sends);
for(auto &send : Send)
{
send.Slot = nullptr;
diff --git a/al/source.h b/al/source.h
index e0219a04..7ca889d7 100644
--- a/al/source.h
+++ b/al/source.h
@@ -117,7 +117,7 @@ struct ALsource {
ALuint id{0};
- ALsource(ALsizei num_sends);
+ ALsource(ALuint num_sends);
~ALsource();
ALsource(const ALsource&) = delete;
diff --git a/alc/alc.cpp b/alc/alc.cpp
index a819bbf7..6d7228f5 100644
--- a/alc/alc.cpp
+++ b/alc/alc.cpp
@@ -1614,15 +1614,15 @@ static inline void UpdateClockBase(ALCdevice *device)
*/
static ALCenum UpdateDeviceParams(ALCdevice *device, const ALCint *attrList)
{
- HrtfRequestMode hrtf_userreq = Hrtf_Default;
- HrtfRequestMode hrtf_appreq = Hrtf_Default;
- ALCenum gainLimiter = device->LimiterState;
- const ALsizei old_sends = device->NumAuxSends;
- ALsizei new_sends = device->NumAuxSends;
+ HrtfRequestMode hrtf_userreq{Hrtf_Default};
+ HrtfRequestMode hrtf_appreq{Hrtf_Default};
+ ALCenum gainLimiter{device->LimiterState};
+ const ALCuint old_sends{device->NumAuxSends};
+ ALCuint new_sends{device->NumAuxSends};
DevFmtChannels oldChans;
DevFmtType oldType;
ALboolean update_failed;
- ALCsizei hrtf_id = -1;
+ ALCsizei hrtf_id{-1};
ALCuint oldFreq;
if((!attrList || !attrList[0]) && device->Type == Loopback)
@@ -1644,7 +1644,7 @@ static ALCenum UpdateDeviceParams(ALCdevice *device, const ALCint *attrList)
ALuint numMono{device->NumMonoSources};
ALuint numStereo{device->NumStereoSources};
- ALsizei numSends{old_sends};
+ ALuint numSends{old_sends};
#define TRACE_ATTR(a, v) TRACE("%s = %d\n", #a, v)
while(attrList[attrIdx])
@@ -1694,9 +1694,10 @@ static ALCenum UpdateDeviceParams(ALCdevice *device, const ALCint *attrList)
break;
case ALC_MAX_AUXILIARY_SENDS:
- numSends = attrList[attrIdx + 1];
+ numSends = static_cast<ALuint>(attrList[attrIdx + 1]);
TRACE_ATTR(ALC_MAX_AUXILIARY_SENDS, numSends);
- numSends = clampi(numSends, 0, MAX_SENDS);
+ if(numSends > INT_MAX) numSends = 0;
+ else numSends = minu(numSends, MAX_SENDS);
break;
case ALC_HRTF_SOFT:
@@ -1828,7 +1829,7 @@ static ALCenum UpdateDeviceParams(ALCdevice *device, const ALCint *attrList)
device->NumStereoSources = numStereo;
if(auto sendsopt = ConfigValueInt(devname, nullptr, "sends"))
- new_sends = mini(numSends, clampi(*sendsopt, 0, MAX_SENDS));
+ new_sends = minu(numSends, static_cast<ALuint>(clampi(*sendsopt, 0, MAX_SENDS)));
else
new_sends = numSends;
}
@@ -2176,7 +2177,7 @@ static ALCenum UpdateDeviceParams(ALCdevice *device, const ALCint *attrList)
if(device->NumAuxSends < old_sends)
{
- const ALsizei num_sends{device->NumAuxSends};
+ const ALuint num_sends{device->NumAuxSends};
/* Clear extraneous property set sends. */
auto clear_sends = [num_sends](ALvoice &voice) -> void
{
@@ -2871,7 +2872,7 @@ static size_t GetIntegerv(ALCdevice *device, ALCenum param, const al::span<ALCin
values[i++] = static_cast<int>(device->NumStereoSources);
values[i++] = ALC_MAX_AUXILIARY_SENDS;
- values[i++] = device->NumAuxSends;
+ values[i++] = static_cast<ALCint>(device->NumAuxSends);
values[i++] = ALC_HRTF_SOFT;
values[i++] = (device->mHrtf ? ALC_TRUE : ALC_FALSE);
@@ -2984,7 +2985,7 @@ static size_t GetIntegerv(ALCdevice *device, ALCenum param, const al::span<ALCin
return 1;
case ALC_MAX_AUXILIARY_SENDS:
- values[0] = device->NumAuxSends;
+ values[0] = static_cast<ALCint>(device->NumAuxSends);
return 1;
case ALC_CONNECTED:
@@ -3647,7 +3648,8 @@ START_API_FUNC
}
if(auto sendsopt = ConfigValueInt(deviceName, nullptr, "sends"))
- device->NumAuxSends = clampi(DEFAULT_SENDS, 0, clampi(*sendsopt, 0, MAX_SENDS));
+ device->NumAuxSends = clampu(DEFAULT_SENDS, 0,
+ static_cast<ALuint>(clampi(*sendsopt, 0, MAX_SENDS)));
device->NumStereoSources = 1;
device->NumMonoSources = device->SourcesMax - device->NumStereoSources;
@@ -3959,7 +3961,8 @@ START_API_FUNC
}
if(auto sendsopt = ConfigValueInt(nullptr, nullptr, "sends"))
- device->NumAuxSends = clampi(DEFAULT_SENDS, 0, clampi(*sendsopt, 0, MAX_SENDS));
+ device->NumAuxSends = clampu(DEFAULT_SENDS, 0,
+ static_cast<ALuint>(clampi(*sendsopt, 0, MAX_SENDS)));
device->NumStereoSources = 1;
device->NumMonoSources = device->SourcesMax - device->NumStereoSources;
diff --git a/alc/alcmain.h b/alc/alcmain.h
index fb93488f..338897ab 100644
--- a/alc/alcmain.h
+++ b/alc/alcmain.h
@@ -242,7 +242,7 @@ struct ALCdevice : public al::intrusive_ref<ALCdevice> {
ALCuint NumMonoSources{};
ALCuint NumStereoSources{};
- ALsizei NumAuxSends{};
+ ALCuint NumAuxSends{};
// Map of Buffers for this device
std::mutex BufferLock;
diff --git a/alc/alu.cpp b/alc/alu.cpp
index d9464125..0def577e 100644
--- a/alc/alu.cpp
+++ b/alc/alu.cpp
@@ -451,7 +451,7 @@ void CalcPanningAndFilters(ALvoice *voice, const ALfloat xpos, const ALfloat ypo
};
const auto Frequency = static_cast<ALfloat>(Device->Frequency);
- const auto NumSends = static_cast<ALuint>(Device->NumAuxSends);
+ const ALuint NumSends{Device->NumAuxSends};
bool DirectChannels{props->DirectChannels != AL_FALSE};
const ChanMap *chans{nullptr};
@@ -923,7 +923,7 @@ void CalcNonAttnSourceParams(ALvoice *voice, const ALvoicePropsBase *props, cons
ALeffectslot *SendSlots[MAX_SENDS];
voice->mDirect.Buffer = Device->Dry.Buffer;
- for(ALuint i{0};i < static_cast<ALuint>(Device->NumAuxSends);i++)
+ for(ALuint i{0};i < Device->NumAuxSends;i++)
{
SendSlots[i] = props->Send[i].Slot;
if(!SendSlots[i] && i == 0)
@@ -958,7 +958,7 @@ void CalcNonAttnSourceParams(ALvoice *voice, const ALvoicePropsBase *props, cons
ALfloat DryGainHF{props->Direct.GainHF};
ALfloat DryGainLF{props->Direct.GainLF};
ALfloat WetGain[MAX_SENDS], WetGainHF[MAX_SENDS], WetGainLF[MAX_SENDS];
- for(ALsizei i{0};i < Device->NumAuxSends;i++)
+ for(ALuint i{0};i < Device->NumAuxSends;i++)
{
WetGain[i] = clampf(props->Gain, props->MinGain, props->MaxGain);
WetGain[i] *= props->Send[i].Gain * Listener.Params.Gain;
@@ -974,7 +974,7 @@ void CalcNonAttnSourceParams(ALvoice *voice, const ALvoicePropsBase *props, cons
void CalcAttnSourceParams(ALvoice *voice, const ALvoicePropsBase *props, const ALCcontext *ALContext)
{
const ALCdevice *Device{ALContext->mDevice.get()};
- const auto NumSends = static_cast<ALuint>(Device->NumAuxSends);
+ const ALuint NumSends{Device->NumAuxSends};
const ALlistener &Listener = ALContext->mListener;
/* Set mixing buffers and get send parameters. */
diff --git a/alc/mixvoice.cpp b/alc/mixvoice.cpp
index 3c621934..9d7dead4 100644
--- a/alc/mixvoice.cpp
+++ b/alc/mixvoice.cpp
@@ -495,10 +495,9 @@ void ALvoice::mix(State vstate, ALCcontext *Context, const ALuint SamplesToDo)
ASSUME(increment > 0);
ALCdevice *Device{Context->mDevice.get()};
- const ALsizei NumSends{Device->NumAuxSends};
+ const ALuint NumSends{Device->NumAuxSends};
const ALsizei IrSize{Device->mHrtf ? Device->mHrtf->irSize : 0};
- ASSUME(NumSends >= 0);
ASSUME(IrSize >= 0);
ResamplerFunc Resample{(increment == FRACTIONONE && DataPosFrac == 0) ?
@@ -517,7 +516,7 @@ void ALvoice::mix(State vstate, ALCcontext *Context, const ALuint SamplesToDo)
std::begin(parms.Gains.Current));
else
parms.Hrtf.Old = parms.Hrtf.Target;
- for(ALsizei send{0};send < NumSends;++send)
+ for(ALuint send{0};send < NumSends;++send)
{
if(mSend[send].Buffer.empty())
continue;
@@ -785,7 +784,7 @@ void ALvoice::mix(State vstate, ALCcontext *Context, const ALuint SamplesToDo)
}
}
- for(ALsizei send{0};send < NumSends;++send)
+ for(ALuint send{0};send < NumSends;++send)
{
if(mSend[send].Buffer.empty())
continue;