Fixed an edge case with DAC discharge emulation

This commit is contained in:
Lior Halphon 2018-07-16 23:08:25 +03:00
parent 2e9e3424ec
commit c66b6fbafc
1 changed files with 5 additions and 1 deletions

View File

@ -28,7 +28,6 @@ static void update_sample(GB_gameboy_t *gb, unsigned index, int8_t value, unsign
}
else {
gb->apu.samples[index] = value;
gb->apu_output.dac_discharge[index] = 1.0;
}
if (gb->apu_output.sample_rate) {
@ -887,6 +886,11 @@ void GB_apu_write(GB_gameboy_t *gb, uint8_t reg, uint8_t value)
}
}
gb->io_registers[reg] = value;
for (unsigned i = 0; i < GB_N_CHANNELS; i++) {
if (gb->apu.is_active[i]) {
gb->apu_output.dac_discharge[i] = 1.0;
}
}
}
size_t GB_apu_get_current_buffer_length(GB_gameboy_t *gb)