aboutsummaryrefslogtreecommitdiffstats
path: root/al/buffer.cpp
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2022-03-30 15:52:15 -0700
committerChris Robinson <[email protected]>2022-03-30 15:52:15 -0700
commitabfb584f1493b6295093a73235f1cea77ec15575 (patch)
treeadde2334e6af5880b5fdc8ee74769cd1b7b54dc5 /al/buffer.cpp
parent4999b5716cfbe95f3e8ed5e9dc3014c3ec8652c8 (diff)
Simplify al::byte
It's just an alias for unsigned char now, and no longer strongly-typed like std::byte.
Diffstat (limited to 'al/buffer.cpp')
-rw-r--r--al/buffer.cpp22
1 files changed, 10 insertions, 12 deletions
diff --git a/al/buffer.cpp b/al/buffer.cpp
index 6436ea3c..7aa8edfd 100644
--- a/al/buffer.cpp
+++ b/al/buffer.cpp
@@ -118,10 +118,10 @@ void DecodeIMA4Block(int16_t *dst, const al::byte *src, size_t numchans, size_t
for(size_t c{0};c < numchans;c++)
{
- sample[c] = al::to_integer<int>(src[0]) | (al::to_integer<int>(src[1])<<8);
+ sample[c] = src[0] | (src[1]<<8);
sample[c] = (sample[c]^0x8000) - 32768;
src += 2;
- index[c] = al::to_integer<int>(src[0]) | (al::to_integer<int>(src[1])<<8);
+ index[c] = src[0] | (src[1]<<8);
index[c] = clampi((index[c]^0x8000) - 32768, 0, 88);
src += 2;
@@ -134,8 +134,8 @@ void DecodeIMA4Block(int16_t *dst, const al::byte *src, size_t numchans, size_t
{
for(size_t c{0};c < numchans;c++)
{
- code[c] = al::to_integer<ALuint>(src[0]) | (al::to_integer<ALuint>(src[1])<< 8) |
- (al::to_integer<ALuint>(src[2])<<16) | (al::to_integer<ALuint>(src[3])<<24);
+ code[c] = ALuint{src[0]} | (ALuint{src[1]}<< 8) | (ALuint{src[2]}<<16)
+ | (ALuint{src[3]}<<24);
src += 4;
}
}
@@ -164,25 +164,23 @@ void DecodeMSADPCMBlock(int16_t *dst, const al::byte *src, size_t numchans, size
for(size_t c{0};c < numchans;c++)
{
- blockpred[c] = std::min<ALubyte>(al::to_integer<ALubyte>(src[0]), 6);
+ blockpred[c] = std::min<ALubyte>(src[0], 6);
++src;
}
for(size_t c{0};c < numchans;c++)
{
- delta[c] = al::to_integer<int>(src[0]) | (al::to_integer<int>(src[1])<<8);
+ delta[c] = src[0] | (src[1]<<8);
delta[c] = (delta[c]^0x8000) - 32768;
src += 2;
}
for(size_t c{0};c < numchans;c++)
{
- samples[c][0] = static_cast<ALshort>(al::to_integer<int>(src[0]) |
- (al::to_integer<int>(src[1])<<8));
+ samples[c][0] = static_cast<ALshort>(src[0] | (src[1]<<8));
src += 2;
}
for(size_t c{0};c < numchans;c++)
{
- samples[c][1] = static_cast<ALshort>(al::to_integer<int>(src[0]) |
- (al::to_integer<int>(src[1])<<8));
+ samples[c][1] = static_cast<ALshort>(src[0] | (src[1]<<8));
src += 2;
}
@@ -206,13 +204,13 @@ void DecodeMSADPCMBlock(int16_t *dst, const al::byte *src, size_t numchans, size
int pred{(samples[c][0]*MSADPCMAdaptionCoeff[blockpred[c]][0] +
samples[c][1]*MSADPCMAdaptionCoeff[blockpred[c]][1]) / 256};
- pred += (al::to_integer<int>(nibble^0x08) - 0x08) * delta[c];
+ pred += ((nibble^0x08) - 0x08) * delta[c];
pred = clampi(pred, -32768, 32767);
samples[c][1] = samples[c][0];
samples[c][0] = static_cast<int16_t>(pred);
- delta[c] = (MSADPCMAdaption[al::to_integer<ALubyte>(nibble)] * delta[c]) / 256;
+ delta[c] = (MSADPCMAdaption[nibble] * delta[c]) / 256;
delta[c] = maxi(16, delta[c]);
*(dst++) = static_cast<int16_t>(pred);