Get rid of MAX_INPUT_CHANNELS

This commit is contained in:
Chris Robinson
2020-03-28 16:29:57 -07:00
parent f1f9a14172
commit fb07612545
2 changed files with 10 additions and 8 deletions
+10 -6
View File
@@ -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;
-2
View File
@@ -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;