--- a/libsidplay/src/xsid/xsid.cpp +++ b/libsidplay/src/xsid/xsid.cpp @@ -94,10 +94,15 @@ const int8_t XSID::sampleConvertTable[16 '\x08', '\x19', '\x2a', '\x3b', '\x4c', '\x5d', '\x6e', '\x7f' }; */ -const int8_t XSID::sampleConvertTable[16] = +const uint8_t XSID::sampleConvertTable[16] = { +#if 0 '\x80', '\x94', '\xa9', '\xbc', '\xce', '\xe1', '\xf2', '\x03', '\x1b', '\x2a', '\x3b', '\x49', '\x58', '\x66', '\x73', '\x7f' +#else + 0x80, 0x94, 0xa9, 0xbc, 0xce, 0xe1, 0xf2, 0x03, + 0x1b, 0x2a, 0x3b, 0x49, 0x58, 0x66, 0x73, 0x7f +#endif }; const char *XSID::credit = @@ -141,7 +146,7 @@ void channel::free () silence (); } -inline int8_t channel::output () +inline uint8_t channel::output () { outputs++; return sample; @@ -346,7 +351,7 @@ void channel::galwayInit() outputs = 0; sampleLimit = 8; - sample = (int8_t) galVolume - 8; + sample = galVolume - 8; galwayTonePeriod (); // Calculate the sample offset @@ -387,7 +392,7 @@ void channel::galwayClock () // See Galway Example... galVolume += volShift; galVolume &= 0x0f; - sample = (int8_t) galVolume - 8; + sample = galVolume - 8; cycles += cycleCount; m_context.schedule (&galwayEvent, cycleCount, m_phase); m_context.schedule (&m_xsid, 0, m_phase); @@ -515,9 +520,9 @@ void XSID::write (uint_least16_t addr, u } } -int8_t XSID::sampleOutput (void) +uint8_t XSID::sampleOutput (void) { - int8_t sample; + uint8_t sample; sample = ch4.output (); sample += ch5.output (); // Automatically compensated for by C64 code --- a/libsidplay/src/xsid/xsid.h +++ b/libsidplay/src/xsid/xsid.h @@ -166,7 +166,7 @@ private: uint_least16_t cycleCount; // Counts to zero and triggers! uint_least8_t volShift; uint_least8_t sampleLimit; - int8_t sample; + uint8_t sample; // Sample Section uint_least8_t samRepeat; @@ -201,14 +201,14 @@ private: // Compress address to not leave so many spaces uint_least8_t convertAddr(uint_least8_t addr) - { return (((addr) & 0x3) | ((addr) >> 3) & 0x0c); } + { return (((addr) & 0x3) | (((addr) >> 3) & 0x0c)); } void reset (void); uint8_t read (uint_least8_t addr) { return reg[convertAddr (addr)]; } void write (uint_least8_t addr, uint8_t data) { reg[convertAddr (addr)] = data; } - int8_t output (void); + uint8_t output (void); bool isGalway (void) { return mode == FM_GALWAY; } @@ -238,7 +238,7 @@ private: uint8_t sidData0x18; bool _sidSamples; int8_t sampleOffset; - static const int8_t sampleConvertTable[16]; + static const uint8_t sampleConvertTable[16]; bool wasRunning; private: @@ -246,7 +246,7 @@ private: void checkForInit (channel *ch); inline void setSidData0x18 (void); inline void recallSidData0x18 (void); - int8_t sampleOutput (void); + uint8_t sampleOutput (void); void sampleOffsetCalc (void); virtual uint8_t readMemByte (uint_least16_t addr) = 0; virtual void writeMemByte (uint8_t data) = 0;