git.y1.nz

SameBoy

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

commit 04cd94de3f7f84449cdd0f15f170d524635e1a28
parent da0380c32df8a69551ac6ac94ec340101992293d
Author: Lior Halphon <LIJI32@gmail.com>
Date:   Fri, 24 Jan 2025 14:35:25 +0200

Delegate audio downsampling to the libretro frontend, except on the Wii U. Fixes #677.

Diffstat:
Mlibretro/libretro.c16++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/libretro/libretro.c b/libretro/libretro.c @@ -7,12 +7,8 @@ #include <signal.h> #include <stdarg.h> #include <stdlib.h> -#ifndef WIIU -#define AUDIO_FREQUENCY 384000 -#else -/* Use the internal sample rate for the Wii U */ -#define AUDIO_FREQUENCY 48000 -#endif + +#define WIIU_SAMPLE_RATE 48000 #ifdef _WIN32 #include <direct.h> @@ -642,7 +638,11 @@ static void init_for_current_model(unsigned id) GB_set_pixels_output(&gameboy[i], (uint32_t *)(frame_buf + GB_get_screen_width(&gameboy[0]) * GB_get_screen_height(&gameboy[0]) * i)); GB_set_rgb_encode_callback(&gameboy[i], rgb_encode); - GB_set_sample_rate(&gameboy[i], AUDIO_FREQUENCY); +#ifdef WIIU + GB_set_sample_rate(&gameboy[i], WIIU_SAMPLE_RATE); +#else + GB_set_sample_rate(&gameboy[i], GB_get_clock_rate(&gameboy[i]) / 2); +#endif GB_apu_set_sample_callback(&gameboy[i], audio_callback); GB_set_rumble_callback(&gameboy[i], rumble_callback); @@ -1230,7 +1230,7 @@ void retro_get_system_info(struct retro_system_info *info) void retro_get_system_av_info(struct retro_system_av_info *info) { struct retro_game_geometry geom; - struct retro_system_timing timing = { GB_get_usual_frame_rate(&gameboy[0]), AUDIO_FREQUENCY }; + struct retro_system_timing timing = { GB_get_usual_frame_rate(&gameboy[0]), GB_get_sample_rate(&gameboy[audio_out])}; if (emulated_devices == 2) { if (screen_layout == LAYOUT_TOP_DOWN) {

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