Mercurial > repos > blastem
comparison libblastem.c @ 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 | 62e8a8833e39 |
children | 81b059e3ded6 |
comparison
equal
deleted
inserted
replaced
1888:bd60e74fd173 | 1889:377f110e4cea |
---|---|
124 overscan_right = 14; | 124 overscan_right = 14; |
125 } | 125 } |
126 } | 126 } |
127 } | 127 } |
128 | 128 |
129 static int32_t sample_rate; | |
129 RETRO_API void retro_get_system_av_info(struct retro_system_av_info *info) | 130 RETRO_API void retro_get_system_av_info(struct retro_system_av_info *info) |
130 { | 131 { |
131 update_overscan(); | 132 update_overscan(); |
132 last_width = LINEBUF_SIZE; | 133 last_width = LINEBUF_SIZE; |
133 info->geometry.base_width = info->geometry.max_width = LINEBUF_SIZE - (overscan_left + overscan_right); | 134 info->geometry.base_width = info->geometry.max_width = LINEBUF_SIZE - (overscan_left + overscan_right); |
134 info->geometry.base_height = (video_standard == VID_NTSC ? 243 : 294) - (overscan_top + overscan_bot); | 135 info->geometry.base_height = (video_standard == VID_NTSC ? 243 : 294) - (overscan_top + overscan_bot); |
135 last_height = info->geometry.base_height; | 136 last_height = info->geometry.base_height; |
136 info->geometry.max_height = info->geometry.base_height * 2; | 137 info->geometry.max_height = info->geometry.base_height * 2; |
137 info->geometry.aspect_ratio = 0; | 138 info->geometry.aspect_ratio = 0; |
138 info->timing.fps = video_standard == VID_NTSC ? 60 : 50; | 139 double master_clock = video_standard == VID_NTSC ? 53693175 : 53203395; |
139 info->timing.sample_rate = 53267; //approximate sample rate of YM2612 | 140 double lines = video_standard == VID_NTSC ? 262 : 313; |
141 info->timing.fps = master_clock / (3420.0 * lines); | |
142 info->timing.sample_rate = master_clock / (7 * 6 * 24); //sample rate of YM2612 | |
143 sample_rate = info->timing.sample_rate; | |
140 } | 144 } |
141 | 145 |
142 RETRO_API void retro_set_controller_port_device(unsigned port, unsigned device) | 146 RETRO_API void retro_set_controller_port_device(unsigned port, unsigned device) |
143 { | 147 { |
144 } | 148 } |
414 | 418 |
415 static void check_put_sample(void) | 419 static void check_put_sample(void) |
416 { | 420 { |
417 for (int i = 0; i < num_audio_sources; i++) | 421 for (int i = 0; i < num_audio_sources; i++) |
418 { | 422 { |
419 int32_t min_samples = audio_sources[i]->freq / 53267; | 423 int32_t min_samples = audio_sources[i]->freq / sample_rate; |
420 if (audio_sources[i]->num_samples < min_samples) { | 424 if (audio_sources[i]->num_samples < min_samples) { |
421 return; | 425 return; |
422 } | 426 } |
423 } | 427 } |
424 int16_t left = 0, right = 0; | 428 int16_t left = 0, right = 0; |