diff options
-rw-r--r-- | alc/bformatdec.cpp | 2 | ||||
-rw-r--r-- | alc/filters/splitter.cpp | 6 | ||||
-rw-r--r-- | alc/filters/splitter.h | 6 | ||||
-rw-r--r-- | alc/hrtf.cpp | 8 | ||||
-rw-r--r-- | alc/mixvoice.cpp | 1 |
5 files changed, 13 insertions, 10 deletions
diff --git a/alc/bformatdec.cpp b/alc/bformatdec.cpp index 889bbf3a..6b20dd84 100644 --- a/alc/bformatdec.cpp +++ b/alc/bformatdec.cpp @@ -146,6 +146,8 @@ BFormatDec::BFormatDec(const ALuint inchans, const ALsizei chancount, void BFormatDec::process(const al::span<FloatBufferLine> OutBuffer, const FloatBufferLine *InSamples, const ALsizei SamplesToDo) { + ASSUME(SamplesToDo > 0); + if(mDualBand) { for(ALuint i{0};i < mNumChannels;i++) diff --git a/alc/filters/splitter.cpp b/alc/filters/splitter.cpp index 7463d795..66806ea9 100644 --- a/alc/filters/splitter.cpp +++ b/alc/filters/splitter.cpp @@ -27,7 +27,7 @@ void BandSplitterR<Real>::init(Real f0norm) } template<typename Real> -void BandSplitterR<Real>::process(Real *hpout, Real *lpout, const Real *input, const int count) +void BandSplitterR<Real>::process(Real *hpout, Real *lpout, const Real *input, const size_t count) { ASSUME(count > 0); @@ -63,7 +63,7 @@ void BandSplitterR<Real>::process(Real *hpout, Real *lpout, const Real *input, c } template<typename Real> -void BandSplitterR<Real>::applyHfScale(Real *samples, const Real hfscale, const int count) +void BandSplitterR<Real>::applyHfScale(Real *samples, const Real hfscale, const size_t count) { ASSUME(count > 0); @@ -97,7 +97,7 @@ void BandSplitterR<Real>::applyHfScale(Real *samples, const Real hfscale, const } template<typename Real> -void BandSplitterR<Real>::applyAllpass(Real *samples, const int count) const +void BandSplitterR<Real>::applyAllpass(Real *samples, const size_t count) const { ASSUME(count > 0); diff --git a/alc/filters/splitter.h b/alc/filters/splitter.h index d7b0240d..52bda713 100644 --- a/alc/filters/splitter.h +++ b/alc/filters/splitter.h @@ -22,15 +22,15 @@ public: void init(Real f0norm); void clear() noexcept { lp_z1 = lp_z2 = ap_z1 = 0.0f; } - void process(Real *hpout, Real *lpout, const Real *input, const int count); + void process(Real *hpout, Real *lpout, const Real *input, const size_t count); - void applyHfScale(Real *samples, const Real hfscale, const int count); + void applyHfScale(Real *samples, const Real hfscale, const size_t count); /* The all-pass portion of the band splitter. Applies the same phase shift * without splitting the signal. Note that each use of this method is * indepedent, it does not track history between calls. */ - void applyAllpass(Real *samples, const int count) const; + void applyAllpass(Real *samples, const size_t count) const; }; using BandSplitter = BandSplitterR<float>; diff --git a/alc/hrtf.cpp b/alc/hrtf.cpp index a8b56019..590d102a 100644 --- a/alc/hrtf.cpp +++ b/alc/hrtf.cpp @@ -389,7 +389,7 @@ void BuildBFormatHrtf(const HrtfEntry *Hrtf, DirectHrtfState *state, const ALuin * sample array. This produces the forward response with a backwards * phase-shift (+n degrees becomes -n degrees). */ - splitter.applyAllpass(tmpfilt[2].data(), static_cast<int>(tmpfilt[2].size())); + splitter.applyAllpass(tmpfilt[2].data(), tmpfilt[2].size()); std::reverse(tmpfilt[2].begin(), tmpfilt[2].end()); /* Now apply the band-splitter. This applies the normal phase-shift, @@ -398,7 +398,7 @@ void BuildBFormatHrtf(const HrtfEntry *Hrtf, DirectHrtfState *state, const ALuin */ splitter.clear(); splitter.process(tmpfilt[0].data(), tmpfilt[1].data(), tmpfilt[2].data(), - static_cast<int>(tmpfilt[2].size())); + tmpfilt[2].size()); /* Apply left ear response with delay and HF scale. */ for(ALuint i{0u};i < NumChannels;++i) @@ -415,12 +415,12 @@ void BuildBFormatHrtf(const HrtfEntry *Hrtf, DirectHrtfState *state, const ALuin std::transform(fir, fir+Hrtf->irSize, tmpfilt[2].rbegin() + HRIR_LENGTH*3, [](const ALfloat (&ir)[2]) noexcept -> ALdouble { return ir[1]; }); - splitter.applyAllpass(tmpfilt[2].data(), static_cast<int>(tmpfilt[2].size())); + splitter.applyAllpass(tmpfilt[2].data(), tmpfilt[2].size()); std::reverse(tmpfilt[2].begin(), tmpfilt[2].end()); splitter.clear(); splitter.process(tmpfilt[0].data(), tmpfilt[1].data(), tmpfilt[2].data(), - static_cast<int>(tmpfilt[2].size())); + tmpfilt[2].size()); for(ALuint i{0u};i < NumChannels;++i) { diff --git a/alc/mixvoice.cpp b/alc/mixvoice.cpp index b1d7500a..06324397 100644 --- a/alc/mixvoice.cpp +++ b/alc/mixvoice.cpp @@ -624,6 +624,7 @@ void MixVoice(ALvoice *voice, ALvoice::State vstate, const ALuint SourceID, ALCc DstBufferSize &= ~3; } + ASSUME(DstBufferSize > 0); for(ALsizei chan{0};chan < NumChannels;chan++) { ALvoice::ChannelData &chandata = voice->mChans[chan]; |