diff options
author | João Silva | 2017-01-25 00:48:13 +0000 |
---|---|---|
committer | João Silva | 2017-01-25 00:48:13 +0000 |
commit | 961e34cd4b74e8f90dbb61c38e69caed6a2cbbd6 (patch) | |
tree | 7db5b7ffc885e3b9bad46a20a2224073d00f4b9c | |
parent | d8b66ac6d0524b3538ad595825651b28329f9033 (diff) | |
download | snesemu-961e34cd4b74e8f90dbb61c38e69caed6a2cbbd6.tar.gz snesemu-961e34cd4b74e8f90dbb61c38e69caed6a2cbbd6.tar.bz2 snesemu-961e34cd4b74e8f90dbb61c38e69caed6a2cbbd6.zip |
Fix for envelope rate calculation.
-rw-r--r-- | source/apu.c | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/source/apu.c b/source/apu.c index efbd4b5..1ac4c06 100644 --- a/source/apu.c +++ b/source/apu.c @@ -9,8 +9,6 @@ #include "cpuexec.h" extern int32_t NoiseFreq [32]; -extern uint16_t DecreaseRateExp [32]; -extern uint16_t IncreaseRate [32]; bool S9xInitAPU() { @@ -353,17 +351,17 @@ void S9xFixEnvelope(int channel, uint8_t gain, uint8_t adsr1, uint8_t adsr2) if(S9xSetSoundMode(channel, (gain & 0x20) ? MODE_INCREASE_BENT_LINE : MODE_INCREASE_LINEAR)) - S9xSetEnvelopeRate(channel, IncreaseRate [gain & 0x1f], 1, 127, (3 << 28) | gain); + S9xSetEnvelopeRate(channel, gain, 1, 127, (3 << 28) | gain); } else if (gain & 0x20) { if(S9xSetSoundMode(channel, MODE_DECREASE_EXPONENTIAL)) - S9xSetEnvelopeRate(channel, DecreaseRateExp [gain & 0x1f] / 2, -1, 0, (4 << 28) | gain); + S9xSetEnvelopeRate(channel, gain, -1, 0, (4 << 28) | gain); } else { if (S9xSetSoundMode(channel, MODE_DECREASE_LINEAR)) - S9xSetEnvelopeRate(channel, IncreaseRate [gain & 0x1f], -1, 0, (3 << 28) | gain); + S9xSetEnvelopeRate(channel, gain, -1, 0, (3 << 28) | gain); } } |