diff options
author | Chris Robinson <[email protected]> | 2020-03-28 16:29:57 -0700 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2020-03-28 18:15:05 -0700 |
commit | fb076125454efb92fb8c9684dadf0f338d70aa32 (patch) | |
tree | 8900bb245a5c1de6271d34578e7526c2b12b92fc | |
parent | f1f9a1417206e6097005c6088b65d56cb4e15429 (diff) |
Get rid of MAX_INPUT_CHANNELS
-rw-r--r-- | al/buffer.cpp | 16 | ||||
-rw-r--r-- | al/buffer.h | 2 |
2 files changed, 10 insertions, 8 deletions
diff --git a/al/buffer.cpp b/al/buffer.cpp index 96c6b4fc..4f4934e5 100644 --- a/al/buffer.cpp +++ b/al/buffer.cpp @@ -55,6 +55,8 @@ namespace { +constexpr int MaxAdpcmChannels{2}; + /* IMA ADPCM Stepsize table */ constexpr int IMAStep_size[89] = { 7, 8, 9, 10, 11, 12, 13, 14, 16, 17, 19, @@ -101,9 +103,9 @@ constexpr int MSADPCMAdaptionCoeff[7][2] = { void DecodeIMA4Block(ALshort *dst, const al::byte *src, size_t numchans, size_t align) { - ALint sample[MAX_INPUT_CHANNELS]{}; - ALint index[MAX_INPUT_CHANNELS]{}; - ALuint code[MAX_INPUT_CHANNELS]{}; + ALint sample[MaxAdpcmChannels]{}; + ALint index[MaxAdpcmChannels]{}; + ALuint code[MaxAdpcmChannels]{}; for(size_t c{0};c < numchans;c++) { @@ -147,9 +149,9 @@ void DecodeIMA4Block(ALshort *dst, const al::byte *src, size_t numchans, size_t void DecodeMSADPCMBlock(ALshort *dst, const al::byte *src, size_t numchans, size_t align) { - ALubyte blockpred[MAX_INPUT_CHANNELS]{}; - ALint delta[MAX_INPUT_CHANNELS]{}; - ALshort samples[MAX_INPUT_CHANNELS][2]{}; + ALubyte blockpred[MaxAdpcmChannels]{}; + ALint delta[MaxAdpcmChannels]{}; + ALshort samples[MaxAdpcmChannels][2]{}; for(size_t c{0};c < numchans;c++) { @@ -212,6 +214,7 @@ void DecodeMSADPCMBlock(ALshort *dst, const al::byte *src, size_t numchans, size void Convert_ALshort_ALima4(ALshort *dst, const al::byte *src, size_t numchans, size_t len, size_t align) { + assert(numchans <= MaxAdpcmChannels); const size_t byte_align{((align-1)/2 + 4) * numchans}; len /= align; @@ -226,6 +229,7 @@ void Convert_ALshort_ALima4(ALshort *dst, const al::byte *src, size_t numchans, void Convert_ALshort_ALmsadpcm(ALshort *dst, const al::byte *src, size_t numchans, size_t len, size_t align) { + assert(numchans <= MaxAdpcmChannels); const size_t byte_align{((align-2)/2 + 7) * numchans}; len /= align; diff --git a/al/buffer.h b/al/buffer.h index 15546ac9..b2774860 100644 --- a/al/buffer.h +++ b/al/buffer.h @@ -56,8 +56,6 @@ enum FmtChannels : unsigned char { FmtBFormat2D = UserFmtBFormat2D, FmtBFormat3D = UserFmtBFormat3D, }; -#define MAX_INPUT_CHANNELS (8) - ALuint BytesFromFmt(FmtType type) noexcept; ALuint ChannelsFromFmt(FmtChannels chans) noexcept; |