summaryrefslogtreecommitdiff
path: root/src/m4a.c
diff options
context:
space:
mode:
authorGriffinR <griffin.g.richards@gmail.com>2021-10-07 16:10:35 -0400
committerGitHub <noreply@github.com>2021-10-07 16:10:35 -0400
commita2655ba9ab82646a54f60abc6078df372179f8d4 (patch)
tree95b074a1a4d77d6cd77e413e1d6e72eb55b595b0 /src/m4a.c
parente86d3410a1719fcbf62754bfda93a295aa7e0d57 (diff)
parent001a25e49cd6acdac89a62f4230aef80422e78f2 (diff)
Merge branch 'master' into doc-union
Diffstat (limited to 'src/m4a.c')
-rw-r--r--src/m4a.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/m4a.c b/src/m4a.c
index 105312a40..b159e3873 100644
--- a/src/m4a.c
+++ b/src/m4a.c
@@ -906,7 +906,6 @@ void CgbSound(void)
{
s32 ch;
struct CgbChannel *channels;
- s32 envelopeStepTimeAndDir;
s32 prevC15;
struct SoundInfo *soundInfo = SOUND_INFO_PTR;
vu8 *nrx0ptr;
@@ -914,6 +913,7 @@ void CgbSound(void)
vu8 *nrx2ptr;
vu8 *nrx3ptr;
vu8 *nrx4ptr;
+ s32 envelopeStepTimeAndDir;
// Most comparision operations that cast to s8 perform 'and' by 0xFF.
int mask = 0xff;
@@ -1198,8 +1198,8 @@ void CgbSound(void)
}
else
{
- envelopeStepTimeAndDir &= 0xf;
- *nrx2ptr = (channels->envelopeVolume << 4) + envelopeStepTimeAndDir;
+ u32 envMask = 0xF;
+ *nrx2ptr = (envelopeStepTimeAndDir & envMask) + (channels->envelopeVolume << 4);
*nrx4ptr = channels->n4 | 0x80;
if (ch == 1 && !(*nrx0ptr & 0x08))
*nrx4ptr = channels->n4 | 0x80;