-static void retro_audio_buff_status_cb(
- bool active, unsigned occupancy, bool underrun_likely)
-{
- retro_audio_buff_active = active;
- retro_audio_buff_occupancy = occupancy;
- retro_audio_buff_underrun = underrun_likely;
-}
-
-static void retro_set_audio_buff_status_cb(void)
-{
- if (frameskip_type > 0)
- {
- struct retro_audio_buffer_status_callback buf_status_cb;
-
- buf_status_cb.callback = retro_audio_buff_status_cb;
- if (!environ_cb(RETRO_ENVIRONMENT_SET_AUDIO_BUFFER_STATUS_CALLBACK,
- &buf_status_cb))
- {
- retro_audio_buff_active = false;
- retro_audio_buff_occupancy = 0;
- retro_audio_buff_underrun = false;
- retro_audio_latency = 0;
- }
- else
- {
- /* Frameskip is enabled - increase frontend
- * audio latency to minimise potential
- * buffer underruns */
- uint32_t frame_time_usec = 1000000.0 / (is_pal_mode ? 50.0 : 60.0);
-
- /* Set latency to 6x current frame time... */
- retro_audio_latency = (unsigned)(6 * frame_time_usec / 1000);
-
- /* ...then round up to nearest multiple of 32 */
- retro_audio_latency = (retro_audio_latency + 0x1F) & ~0x1F;
- }
- }
- else
- {
- environ_cb(RETRO_ENVIRONMENT_SET_AUDIO_BUFFER_STATUS_CALLBACK, NULL);
- retro_audio_latency = 0;
- }
-
- update_audio_latency = true;
-}
-