From ec42102685b2fb9a806b02ea12672078cf4a961c Mon Sep 17 00:00:00 2001 From: twinaphex Date: Wed, 16 Sep 2020 20:44:54 +0200 Subject: [PATCH] OKIADPCMEncoder --- mednafen/okiadpcm.h | 50 --------------------------------------------- 1 file changed, 50 deletions(-) diff --git a/mednafen/okiadpcm.h b/mednafen/okiadpcm.h index b02969f..8904834 100644 --- a/mednafen/okiadpcm.h +++ b/mednafen/okiadpcm.h @@ -108,54 +108,4 @@ class OKIADPCM_Decoder int32 CurSample; int32 StepSizeIndex; }; - -template -class OKIADPCM_Encoder -{ - public: - - OKIADPCM_Encoder() - { - Accum = 0x800; - StepSizeIndex = 0; - } - - ~OKIADPCM_Encoder() - { - - } - - uint8 EncodeSample(uint16 in_sample) - { - uint8 nibble = 0; - int32 sample_delta = in_sample - Accum; - int piece; - - piece = (abs(sample_delta) * 4 / OKIADPCM_StepSizes[StepSizeIndex]); - if(piece > 0x7) - piece = 0x7; - - nibble = ((uint32)(sample_delta >> 31) & 0x8) | piece; - - // Update Accum and StepSizeIndex! - Accum += OKIADPCM_DeltaTable[StepSizeIndex][nibble]; - StepSizeIndex += OKIADPCM_StepIndexDeltas[nibble]; - - if(Accum > 0xFFF) Accum = 0xFFF; - if(Accum < 0) Accum = 0; - - if(StepSizeIndex < 0) - StepSizeIndex = 0; - - if(StepSizeIndex > 48) - StepSizeIndex = 48; - - return(nibble); - } - - private: - int32 Accum; - int32 StepSizeIndex; - OKIADPCM_Chip ChipType; -}; #endif