aboutsummaryrefslogtreecommitdiff
path: root/source/soundux.c
diff options
context:
space:
mode:
Diffstat (limited to 'source/soundux.c')
-rw-r--r--source/soundux.c269
1 files changed, 0 insertions, 269 deletions
diff --git a/source/soundux.c b/source/soundux.c
index 1ddbd48..d991c04 100644
--- a/source/soundux.c
+++ b/source/soundux.c
@@ -494,267 +494,6 @@ void S9xSetSoundType(int channel, int type_of_sound)
SoundData.channels[channel].type = type_of_sound;
}
-void AltDecodeBlock(Channel* ch)
-{
- if (ch->block_pointer >= 0x10000 - 9)
- {
- ch->last_block = TRUE;
- ch->loop = FALSE;
- ch->block = ch->decoded;
- memset((void*) ch->decoded, 0, sizeof(int16) * 16);
- return;
- }
- signed char* compressed = (signed char*) &IAPU.RAM [ch->block_pointer];
-
- unsigned char filter = *compressed;
- if ((ch->last_block = filter & 1))
- ch->loop = (filter & 2) != 0;
-
-#if !defined(ANDROID) && (defined (USE_X86_ASM) && (defined (__i386__) || defined (__i486__) ||\
- defined (__i586__) || defined (__WIN32__) || defined (__DJGPP)))
- int16* raw = ch->block = ch->decoded;
-
- if (Settings.AltSampleDecode == 1)
- DecodeBlockAsm(compressed, raw, &ch->previous [0], &ch->previous [1]);
- else
- DecodeBlockAsm2(compressed, raw, &ch->previous [0], &ch->previous [1]);
-#else
- int32 out;
- unsigned char shift;
- signed char sample1, sample2;
- unsigned int i;
-
- compressed++;
- signed short* raw = ch->block = ch->decoded;
-
- int32 prev0 = ch->previous [0];
- int32 prev1 = ch->previous [1];
- shift = filter >> 4;
-
- switch ((filter >> 2) & 3)
- {
- case 0:
- for (i = 8; i != 0; i--)
- {
- sample1 = *compressed++;
- sample2 = sample1 << 4;
- sample2 >>= 4;
- sample1 >>= 4;
- *raw++ = ((int32) sample1 << shift);
- *raw++ = ((int32) sample2 << shift);
- }
- prev1 = *(raw - 2);
- prev0 = *(raw - 1);
- break;
- case 1:
- for (i = 8; i != 0; i--)
- {
- sample1 = *compressed++;
- sample2 = sample1 << 4;
- sample2 >>= 4;
- sample1 >>= 4;
- prev0 = (int16) prev0;
- *raw++ = prev1 = ((int32) sample1 << shift) + prev0 - (prev0 >> 4);
- prev1 = (int16) prev1;
- *raw++ = prev0 = ((int32) sample2 << shift) + prev1 - (prev1 >> 4);
- }
- break;
- case 2:
- for (i = 8; i != 0; i--)
- {
- sample1 = *compressed++;
- sample2 = sample1 << 4;
- sample2 >>= 4;
- sample1 >>= 4;
-
- out = (sample1 << shift) - prev1 + (prev1 >> 4);
- prev1 = (int16) prev0;
- prev0 &= ~3;
- *raw++ = prev0 = out + (prev0 << 1) - (prev0 >> 5) -
- (prev0 >> 4);
-
- out = (sample2 << shift) - prev1 + (prev1 >> 4);
- prev1 = (int16) prev0;
- prev0 &= ~3;
- *raw++ = prev0 = out + (prev0 << 1) - (prev0 >> 5) -
- (prev0 >> 4);
- }
- break;
- case 3:
- for (i = 8; i != 0; i--)
- {
- sample1 = *compressed++;
- sample2 = sample1 << 4;
- sample2 >>= 4;
- sample1 >>= 4;
- out = (sample1 << shift);
-
- out = out - prev1 + (prev1 >> 3) + (prev1 >> 4);
- prev1 = (int16) prev0;
- prev0 &= ~3;
- *raw++ = prev0 = out + (prev0 << 1) - (prev0 >> 3) -
- (prev0 >> 4) - (prev1 >> 6);
-
- out = (sample2 << shift);
- out = out - prev1 + (prev1 >> 3) + (prev1 >> 4);
- prev1 = (int16) prev0;
- prev0 &= ~3;
- *raw++ = prev0 = out + (prev0 << 1) - (prev0 >> 3) -
- (prev0 >> 4) - (prev1 >> 6);
- }
- break;
- }
- ch->previous [0] = prev0;
- ch->previous [1] = prev1;
-#endif
-
- ch->block_pointer += 9;
-}
-
-void AltDecodeBlock2(Channel* ch)
-{
- int32 out;
- unsigned char filter;
- unsigned char shift;
- signed char sample1, sample2;
- unsigned char i;
-
- if (ch->block_pointer > 0x10000 - 9)
- {
- ch->last_block = TRUE;
- ch->loop = FALSE;
- ch->block = ch->decoded;
- memset((void*) ch->decoded, 0, sizeof(int16) * 16);
- return;
- }
-
- signed char* compressed = (signed char*) &IAPU.RAM [ch->block_pointer];
-
- filter = *compressed;
- if ((ch->last_block = filter & 1))
- ch->loop = (filter & 2) != 0;
-
- compressed++;
- signed short* raw = ch->block = ch->decoded;
-
- shift = filter >> 4;
- int32 prev0 = ch->previous [0];
- int32 prev1 = ch->previous [1];
-
- if (shift > 12)
- shift -= 4;
-
- switch ((filter >> 2) & 3)
- {
- case 0:
- for (i = 8; i != 0; i--)
- {
- sample1 = *compressed++;
- sample2 = sample1 << 4;
- //Sample 2 = Bottom Nibble, Sign Extended.
- sample2 >>= 4;
- //Sample 1 = Top Nibble, shifted down and Sign Extended.
- sample1 >>= 4;
-
- out = (int32)(sample1 << shift);
-
- prev1 = prev0;
- prev0 = out;
- CLIP16(out);
- *raw++ = (int16)out;
-
- out = (int32)(sample2 << shift);
-
- prev1 = prev0;
- prev0 = out;
- CLIP16(out);
- *raw++ = (int16)out;
- }
- break;
- case 1:
- for (i = 8; i != 0; i--)
- {
- sample1 = *compressed++;
- sample2 = sample1 << 4;
- //Sample 2 = Bottom Nibble, Sign Extended.
- sample2 >>= 4;
- //Sample 1 = Top Nibble, shifted down and Sign Extended.
- sample1 >>= 4;
- out = (int32)(sample1 << shift);
- out += (int32)((double)prev0 * 15 / 16);
-
- prev1 = prev0;
- prev0 = out;
- CLIP16(out);
- *raw++ = (int16)out;
-
- out = (int32)(sample2 << shift);
- out += (int32)((double)prev0 * 15 / 16);
-
- prev1 = prev0;
- prev0 = out;
- CLIP16(out);
- *raw++ = (int16)out;
- }
- break;
- case 2:
- for (i = 8; i != 0; i--)
- {
- sample1 = *compressed++;
- sample2 = sample1 << 4;
- //Sample 2 = Bottom Nibble, Sign Extended.
- sample2 >>= 4;
- //Sample 1 = Top Nibble, shifted down and Sign Extended.
- sample1 >>= 4;
-
- out = ((sample1 << shift) * 256 + (prev0 & ~0x2) * 488 - prev1 * 240) >> 8;
-
- prev1 = prev0;
- prev0 = (int16)out;
- *raw++ = (int16)out;
-
- out = ((sample2 << shift) * 256 + (prev0 & ~0x2) * 488 - prev1 * 240) >> 8;
-
- prev1 = prev0;
- prev0 = (int16)out;
- *raw++ = (int16)out;
- }
- break;
-
- case 3:
- for (i = 8; i != 0; i--)
- {
- sample1 = *compressed++;
- sample2 = sample1 << 4;
- //Sample 2 = Bottom Nibble, Sign Extended.
- sample2 >>= 4;
- //Sample 1 = Top Nibble, shifted down and Sign Extended.
- sample1 >>= 4;
- out = (int32)(sample1 << shift);
- out += (int32)((double)prev0 * 115 / 64 - (double)prev1 * 13 / 16);
-
- prev1 = prev0;
- prev0 = out;
-
- CLIP16(out);
- *raw++ = (int16)out;
-
- out = (int32)(sample2 << shift);
- out += (int32)((double)prev0 * 115 / 64 - (double)prev1 * 13 / 16);
-
- prev1 = prev0;
- prev0 = out;
-
- CLIP16(out);
- *raw++ = (int16)out;
- }
- break;
- }
- ch->previous [0] = prev0;
- ch->previous [1] = prev1;
- ch->block_pointer += 9;
-}
-
void DecodeBlock(Channel* ch)
{
int32 out;
@@ -764,14 +503,6 @@ void DecodeBlock(Channel* ch)
unsigned char i;
bool invalid_header;
- if (Settings.AltSampleDecode)
- {
- if (Settings.AltSampleDecode < 3)
- AltDecodeBlock(ch);
- else
- AltDecodeBlock2(ch);
- return;
- }
if (ch->block_pointer > 0x10000 - 9)
{
ch->last_block = TRUE;