GB Audio: Fix envelopes not updating in certain cases
Jeffrey Pfau jeffrey@endrift.com
Sun, 21 Feb 2016 11:00:50 -0800
1 files changed,
6 insertions(+),
0 deletions(-)
jump to
M
src/gb/audio.c
→
src/gb/audio.c
@@ -149,6 +149,8 @@ audio->playingCh1 = audio->ch1.envelope.initialVolume || audio->ch1.envelope.direction;
audio->ch1.envelope.currentVolume = audio->ch1.envelope.initialVolume; if (audio->ch1.envelope.currentVolume > 0) { audio->ch1.envelope.dead = audio->ch1.envelope.stepTime ? 0 : 1; + } else { + audio->ch1.envelope.dead = audio->ch1.envelope.stepTime ? 0 : 2; } audio->ch1.realFrequency = audio->ch1.control.frequency; audio->ch1.sweepStep = audio->ch1.time;@@ -202,6 +204,8 @@ audio->playingCh2 = audio->ch2.envelope.initialVolume || audio->ch2.envelope.direction;
audio->ch2.envelope.currentVolume = audio->ch2.envelope.initialVolume; if (audio->ch2.envelope.currentVolume > 0) { audio->ch2.envelope.dead = audio->ch2.envelope.stepTime ? 0 : 1; + } else { + audio->ch2.envelope.dead = audio->ch2.envelope.stepTime ? 0 : 2; } if (audio->nextEvent == INT_MAX) { audio->eventDiff = 0;@@ -320,6 +324,8 @@ audio->playingCh4 = audio->ch4.envelope.initialVolume || audio->ch4.envelope.direction;
audio->ch4.envelope.currentVolume = audio->ch4.envelope.initialVolume; if (audio->ch4.envelope.currentVolume > 0) { audio->ch4.envelope.dead = audio->ch4.envelope.stepTime ? 0 : 1; + } else { + audio->ch4.envelope.dead = audio->ch4.envelope.stepTime ? 0 : 2; } if (audio->ch4.power) { audio->ch4.lfsr = 0x40;