Mercurial > repos > blastem
changeset 1889:377f110e4cea
Report more accurate frame and sample rates to frontend in libretro target
author | Michael Pavone <pavone@retrodev.com> |
---|---|
date | Sat, 21 Sep 2019 20:26:12 -0700 |
parents | bd60e74fd173 |
children | 7bb4081e9e52 |
files | genesis.c libblastem.c |
diffstat | 2 files changed, 8 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/genesis.c Sat Sep 21 20:23:53 2019 -0700 +++ b/genesis.c Sat Sep 21 20:26:12 2019 -0700 @@ -34,7 +34,7 @@ #define LINES_PAL 313 #ifdef IS_LIB -#define MAX_SOUND_CYCLES 1000 +#define MAX_SOUND_CYCLES (MCLKS_PER_YM*NUM_OPERATORS*6) #else #define MAX_SOUND_CYCLES 100000 #endif
--- a/libblastem.c Sat Sep 21 20:23:53 2019 -0700 +++ b/libblastem.c Sat Sep 21 20:26:12 2019 -0700 @@ -126,6 +126,7 @@ } } +static int32_t sample_rate; RETRO_API void retro_get_system_av_info(struct retro_system_av_info *info) { update_overscan(); @@ -135,8 +136,11 @@ last_height = info->geometry.base_height; info->geometry.max_height = info->geometry.base_height * 2; info->geometry.aspect_ratio = 0; - info->timing.fps = video_standard == VID_NTSC ? 60 : 50; - info->timing.sample_rate = 53267; //approximate sample rate of YM2612 + double master_clock = video_standard == VID_NTSC ? 53693175 : 53203395; + double lines = video_standard == VID_NTSC ? 262 : 313; + info->timing.fps = master_clock / (3420.0 * lines); + info->timing.sample_rate = master_clock / (7 * 6 * 24); //sample rate of YM2612 + sample_rate = info->timing.sample_rate; } RETRO_API void retro_set_controller_port_device(unsigned port, unsigned device) @@ -416,7 +420,7 @@ { for (int i = 0; i < num_audio_sources; i++) { - int32_t min_samples = audio_sources[i]->freq / 53267; + int32_t min_samples = audio_sources[i]->freq / sample_rate; if (audio_sources[i]->num_samples < min_samples) { return; }