aboutsummaryrefslogtreecommitdiff
path: root/source/apu.c
diff options
context:
space:
mode:
authormeepingsnesroms2017-01-24 18:03:21 -0800
committerGitHub2017-01-24 18:03:21 -0800
commit73b5963bf2e7a8c65bbad150f52e5e626486311f (patch)
tree78a17f484ebec91ed3cf8c3dcf388b91760c5637 /source/apu.c
parent69f17114a277884d1b76f3be458f882b67e39265 (diff)
parent961e34cd4b74e8f90dbb61c38e69caed6a2cbbd6 (diff)
downloadsnes9x2005-73b5963bf2e7a8c65bbad150f52e5e626486311f.tar.gz
snes9x2005-73b5963bf2e7a8c65bbad150f52e5e626486311f.tar.bz2
snes9x2005-73b5963bf2e7a8c65bbad150f52e5e626486311f.zip
Merge pull request #28 from jamsilva/master
Fix for envelope rate calculation.
Diffstat (limited to 'source/apu.c')
-rw-r--r--source/apu.c8
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);
}
}