aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2020-11-28 03:38:20 -0800
committerChris Robinson <[email protected]>2020-11-28 03:38:20 -0800
commit8750810f5cfceeffd5acf2f21e779d470d0dc88b (patch)
tree447b24c8d1b3ab926f2aa2ae40617938df1e9bb1
parenteb9b9fb4e59cadc308b8ebcdf3da59a961382224 (diff)
Change a couple macros into constexpr variables
-rw-r--r--al/buffer.cpp2
-rw-r--r--alc/alcmain.h12
-rw-r--r--alc/alu.cpp6
-rw-r--r--alc/backends/coreaudio.cpp2
-rw-r--r--alc/converter.cpp20
-rw-r--r--alc/converter.h6
-rw-r--r--alc/effects/autowah.cpp4
-rw-r--r--alc/effects/chorus.cpp2
-rw-r--r--alc/effects/distortion.cpp4
-rw-r--r--alc/effects/echo.cpp2
-rw-r--r--alc/effects/fshifter.cpp4
-rw-r--r--alc/effects/reverb.cpp4
-rw-r--r--alc/front_stablizer.h6
-rw-r--r--alc/hrtf.h2
-rw-r--r--alc/mastering.cpp20
-rw-r--r--alc/mastering.h4
-rw-r--r--alc/mixer/defs.h2
-rw-r--r--alc/uhjfilter.h8
-rw-r--r--alc/voice.cpp28
-rw-r--r--alc/voice.h2
-rw-r--r--core/bufferline.h4
21 files changed, 72 insertions, 72 deletions
diff --git a/al/buffer.cpp b/al/buffer.cpp
index 8591e957..0ee6b808 100644
--- a/al/buffer.cpp
+++ b/al/buffer.cpp
@@ -645,7 +645,7 @@ void PrepareCallback(ALCcontext *context, ALbuffer *ALBuf, ALsizei freq,
ALBuf->UnpackAmbiOrder : 0};
al::vector<al::byte,16>(FrameSizeFromFmt(DstChannels, DstType, ambiorder) *
- size_t{BUFFERSIZE + (MAX_RESAMPLER_PADDING>>1)}).swap(ALBuf->mData);
+ size_t{BufferLineSize + (MaxResamplerPadding>>1)}).swap(ALBuf->mData);
ALBuf->mCallback = callback;
ALBuf->mUserData = userptr;
diff --git a/alc/alcmain.h b/alc/alcmain.h
index b95791fb..7949baf2 100644
--- a/alc/alcmain.h
+++ b/alc/alcmain.h
@@ -251,16 +251,16 @@ struct ALCdevice : public al::intrusive_ref<ALCdevice> {
std::chrono::nanoseconds FixedLatency{0};
/* Temp storage used for mixer processing. */
- alignas(16) float SourceData[BUFFERSIZE + MAX_RESAMPLER_PADDING];
- alignas(16) float ResampledData[BUFFERSIZE];
- alignas(16) float FilteredData[BUFFERSIZE];
+ alignas(16) float SourceData[BufferLineSize + MaxResamplerPadding];
+ alignas(16) float ResampledData[BufferLineSize];
+ alignas(16) float FilteredData[BufferLineSize];
union {
- alignas(16) float HrtfSourceData[BUFFERSIZE + HRTF_HISTORY_LENGTH];
- alignas(16) float NfcSampleData[BUFFERSIZE];
+ alignas(16) float HrtfSourceData[BufferLineSize + HRTF_HISTORY_LENGTH];
+ alignas(16) float NfcSampleData[BufferLineSize];
};
/* Persistent storage for HRTF mixing. */
- alignas(16) float2 HrtfAccumData[BUFFERSIZE + HRIR_LENGTH + HRTF_DIRECT_DELAY];
+ alignas(16) float2 HrtfAccumData[BufferLineSize + HRIR_LENGTH + HRTF_DIRECT_DELAY];
/* Mixing buffer used by the Dry mix and Real output. */
al::vector<FloatBufferLine, 16> MixBuffer;
diff --git a/alc/alu.cpp b/alc/alu.cpp
index 10069fd1..a1ea92da 100644
--- a/alc/alu.cpp
+++ b/alc/alu.cpp
@@ -103,8 +103,8 @@ struct BSincTag;
struct FastBSincTag;
-static_assert(MAX_RESAMPLER_PADDING >= BSincPointsMax, "MAX_RESAMPLER_PADDING is too small");
-static_assert(!(MAX_RESAMPLER_PADDING&1), "MAX_RESAMPLER_PADDING is not a multiple of two");
+static_assert(MaxResamplerPadding >= BSincPointsMax, "MaxResamplerPadding is too small");
+static_assert(!(MaxResamplerPadding&1), "MaxResamplerPadding is not a multiple of two");
namespace {
@@ -1908,7 +1908,7 @@ void ALCdevice::renderSamples(void *outBuffer, const ALuint numSamples, const si
FPUCtl mixer_mode{};
for(ALuint written{0u};written < numSamples;)
{
- const ALuint samplesToDo{minu(numSamples-written, BUFFERSIZE)};
+ const ALuint samplesToDo{minu(numSamples-written, BufferLineSize)};
/* Clear main mixing buffers. */
for(FloatBufferLine &buffer : MixBuffer)
diff --git a/alc/backends/coreaudio.cpp b/alc/backends/coreaudio.cpp
index 31de700c..32f8d123 100644
--- a/alc/backends/coreaudio.cpp
+++ b/alc/backends/coreaudio.cpp
@@ -569,7 +569,7 @@ void CoreAudioCapture::open(const ALCchar *name)
double srateScale{double{outputFormat.mSampleRate} / mDevice->Frequency};
auto FrameCount64 = maxu64(static_cast<uint64_t>(std::ceil(mDevice->BufferSize*srateScale)),
static_cast<UInt32>(outputFormat.mSampleRate)/10);
- FrameCount64 += MAX_RESAMPLER_PADDING;
+ FrameCount64 += MaxResamplerPadding;
if(FrameCount64 > std::numeric_limits<int32_t>::max())
throw al::backend_exception{ALC_INVALID_VALUE,
"Calculated frame count is too large: %" PRIu64, FrameCount64};
diff --git a/alc/converter.cpp b/alc/converter.cpp
index 2b881645..57b902b8 100644
--- a/alc/converter.cpp
+++ b/alc/converter.cpp
@@ -202,8 +202,8 @@ uint SampleConverter::availableOut(uint srcframes) const
return 0;
}
- if(prepcount < MAX_RESAMPLER_PADDING
- && static_cast<uint>(MAX_RESAMPLER_PADDING - prepcount) >= srcframes)
+ if(prepcount < MaxResamplerPadding
+ && static_cast<uint>(MaxResamplerPadding - prepcount) >= srcframes)
{
/* Not enough input samples to generate an output sample. */
return 0;
@@ -211,7 +211,7 @@ uint SampleConverter::availableOut(uint srcframes) const
auto DataSize64 = static_cast<uint64_t>(prepcount);
DataSize64 += srcframes;
- DataSize64 -= MAX_RESAMPLER_PADDING;
+ DataSize64 -= MaxResamplerPadding;
DataSize64 <<= MixerFracBits;
DataSize64 -= mFracOffset;
@@ -247,10 +247,10 @@ uint SampleConverter::convert(const void **src, uint *srcframes, void *dst, uint
mSrcPrepCount = 0;
continue;
}
- uint toread{minu(NumSrcSamples, BUFFERSIZE - MAX_RESAMPLER_PADDING)};
+ const uint toread{minu(NumSrcSamples, BufferLineSize - MaxResamplerPadding)};
- if(prepcount < MAX_RESAMPLER_PADDING
- && static_cast<uint>(MAX_RESAMPLER_PADDING - prepcount) >= toread)
+ if(prepcount < MaxResamplerPadding
+ && static_cast<uint>(MaxResamplerPadding - prepcount) >= toread)
{
/* Not enough input samples to generate an output sample. Store
* what we're given for later.
@@ -269,13 +269,13 @@ uint SampleConverter::convert(const void **src, uint *srcframes, void *dst, uint
uint DataPosFrac{mFracOffset};
auto DataSize64 = static_cast<uint64_t>(prepcount);
DataSize64 += toread;
- DataSize64 -= MAX_RESAMPLER_PADDING;
+ DataSize64 -= MaxResamplerPadding;
DataSize64 <<= MixerFracBits;
DataSize64 -= DataPosFrac;
/* If we have a full prep, we can generate at least one sample. */
auto DstSize = static_cast<uint>(
- clampu64((DataSize64 + increment-1)/increment, 1, BUFFERSIZE));
+ clampu64((DataSize64 + increment-1)/increment, 1, BufferLineSize));
DstSize = minu(DstSize, dstframes-pos);
for(size_t chan{0u};chan < mChan.size();chan++)
@@ -306,7 +306,7 @@ uint SampleConverter::convert(const void **src, uint *srcframes, void *dst, uint
}
/* Now resample, and store the result in the output buffer. */
- const float *ResampledData{mResample(&mState, SrcData+(MAX_RESAMPLER_PADDING>>1),
+ const float *ResampledData{mResample(&mState, SrcData+(MaxResamplerPadding>>1),
DataPosFrac, increment, {DstData, DstSize})};
StoreSamples(DstSamples, ResampledData, mChan.size(), mDstType, DstSize);
@@ -317,7 +317,7 @@ uint SampleConverter::convert(const void **src, uint *srcframes, void *dst, uint
*/
DataPosFrac += increment*DstSize;
mSrcPrepCount = mini(prepcount + static_cast<int>(toread - (DataPosFrac>>MixerFracBits)),
- MAX_RESAMPLER_PADDING);
+ MaxResamplerPadding);
mFracOffset = DataPosFrac & MixerFracMask;
/* Update the src and dst pointers in case there's still more to do. */
diff --git a/alc/converter.h b/alc/converter.h
index 392c95e5..2ae77764 100644
--- a/alc/converter.h
+++ b/alc/converter.h
@@ -29,11 +29,11 @@ struct SampleConverter {
InterpState mState{};
ResamplerFunc mResample{};
- alignas(16) float mSrcSamples[BUFFERSIZE]{};
- alignas(16) float mDstSamples[BUFFERSIZE]{};
+ alignas(16) float mSrcSamples[BufferLineSize]{};
+ alignas(16) float mDstSamples[BufferLineSize]{};
struct ChanSamples {
- alignas(16) float PrevSamples[MAX_RESAMPLER_PADDING];
+ alignas(16) float PrevSamples[MaxResamplerPadding];
};
al::FlexArray<ChanSamples> mChan;
diff --git a/alc/effects/autowah.cpp b/alc/effects/autowah.cpp
index de91c32f..5ac51e32 100644
--- a/alc/effects/autowah.cpp
+++ b/alc/effects/autowah.cpp
@@ -52,7 +52,7 @@ struct AutowahState final : public EffectState {
struct {
float cos_w0;
float alpha;
- } mEnv[BUFFERSIZE];
+ } mEnv[BufferLineSize];
struct {
/* Effect filters' history. */
@@ -66,7 +66,7 @@ struct AutowahState final : public EffectState {
} mChans[MAX_AMBI_CHANNELS];
/* Effects buffers */
- alignas(16) float mBufferOut[BUFFERSIZE];
+ alignas(16) float mBufferOut[BufferLineSize];
void deviceUpdate(const ALCdevice *device) override;
diff --git a/alc/effects/chorus.cpp b/alc/effects/chorus.cpp
index 81449b9b..68a79fba 100644
--- a/alc/effects/chorus.cpp
+++ b/alc/effects/chorus.cpp
@@ -109,7 +109,7 @@ void ChorusState::deviceUpdate(const ALCdevice *Device)
void ChorusState::update(const ALCcontext *Context, const EffectSlot *Slot,
const EffectProps *props, const EffectTarget target)
{
- constexpr ALsizei mindelay{(MAX_RESAMPLER_PADDING>>1) << MixerFracBits};
+ constexpr int mindelay{(MaxResamplerPadding>>1) << MixerFracBits};
switch(props->Chorus.Waveform)
{
diff --git a/alc/effects/distortion.cpp b/alc/effects/distortion.cpp
index c3c1d241..757244c5 100644
--- a/alc/effects/distortion.cpp
+++ b/alc/effects/distortion.cpp
@@ -43,7 +43,7 @@ struct DistortionState final : public EffectState {
float mAttenuation{};
float mEdgeCoeff{};
- float mBuffer[2][BUFFERSIZE]{};
+ float mBuffer[2][BufferLineSize]{};
void deviceUpdate(const ALCdevice *device) override;
@@ -101,7 +101,7 @@ void DistortionState::process(const size_t samplesToDo, const al::span<const Flo
* bandpass filters using high frequencies, at which classic IIR
* filters became unstable.
*/
- size_t todo{minz(BUFFERSIZE, (samplesToDo-base) * 4)};
+ size_t todo{minz(BufferLineSize, (samplesToDo-base) * 4)};
/* Fill oversample buffer using zero stuffing. Multiply the sample by
* the amount of oversampling to maintain the signal's power.
diff --git a/alc/effects/echo.cpp b/alc/effects/echo.cpp
index 70aaf59c..a50d3c61 100644
--- a/alc/effects/echo.cpp
+++ b/alc/effects/echo.cpp
@@ -55,7 +55,7 @@ struct EchoState final : public EffectState {
BiquadFilter mFilter;
float mFeedGain{0.0f};
- alignas(16) float mTempBuffer[2][BUFFERSIZE];
+ alignas(16) float mTempBuffer[2][BufferLineSize];
void deviceUpdate(const ALCdevice *device) override;
void update(const ALCcontext *context, const EffectSlot *slot, const EffectProps *props,
diff --git a/alc/effects/fshifter.cpp b/alc/effects/fshifter.cpp
index da9b0ce2..c1acf08c 100644
--- a/alc/effects/fshifter.cpp
+++ b/alc/effects/fshifter.cpp
@@ -71,9 +71,9 @@ struct FshifterState final : public EffectState {
complex_d mOutFIFO[HIL_STEP]{};
complex_d mOutputAccum[HIL_SIZE]{};
complex_d mAnalytic[HIL_SIZE]{};
- complex_d mOutdata[BUFFERSIZE]{};
+ complex_d mOutdata[BufferLineSize]{};
- alignas(16) float mBufferOut[BUFFERSIZE]{};
+ alignas(16) float mBufferOut[BufferLineSize]{};
/* Effect gains for each output channel */
struct {
diff --git a/alc/effects/reverb.cpp b/alc/effects/reverb.cpp
index 78773abf..6471b210 100644
--- a/alc/effects/reverb.cpp
+++ b/alc/effects/reverb.cpp
@@ -562,12 +562,12 @@ void ReverbState::allocLines(const float frequency)
/* The main delay length includes the maximum early reflection delay, the
* largest early tap width, the maximum late reverb delay, and the
* largest late tap width. Finally, it must also be extended by the
- * update size (BUFFERSIZE) for block processing.
+ * update size (BufferLineSize) for block processing.
*/
float length{AL_EAXREVERB_MAX_REFLECTIONS_DELAY + EARLY_TAP_LENGTHS.back()*multiplier +
AL_EAXREVERB_MAX_LATE_REVERB_DELAY +
(LATE_LINE_LENGTHS.back() - LATE_LINE_LENGTHS.front())/float{NUM_LINES}*multiplier};
- totalSamples += mDelay.calcLineLength(length, totalSamples, frequency, BUFFERSIZE);
+ totalSamples += mDelay.calcLineLength(length, totalSamples, frequency, BufferLineSize);
/* The early vector all-pass line. */
length = EARLY_ALLPASS_LENGTHS.back() * multiplier;
diff --git a/alc/front_stablizer.h b/alc/front_stablizer.h
index 066a70af..94882835 100644
--- a/alc/front_stablizer.h
+++ b/alc/front_stablizer.h
@@ -14,11 +14,11 @@ struct FrontStablizer {
FrontStablizer(size_t numchans) : DelayBuf{numchans} { }
- alignas(16) std::array<float,BUFFERSIZE + DelayLength> Side{};
- alignas(16) std::array<float,BUFFERSIZE + DelayLength> MidDirect{};
+ alignas(16) std::array<float,BufferLineSize + DelayLength> Side{};
+ alignas(16) std::array<float,BufferLineSize + DelayLength> MidDirect{};
alignas(16) std::array<float,DelayLength> MidDelay{};
- alignas(16) std::array<float,BUFFERSIZE + DelayLength> TempBuf{};
+ alignas(16) std::array<float,BufferLineSize + DelayLength> TempBuf{};
BandSplitter MidFilter;
alignas(16) FloatBufferLine MidLF{};
diff --git a/alc/hrtf.h b/alc/hrtf.h
index 9bbe36b7..3b9a272c 100644
--- a/alc/hrtf.h
+++ b/alc/hrtf.h
@@ -88,7 +88,7 @@ struct DirectHrtfState {
alignas(16) HrirArray mCoeffs{};
};
- std::array<float,HRTF_DIRECT_DELAY+BUFFERSIZE> mTemp;
+ std::array<float,HRTF_DIRECT_DELAY+BufferLineSize> mTemp;
/* HRTF filter state for dry buffer content */
uint mIrSize{0};
diff --git a/alc/mastering.cpp b/alc/mastering.cpp
index e1e423b5..58f7ffa3 100644
--- a/alc/mastering.cpp
+++ b/alc/mastering.cpp
@@ -17,12 +17,12 @@
#include "opthelpers.h"
-/* These structures assume BUFFERSIZE is a power of 2. */
-static_assert((BUFFERSIZE & (BUFFERSIZE-1)) == 0, "BUFFERSIZE is not a power of 2");
+/* These structures assume BufferLineSize is a power of 2. */
+static_assert((BufferLineSize & (BufferLineSize-1)) == 0, "BufferLineSize is not a power of 2");
struct SlidingHold {
- alignas(16) float mValues[BUFFERSIZE];
- uint mExpiries[BUFFERSIZE];
+ alignas(16) float mValues[BufferLineSize];
+ uint mExpiries[BufferLineSize];
uint mLowerIndex;
uint mUpperIndex;
uint mLength;
@@ -42,10 +42,10 @@ using namespace std::placeholders;
*/
float UpdateSlidingHold(SlidingHold *Hold, const uint i, const float in)
{
- static constexpr uint mask{BUFFERSIZE - 1};
+ static constexpr uint mask{BufferLineSize - 1};
const uint length{Hold->mLength};
- float (&values)[BUFFERSIZE] = Hold->mValues;
- uint (&expiries)[BUFFERSIZE] = Hold->mExpiries;
+ float (&values)[BufferLineSize] = Hold->mValues;
+ uint (&expiries)[BufferLineSize] = Hold->mExpiries;
uint lowerIndex{Hold->mLowerIndex};
uint upperIndex{Hold->mUpperIndex};
@@ -318,9 +318,9 @@ std::unique_ptr<Compressor> Compressor::Create(const size_t NumChans, const floa
const float AttackTime, const float ReleaseTime)
{
const auto lookAhead = static_cast<uint>(
- clampf(std::round(LookAheadTime*SampleRate), 0.0f, BUFFERSIZE-1));
+ clampf(std::round(LookAheadTime*SampleRate), 0.0f, BufferLineSize-1));
const auto hold = static_cast<uint>(
- clampf(std::round(HoldTime*SampleRate), 0.0f, BUFFERSIZE-1));
+ clampf(std::round(HoldTime*SampleRate), 0.0f, BufferLineSize-1));
size_t size{sizeof(Compressor)};
if(lookAhead > 0)
@@ -426,7 +426,7 @@ void Compressor::process(const uint SamplesToDo, FloatBufferLine *OutBuffer)
if(mDelay)
SignalDelay(this, SamplesToDo, OutBuffer);
- const float (&sideChain)[BUFFERSIZE*2] = mSideChain;
+ const float (&sideChain)[BufferLineSize*2] = mSideChain;
auto apply_comp = [SamplesToDo,&sideChain](FloatBufferLine &input) noexcept -> void
{
float *buffer{al::assume_aligned<16>(input.data())};
diff --git a/alc/mastering.h b/alc/mastering.h
index 9503a37e..0a98fe1f 100644
--- a/alc/mastering.h
+++ b/alc/mastering.h
@@ -44,8 +44,8 @@ struct Compressor {
float mAttack{0.0f};
float mRelease{0.0f};
- alignas(16) float mSideChain[2*BUFFERSIZE]{};
- alignas(16) float mCrestFactor[BUFFERSIZE]{};
+ alignas(16) float mSideChain[2*BufferLineSize]{};
+ alignas(16) float mCrestFactor[BufferLineSize]{};
SlidingHold *mHold{nullptr};
FloatBufferLine *mDelay{nullptr};
diff --git a/alc/mixer/defs.h b/alc/mixer/defs.h
index e3de6444..f8bdf428 100644
--- a/alc/mixer/defs.h
+++ b/alc/mixer/defs.h
@@ -23,7 +23,7 @@ constexpr int MixerFracMask{MixerFracOne - 1};
* Note that the padding is symmetric (half at the beginning and half at the
* end)!
*/
-#define MAX_RESAMPLER_PADDING 48
+constexpr int MaxResamplerPadding{48};
template<typename TypeTag, typename InstTag>
diff --git a/alc/uhjfilter.h b/alc/uhjfilter.h
index e2ae7ef2..4984bcab 100644
--- a/alc/uhjfilter.h
+++ b/alc/uhjfilter.h
@@ -3,8 +3,8 @@
#include <array>
-#include "alcmain.h"
#include "almalloc.h"
+#include "core/bufferline.h"
struct Uhj2Encoder {
@@ -18,13 +18,13 @@ struct Uhj2Encoder {
alignas(16) std::array<float,sFilterSize> mMidDelay{};
alignas(16) std::array<float,sFilterSize> mSideDelay{};
- alignas(16) std::array<float,BUFFERSIZE+sFilterSize> mMid{};
- alignas(16) std::array<float,BUFFERSIZE+sFilterSize> mSide{};
+ alignas(16) std::array<float,BufferLineSize+sFilterSize> mMid{};
+ alignas(16) std::array<float,BufferLineSize+sFilterSize> mSide{};
/* History for the FIR filter. */
alignas(16) std::array<float,sFilterSize*2 - 1> mSideHistory{};
- alignas(16) std::array<float,BUFFERSIZE + sFilterSize*2> mTemp{};
+ alignas(16) std::array<float,BufferLineSize + sFilterSize*2> mTemp{};
/**
* Encodes a 2-channel UHJ (stereo-compatible) signal from a B-Format input
diff --git a/alc/voice.cpp b/alc/voice.cpp
index 174e8545..a1f49d6b 100644
--- a/alc/voice.cpp
+++ b/alc/voice.cpp
@@ -71,9 +71,9 @@ struct NEONTag;
struct CopyTag;
-static_assert((BUFFERSIZE-1)/MAX_PITCH > 0, "MAX_PITCH is too large for BUFFERSIZE!");
-static_assert((INT_MAX>>MixerFracBits)/MAX_PITCH > BUFFERSIZE,
- "MAX_PITCH and/or BUFFERSIZE are too large for MixerFracBits!");
+static_assert((BufferLineSize-1)/MAX_PITCH > 0, "MAX_PITCH is too large for BufferLineSize!");
+static_assert((INT_MAX>>MixerFracBits)/MAX_PITCH > BufferLineSize,
+ "MAX_PITCH and/or BufferLineSize are too large for MixerFracBits!");
Resampler ResamplerDefault{Resampler::Linear};
@@ -515,9 +515,9 @@ void Voice::mix(const State vstate, ALCcontext *Context, const uint SamplesToDo)
/* Calculate the last read src sample pos. */
DataSize64 = (DataSize64*increment + DataPosFrac) >> MixerFracBits;
/* +1 to get the src sample count, include padding. */
- DataSize64 += 1 + MAX_RESAMPLER_PADDING;
+ DataSize64 += 1 + MaxResamplerPadding;
- /* Result is guaranteed to be <= BUFFERSIZE+MAX_RESAMPLER_PADDING
+ /* Result is guaranteed to be <= BufferLineSize+MaxResamplerPadding
* since we won't use more src samples than dst samples+padding.
*/
SrcBufferSize = static_cast<uint>(DataSize64);
@@ -527,18 +527,18 @@ void Voice::mix(const State vstate, ALCcontext *Context, const uint SamplesToDo)
uint64_t DataSize64{DstBufferSize};
/* Calculate the end src sample pos, include padding. */
DataSize64 = (DataSize64*increment + DataPosFrac) >> MixerFracBits;
- DataSize64 += MAX_RESAMPLER_PADDING;
+ DataSize64 += MaxResamplerPadding;
- if(DataSize64 <= BUFFERSIZE + MAX_RESAMPLER_PADDING)
+ if(DataSize64 <= BufferLineSize + MaxResamplerPadding)
SrcBufferSize = static_cast<uint>(DataSize64);
else
{
/* If the source size got saturated, we can't fill the desired
* dst size. Figure out how many samples we can actually mix.
*/
- SrcBufferSize = BUFFERSIZE + MAX_RESAMPLER_PADDING;
+ SrcBufferSize = BufferLineSize + MaxResamplerPadding;
- DataSize64 = SrcBufferSize - MAX_RESAMPLER_PADDING;
+ DataSize64 = SrcBufferSize - MaxResamplerPadding;
DataSize64 = ((DataSize64<<MixerFracBits) - DataPosFrac) / increment;
if(DataSize64 < DstBufferSize)
{
@@ -555,7 +555,7 @@ void Voice::mix(const State vstate, ALCcontext *Context, const uint SamplesToDo)
BufferStorage *buffer{BufferListItem->mBuffer};
/* Exclude resampler pre-padding from the needed size. */
- const uint toLoad{SrcBufferSize - (MAX_RESAMPLER_PADDING>>1)};
+ const uint toLoad{SrcBufferSize - (MaxResamplerPadding>>1)};
if(toLoad > mNumCallbackSamples)
{
const size_t byteOffset{mNumCallbackSamples*FrameSize};
@@ -587,11 +587,11 @@ void Voice::mix(const State vstate, ALCcontext *Context, const uint SamplesToDo)
/* Load the previous samples into the source data first, then load
* what we can from the buffer queue.
*/
- auto srciter = std::copy_n(chandata.mPrevSamples.begin(), MAX_RESAMPLER_PADDING>>1,
+ auto srciter = std::copy_n(chandata.mPrevSamples.begin(), MaxResamplerPadding>>1,
SrcData.begin());
if UNLIKELY(!BufferListItem)
- srciter = std::copy(chandata.mPrevSamples.begin()+(MAX_RESAMPLER_PADDING>>1),
+ srciter = std::copy(chandata.mPrevSamples.begin()+(MaxResamplerPadding>>1),
chandata.mPrevSamples.end(), srciter);
else if((mFlags&VoiceIsStatic))
srciter = LoadBufferStatic(BufferListItem, BufferLoopItem, num_chans,
@@ -620,7 +620,7 @@ void Voice::mix(const State vstate, ALCcontext *Context, const uint SamplesToDo)
/* Resample, then apply ambisonic upsampling as needed. */
const float *ResampledData{Resample(&mResampleState,
- &SrcData[MAX_RESAMPLER_PADDING>>1], DataPosFrac, increment,
+ &SrcData[MaxResamplerPadding>>1], DataPosFrac, increment,
{Device->ResampledData, DstBufferSize})};
if((mFlags&VoiceIsAmbisonic))
{
@@ -636,7 +636,7 @@ void Voice::mix(const State vstate, ALCcontext *Context, const uint SamplesToDo)
}
/* Now filter and mix to the appropriate outputs. */
- float (&FilterBuf)[BUFFERSIZE] = Device->FilteredData;
+ float (&FilterBuf)[BufferLineSize] = Device->FilteredData;
{
DirectParams &parms = chandata.mDryParams;
const float *samples{DoFilters(parms.LowPass, parms.HighPass, FilterBuf,
diff --git a/alc/voice.h b/alc/voice.h
index 3f1642f1..bb3d5e02 100644
--- a/alc/voice.h
+++ b/alc/voice.h
@@ -242,7 +242,7 @@ struct Voice {
std::array<TargetData,MAX_SENDS> mSend;
struct ChannelData {
- alignas(16) std::array<float,MAX_RESAMPLER_PADDING> mPrevSamples;
+ alignas(16) std::array<float,MaxResamplerPadding> mPrevSamples;
float mAmbiScale;
BandSplitter mAmbiSplitter;
diff --git a/core/bufferline.h b/core/bufferline.h
index 07983140..503e208d 100644
--- a/core/bufferline.h
+++ b/core/bufferline.h
@@ -7,8 +7,8 @@
* more memory and are harder on cache, while smaller values may need more
* iterations for mixing.
*/
-#define BUFFERSIZE 1024
+constexpr int BufferLineSize{1024};
-using FloatBufferLine = std::array<float,BUFFERSIZE>;
+using FloatBufferLine = std::array<float,BufferLineSize>;
#endif /* CORE_BUFFERLINE_H */