fix broken volume on/off event notification

git-svn-id: https://gambatte.svn.sourceforge.net/svnroot/gambatte@106 9dfb2916-2d38-0410-aef4-c5fe6c9ffc24
This commit is contained in:
sinamas 2007-11-18 13:10:36 +00:00
parent a2c291b48f
commit 9ee4396f64

View File

@ -26,14 +26,17 @@ void EnvelopeUnit::event() {
if (period) {
unsigned newVol = volume;
if (nr2 & 8) {
if (++newVol == 1)
volOnOffEvent(counter);
} else if (--newVol == 0)
volOnOffEvent(counter);
if (nr2 & 8)
++newVol;
else
--newVol;
if (newVol < 0x10U) {
volume = newVol;
if (volume < 2)
volOnOffEvent(counter);
counter += period << 15;
} else
counter = COUNTER_DISABLED;