diff options
-rw-r--r-- | Alc/alc.cpp | 4 | ||||
-rw-r--r-- | Alc/alu.cpp | 25 | ||||
-rw-r--r-- | Alc/bformatdec.cpp | 7 | ||||
-rw-r--r-- | Alc/bformatdec.h | 2 | ||||
-rw-r--r-- | Alc/mastering.cpp | 22 | ||||
-rw-r--r-- | Alc/mastering.h | 16 | ||||
-rw-r--r-- | OpenAL32/Include/alMain.h | 2 |
7 files changed, 36 insertions, 42 deletions
diff --git a/Alc/alc.cpp b/Alc/alc.cpp index b7be4f7b..010ea5f9 100644 --- a/Alc/alc.cpp +++ b/Alc/alc.cpp @@ -1931,9 +1931,9 @@ static ALCenum UpdateDeviceParams(ALCdevice *device, const ALCint *attrList) device->RealOut.NumChannels); /* Allocate extra channels for any post-filter output. */ - const ALsizei num_chans{device->Dry.NumChannels + device->RealOut.NumChannels}; + const ALuint num_chans{device->Dry.NumChannels + device->RealOut.NumChannels}; - TRACE("Allocating %d channels, %zu bytes\n", num_chans, + TRACE("Allocating %u channels, %zu bytes\n", num_chans, num_chans*sizeof(device->MixBuffer[0])); device->MixBuffer.resize(num_chans); diff --git a/Alc/alu.cpp b/Alc/alu.cpp index 00867810..fbafd021 100644 --- a/Alc/alu.cpp +++ b/Alc/alu.cpp @@ -691,8 +691,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, - static_cast<size_t>(Device->RealOut.NumChannels)}; + voice->mDirect.Buffer = {Device->RealOut.Buffer, Device->RealOut.NumChannels}; for(ALsizei c{0};c < num_channels;c++) { @@ -721,8 +720,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, - static_cast<size_t>(Device->RealOut.NumChannels)}; + voice->mDirect.Buffer = {Device->RealOut.Buffer, Device->RealOut.NumChannels}; if(Distance > std::numeric_limits<float>::epsilon()) { @@ -1469,8 +1467,8 @@ void ProcessContext(ALCcontext *ctx, const ALsizei SamplesToDo) } -void ApplyStablizer(FrontStablizer *Stablizer, FloatBufferLine *Buffer, const int lidx, - const int ridx, const int cidx, const ALsizei SamplesToDo, const ALsizei NumChannels) +void ApplyStablizer(FrontStablizer *Stablizer, FloatBufferLine *Buffer, const ALuint lidx, + const ALuint ridx, const ALuint cidx, const ALsizei SamplesToDo, const ALuint NumChannels) { ASSUME(SamplesToDo > 0); ASSUME(NumChannels > 0); @@ -1478,7 +1476,7 @@ void ApplyStablizer(FrontStablizer *Stablizer, FloatBufferLine *Buffer, const in /* Apply a delay to all channels, except the front-left and front-right, so * they maintain correct timing. */ - for(ALsizei i{0};i < NumChannels;i++) + for(ALuint i{0};i < NumChannels;i++) { if(i == lidx || i == ridx) continue; @@ -1562,12 +1560,12 @@ void ApplyStablizer(FrontStablizer *Stablizer, FloatBufferLine *Buffer, const in } void ApplyDistanceComp(FloatBufferLine *Samples, const DistanceComp &distcomp, - const ALsizei SamplesToDo, const ALsizei numchans) + const ALsizei SamplesToDo, const ALuint numchans) { ASSUME(SamplesToDo > 0); ASSUME(numchans > 0); - for(ALsizei c{0};c < numchans;c++) + for(ALuint c{0};c < numchans;c++) { const ALfloat gain{distcomp[c].Gain}; const ALsizei base{distcomp[c].Length}; @@ -1593,7 +1591,7 @@ void ApplyDistanceComp(FloatBufferLine *Samples, const DistanceComp &distcomp, } void ApplyDither(FloatBufferLine *Samples, ALuint *dither_seed, const ALfloat quant_scale, - const ALsizei SamplesToDo, const ALsizei numchans) + const ALsizei SamplesToDo, const ALuint numchans) { ASSUME(numchans > 0); @@ -1652,12 +1650,11 @@ template<> inline ALubyte SampleConv(ALfloat val) noexcept { return SampleConv<ALbyte>(val) + 128; } template<DevFmtType T> -void Write(const FloatBufferLine *InBuffer, ALvoid *OutBuffer, const ALsizei Offset, - const ALsizei SamplesToDo, const ALsizei numchans) +void Write(const FloatBufferLine *InBuffer, ALvoid *OutBuffer, const size_t Offset, + const ALsizei SamplesToDo, const ALuint numchans) { using SampleType = typename DevFmtTypeTraits<T>::Type; - ASSUME(Offset >= 0); ASSUME(numchans > 0); SampleType *outbase = static_cast<SampleType*>(OutBuffer) + Offset*numchans; auto conv_channel = [&outbase,SamplesToDo,numchans](const FloatBufferLine &inbuf) -> void @@ -1751,7 +1748,7 @@ void aluMixData(ALCdevice *device, ALvoid *OutBuffer, ALsizei NumSamples) if(LIKELY(OutBuffer)) { FloatBufferLine *Buffer{device->RealOut.Buffer}; - ALsizei Channels{device->RealOut.NumChannels}; + ALuint Channels{device->RealOut.NumChannels}; /* Finally, interleave and convert samples, writing to the device's * output buffer. diff --git a/Alc/bformatdec.cpp b/Alc/bformatdec.cpp index 5d9b3503..6d2dbfbe 100644 --- a/Alc/bformatdec.cpp +++ b/Alc/bformatdec.cpp @@ -146,7 +146,8 @@ BFormatDec::BFormatDec(const ALsizei inchans, const ALsizei chancount, } -void BFormatDec::process(FloatBufferLine *OutBuffer, const ALsizei OutChannels, const FloatBufferLine *InSamples, const ALsizei SamplesToDo) +void BFormatDec::process(FloatBufferLine *OutBuffer, const ALuint OutChannels, + const FloatBufferLine *InSamples, const ALsizei SamplesToDo) { ASSUME(OutChannels > 0); ASSUME(mNumChannels > 0); @@ -159,7 +160,7 @@ void BFormatDec::process(FloatBufferLine *OutBuffer, const ALsizei OutChannels, const al::span<const FloatBufferLine> hfsamples{mSamplesHF, mSamplesHF+mNumChannels}; const al::span<const FloatBufferLine> lfsamples{mSamplesLF, mSamplesLF+mNumChannels}; - for(ALsizei chan{0};chan < OutChannels;chan++) + for(ALuint chan{0};chan < OutChannels;chan++) { if(UNLIKELY(!(mEnabled&(1<<chan)))) continue; @@ -171,7 +172,7 @@ void BFormatDec::process(FloatBufferLine *OutBuffer, const ALsizei OutChannels, else { const al::span<const FloatBufferLine> insamples{InSamples, InSamples+mNumChannels}; - for(ALsizei chan{0};chan < OutChannels;chan++) + for(ALuint chan{0};chan < OutChannels;chan++) { if(UNLIKELY(!(mEnabled&(1<<chan)))) continue; diff --git a/Alc/bformatdec.h b/Alc/bformatdec.h index ef81b41d..4693fd4b 100644 --- a/Alc/bformatdec.h +++ b/Alc/bformatdec.h @@ -43,7 +43,7 @@ public: const ALsizei (&chanmap)[MAX_OUTPUT_CHANNELS]); /* Decodes the ambisonic input to the given output channels. */ - void process(FloatBufferLine *OutBuffer, const ALsizei OutChannels, + void process(FloatBufferLine *OutBuffer, const ALuint OutChannels, const FloatBufferLine *InSamples, const ALsizei SamplesToDo); /* Retrieves per-order HF scaling factors for "upsampling" ambisonic data. */ diff --git a/Alc/mastering.cpp b/Alc/mastering.cpp index f5d36a59..551fdcdf 100644 --- a/Alc/mastering.cpp +++ b/Alc/mastering.cpp @@ -100,7 +100,7 @@ void ShiftSlidingHold(SlidingHold *Hold, const ALsizei n) void LinkChannels(Compressor *Comp, const ALsizei SamplesToDo, const FloatBufferLine *OutBuffer) { const ALsizei index{Comp->mLookAhead}; - const ALsizei numChans{Comp->mNumChans}; + const ALuint numChans{Comp->mNumChans}; ASSUME(SamplesToDo > 0); ASSUME(numChans > 0); @@ -295,14 +295,14 @@ void GainCompressor(Compressor *Comp, const ALsizei SamplesToDo) */ void SignalDelay(Compressor *Comp, const ALsizei SamplesToDo, FloatBufferLine *OutBuffer) { - const ALsizei numChans{Comp->mNumChans}; + const ALuint numChans{Comp->mNumChans}; const ALsizei lookAhead{Comp->mLookAhead}; ASSUME(SamplesToDo > 0); ASSUME(numChans > 0); ASSUME(lookAhead > 0); - for(ALsizei c{0};c < numChans;c++) + for(ALuint c{0};c < numChans;c++) { ALfloat *inout{al::assume_aligned<16>(OutBuffer[c].data())}; ALfloat *delaybuf{al::assume_aligned<16>(Comp->mDelay[c].data())}; @@ -347,14 +347,12 @@ void SignalDelay(Compressor *Comp, const ALsizei SamplesToDo, FloatBufferLine *O * ReleaseTimeMin - Release time (in seconds). Acts as a maximum when * automating release time. */ -std::unique_ptr<Compressor> CompressorInit(const ALsizei NumChans, const ALuint SampleRate, - const ALboolean AutoKnee, const ALboolean AutoAttack, - const ALboolean AutoRelease, const ALboolean AutoPostGain, - const ALboolean AutoDeclip, const ALfloat LookAheadTime, - const ALfloat HoldTime, const ALfloat PreGainDb, - const ALfloat PostGainDb, const ALfloat ThresholdDb, - const ALfloat Ratio, const ALfloat KneeDb, - const ALfloat AttackTime, const ALfloat ReleaseTime) +std::unique_ptr<Compressor> CompressorInit(const ALuint NumChans, const ALuint SampleRate, + const ALboolean AutoKnee, const ALboolean AutoAttack, const ALboolean AutoRelease, + const ALboolean AutoPostGain, const ALboolean AutoDeclip, const ALfloat LookAheadTime, + const ALfloat HoldTime, const ALfloat PreGainDb, const ALfloat PostGainDb, + const ALfloat ThresholdDb, const ALfloat Ratio, const ALfloat KneeDb, const ALfloat AttackTime, + const ALfloat ReleaseTime) { const auto lookAhead = static_cast<ALsizei>( clampf(std::round(LookAheadTime*SampleRate), 0.0f, BUFFERSIZE-1)); @@ -433,7 +431,7 @@ Compressor::~Compressor() void Compressor::process(const ALsizei SamplesToDo, FloatBufferLine *OutBuffer) { - const ALsizei numChans{mNumChans}; + const ALuint numChans{mNumChans}; ASSUME(SamplesToDo > 0); ASSUME(numChans > 0); diff --git a/Alc/mastering.h b/Alc/mastering.h index 31d0ef97..1003fa6c 100644 --- a/Alc/mastering.h +++ b/Alc/mastering.h @@ -23,7 +23,7 @@ struct SlidingHold; * http://c4dm.eecs.qmul.ac.uk/audioengineering/compressors/ */ struct Compressor { - ALsizei mNumChans{0}; + ALuint mNumChans{0u}; ALuint mSampleRate{0u}; struct { @@ -94,13 +94,11 @@ struct Compressor { * ReleaseTimeMin - Release time (in seconds). Acts as a maximum when * automating release time. */ -std::unique_ptr<Compressor> CompressorInit(const ALsizei NumChans, const ALuint SampleRate, - const ALboolean AutoKnee, const ALboolean AutoAttack, - const ALboolean AutoRelease, const ALboolean AutoPostGain, - const ALboolean AutoDeclip, const ALfloat LookAheadTime, - const ALfloat HoldTime, const ALfloat PreGainDb, - const ALfloat PostGainDb, const ALfloat ThresholdDb, - const ALfloat Ratio, const ALfloat KneeDb, - const ALfloat AttackTime, const ALfloat ReleaseTime); +std::unique_ptr<Compressor> CompressorInit(const ALuint NumChans, const ALuint SampleRate, + const ALboolean AutoKnee, const ALboolean AutoAttack, const ALboolean AutoRelease, + const ALboolean AutoPostGain, const ALboolean AutoDeclip, const ALfloat LookAheadTime, + const ALfloat HoldTime, const ALfloat PreGainDb, const ALfloat PostGainDb, + const ALfloat ThresholdDb, const ALfloat Ratio, const ALfloat KneeDb, const ALfloat AttackTime, + const ALfloat ReleaseTime); #endif /* MASTERING_H */ diff --git a/OpenAL32/Include/alMain.h b/OpenAL32/Include/alMain.h index 36042782..35ac617a 100644 --- a/OpenAL32/Include/alMain.h +++ b/OpenAL32/Include/alMain.h @@ -325,7 +325,7 @@ struct RealMixParams { std::array<ALint,MaxChannels> ChannelIndex{}; FloatBufferLine *Buffer{nullptr}; - ALsizei NumChannels{0}; + ALuint NumChannels{0u}; }; using POSTPROCESS = void(*)(ALCdevice *device, const ALsizei SamplesToDo); |