Commits

spencercw committed b67e197

Fix duration of channel 2 and 4 playback where configured.

Comments (0)

Files changed (1)

gb_emulator/src/gb_sound.cpp

 			// Save the playback duration
 			if (gb_.mem_.ioPorts[NR24] & 0x40)
 			{
-				duration2_ = (64 - gb_.mem_.ioPorts[NR21]) * (1. / 256) * sampleRate_;
+				duration2_ = (64 - (gb_.mem_.ioPorts[NR21] & 0x3f)) * (1. / 256) * sampleRate_;
 			}
 			else
 			{
 			// Save the playback duration
 			if (gb_.mem_.ioPorts[NR44] & 0x40)
 			{
-				duration4_ = (64 - gb_.mem_.ioPorts[NR41]) * (1. / 256) * sampleRate_;
+				duration4_ = (64 - (gb_.mem_.ioPorts[NR41] & 0x3f)) * (1. / 256) * sampleRate_;
 			}
 			else
 			{