Fixed minor APU regression (Channels 1 and 2 were given no delay under certain circumstances)

This commit is contained in:
Lior Halphon 2018-09-09 12:50:55 +03:00
parent 57cc4809ba
commit 3151821e6d

View File

@ -644,7 +644,7 @@ void GB_apu_write(GB_gameboy_t *gb, uint8_t reg, uint8_t value)
if ((gb->io_registers[index == GB_SQUARE_1 ? GB_IO_NR12 : GB_IO_NR22] & 0xF8) != 0 && !gb->apu.is_active[index]) { if ((gb->io_registers[index == GB_SQUARE_1 ? GB_IO_NR12 : GB_IO_NR22] & 0xF8) != 0 && !gb->apu.is_active[index]) {
gb->apu.is_active[index] = true; gb->apu.is_active[index] = true;
update_square_sample(gb, index); update_sample(gb, index, 0, 0);
} }
if (gb->apu.square_channels[index].pulse_length == 0) { if (gb->apu.square_channels[index].pulse_length == 0) {
gb->apu.square_channels[index].pulse_length = 0x40; gb->apu.square_channels[index].pulse_length = 0x40;