diff options
author | Chris Robinson <[email protected]> | 2019-08-25 17:54:36 -0700 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2019-08-25 17:54:36 -0700 |
commit | 164626a7be1cd0a9b92d34b9bb7f5c891fe57fae (patch) | |
tree | 993608d71dc619472d017775b9f25e3c601f7222 /alc | |
parent | b93098f7df73b877d40303ce3d9e4d9776a9c245 (diff) |
Pass unsigned sample count to aluMixData
Diffstat (limited to 'alc')
-rw-r--r-- | alc/alc.cpp | 2 | ||||
-rw-r--r-- | alc/alcmain.h | 2 | ||||
-rw-r--r-- | alc/alu.cpp | 22 | ||||
-rw-r--r-- | alc/alu.h | 2 | ||||
-rw-r--r-- | alc/panning.cpp | 4 |
5 files changed, 16 insertions, 16 deletions
diff --git a/alc/alc.cpp b/alc/alc.cpp index 9be224d5..a69a8e7c 100644 --- a/alc/alc.cpp +++ b/alc/alc.cpp @@ -4074,7 +4074,7 @@ START_API_FUNC alcSetError(dev.get(), ALC_INVALID_VALUE); else { - BackendLockGuard _{*device->Backend}; + BackendLockGuard _{*dev->Backend}; aluMixData(dev.get(), buffer, samples); } } diff --git a/alc/alcmain.h b/alc/alcmain.h index 6b6a8de3..556268ce 100644 --- a/alc/alcmain.h +++ b/alc/alcmain.h @@ -113,7 +113,7 @@ class DistanceComp { public: struct DistData { ALfloat Gain{1.0f}; - ALsizei Length{0}; /* Valid range is [0...MAX_DELAY_LENGTH). */ + ALuint Length{0u}; /* Valid range is [0...MAX_DELAY_LENGTH). */ ALfloat *Buffer{nullptr}; }; diff --git a/alc/alu.cpp b/alc/alu.cpp index c961f5d5..ba42c21f 100644 --- a/alc/alu.cpp +++ b/alc/alu.cpp @@ -1343,7 +1343,7 @@ void ProcessParamUpdates(ALCcontext *ctx, const ALeffectslotArray &slots, IncrementRef(ctx->mUpdateCount); } -void ProcessContext(ALCcontext *ctx, const ALsizei SamplesToDo) +void ProcessContext(ALCcontext *ctx, const ALuint SamplesToDo) { ASSUME(SamplesToDo > 0); @@ -1424,7 +1424,7 @@ void ProcessContext(ALCcontext *ctx, const ALsizei SamplesToDo) void ApplyStablizer(FrontStablizer *Stablizer, const al::span<FloatBufferLine> Buffer, - const ALuint lidx, const ALuint ridx, const ALuint cidx, const ALsizei SamplesToDo) + const ALuint lidx, const ALuint ridx, const ALuint cidx, const ALuint SamplesToDo) { ASSUME(SamplesToDo > 0); @@ -1439,7 +1439,7 @@ void ApplyStablizer(FrontStablizer *Stablizer, const al::span<FloatBufferLine> B auto &DelayBuf = Stablizer->DelayBuf[i]; auto buffer_end = Buffer[i].begin() + SamplesToDo; - if LIKELY(SamplesToDo >= ALsizei{FrontStablizer::DelayLength}) + if LIKELY(SamplesToDo >= ALuint{FrontStablizer::DelayLength}) { auto delay_end = std::rotate(Buffer[i].begin(), buffer_end - FrontStablizer::DelayLength, buffer_end); @@ -1489,7 +1489,7 @@ void ApplyStablizer(FrontStablizer *Stablizer, const al::span<FloatBufferLine> B apply_splitter(Buffer[lidx], Stablizer->DelayBuf[lidx], Stablizer->LFilter, lsplit); apply_splitter(Buffer[ridx], Stablizer->DelayBuf[ridx], Stablizer->RFilter, rsplit); - for(ALsizei i{0};i < SamplesToDo;i++) + for(ALuint i{0};i < SamplesToDo;i++) { ALfloat lfsum{lsplit[0][i] + rsplit[0][i]}; ALfloat hfsum{lsplit[1][i] + rsplit[1][i]}; @@ -1515,7 +1515,7 @@ void ApplyStablizer(FrontStablizer *Stablizer, const al::span<FloatBufferLine> B } } -void ApplyDistanceComp(const al::span<FloatBufferLine> Samples, const ALsizei SamplesToDo, +void ApplyDistanceComp(const al::span<FloatBufferLine> Samples, const ALuint SamplesToDo, const DistanceComp::DistData *distcomp) { ASSUME(SamplesToDo > 0); @@ -1523,7 +1523,7 @@ void ApplyDistanceComp(const al::span<FloatBufferLine> Samples, const ALsizei Sa for(auto &chanbuffer : Samples) { const ALfloat gain{distcomp->Gain}; - const ALsizei base{distcomp->Length}; + const ALuint base{distcomp->Length}; ALfloat *distbuf{al::assume_aligned<16>(distcomp->Buffer)}; ++distcomp; @@ -1547,7 +1547,7 @@ void ApplyDistanceComp(const al::span<FloatBufferLine> Samples, const ALsizei Sa } void ApplyDither(const al::span<FloatBufferLine> Samples, ALuint *dither_seed, - const ALfloat quant_scale, const ALsizei SamplesToDo) + const ALfloat quant_scale, const ALuint SamplesToDo) { /* Dithering. Generate whitenoise (uniform distribution of random values * between -1 and +1) and add it to the sample values, after scaling up to @@ -1605,7 +1605,7 @@ template<> inline ALubyte SampleConv(ALfloat val) noexcept template<DevFmtType T> void Write(const al::span<const FloatBufferLine> InBuffer, ALvoid *OutBuffer, const size_t Offset, - const ALsizei SamplesToDo) + const ALuint SamplesToDo) { using SampleType = typename DevFmtTypeTraits<T>::Type; @@ -1629,12 +1629,12 @@ void Write(const al::span<const FloatBufferLine> InBuffer, ALvoid *OutBuffer, co } // namespace -void aluMixData(ALCdevice *device, ALvoid *OutBuffer, ALsizei NumSamples) +void aluMixData(ALCdevice *device, ALvoid *OutBuffer, const ALuint NumSamples) { FPUCtl mixer_mode{}; - for(ALsizei SamplesDone{0};SamplesDone < NumSamples;) + for(ALuint SamplesDone{0u};SamplesDone < NumSamples;) { - const ALsizei SamplesToDo{mini(NumSamples-SamplesDone, BUFFERSIZE)}; + const ALuint SamplesToDo{minu(NumSamples-SamplesDone, BUFFERSIZE)}; /* Clear main mixing buffers. */ std::for_each(device->MixBuffer.begin(), device->MixBuffer.end(), @@ -446,7 +446,7 @@ inline std::array<ALfloat,MAX_AMBI_CHANNELS> GetAmbiIdentityRow(size_t i) noexce void MixVoice(ALvoice *voice, ALvoice::State vstate, const ALuint SourceID, ALCcontext *Context, const ALuint SamplesToDo); -void aluMixData(ALCdevice *device, ALvoid *OutBuffer, ALsizei NumSamples); +void aluMixData(ALCdevice *device, ALvoid *OutBuffer, const ALuint NumSamples); /* Caller must lock the device state, and the mixer must not be running. */ void aluHandleDisconnect(ALCdevice *device, const char *msg, ...) DECL_FORMAT(printf, 2, 3); diff --git a/alc/panning.cpp b/alc/panning.cpp index d946d1fc..5143b1ea 100644 --- a/alc/panning.cpp +++ b/alc/panning.cpp @@ -318,9 +318,9 @@ void InitDistanceComp(ALCdevice *device, const AmbDecConf *conf, const ALsizei ( delay = ALfloat{MAX_DELAY_LENGTH-1}; } - ChanDelay[chan].Length = static_cast<ALsizei>(delay); + ChanDelay[chan].Length = static_cast<ALuint>(delay); ChanDelay[chan].Gain = speaker.Distance / maxdist; - TRACE("Channel %u \"%s\" distance compensation: %d samples, %f gain\n", chan, + TRACE("Channel %u \"%s\" distance compensation: %u samples, %f gain\n", chan, speaker.Name.c_str(), ChanDelay[chan].Length, ChanDelay[chan].Gain); /* Round up to the next 4th sample, so each channel buffer starts |