git.y1.nz

SameBoy

Accurate GB/GBC emulator
download: https://git.y1.nz/archives/sameboy.tar.gz
README | Files | Log | Refs | LICENSE

commit 9ff3bffddda9ad311b93aae1e4e0c7bd47903d9d
parent 12859683b7ebe49f2f37fd4a747cd226726fb91b
Author: Lior Halphon <LIJI32@gmail.com>
Date:   Sat, 30 Nov 2024 00:10:46 +0200

Fix thread assertion in GB_set_sample_rate, should make GB_set_clock_multiplier thread-safe. Fix missing memset.

Diffstat:
MCore/apu.c5++++-
1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/Core/apu.c b/Core/apu.c @@ -13,6 +13,7 @@ static void __attribute__((constructor)) band_limited_init(void) { const unsigned master_size = GB_BAND_LIMITED_WIDTH * GB_BAND_LIMITED_PHASES; double *master = malloc(master_size * sizeof(*master)); + memset(master, 0, master_size * sizeof(*master)); const unsigned sine_size = 256 * GB_BAND_LIMITED_PHASES + 2; const unsigned max_harmonic = sine_size / 2 / GB_BAND_LIMITED_PHASES; @@ -1752,7 +1753,9 @@ void GB_apu_write(GB_gameboy_t *gb, uint8_t reg, uint8_t value) void GB_set_sample_rate(GB_gameboy_t *gb, unsigned sample_rate) { - GB_ASSERT_NOT_RUNNING_OTHER_THREAD(gb) + if (gb->apu_output.sample_rate != sample_rate) { + GB_ASSERT_NOT_RUNNING_OTHER_THREAD(gb) + } gb->apu_output.sample_rate = sample_rate; if (sample_rate) { gb->apu_output.highpass_rate = pow(0.999958, GB_get_clock_rate(gb) / (double)sample_rate);

This webpage is intended to be an accessible preview of this repository. To get a fuller picture, clone it and use the git CLI.