diff --git a/audio/audio_driver.c b/audio/audio_driver.c index 3209354b19..3a238703d6 100644 --- a/audio/audio_driver.c +++ b/audio/audio_driver.c @@ -722,6 +722,19 @@ void audio_driver_sample(int16_t left, int16_t right) audio_driver_data_ptr = 0; } +void audio_driver_menu_sample(void) +{ +#if 0 + static int16_t samples_buf[4096] = {0}; + struct retro_system_av_info + *av_info = video_viewport_get_system_av_info(); + const struct retro_system_timing *info = + (const struct retro_system_timing*)&av_info->timing; + unsigned sample_count = (info->sample_rate / info->fps) * 2; + audio_driver_flush(samples_buf, sample_count); +#endif +} + /** * audio_driver_sample_batch: * @data : pointer to audio buffer. @@ -837,13 +850,13 @@ void audio_driver_monitor_adjust_system_rates(void) { float timing_skew; settings_t *settings = config_get_ptr(); - struct retro_system_av_info *av_info = video_viewport_get_system_av_info(); float video_refresh_rate = settings->floats.video_refresh_rate; float max_timing_skew = settings->floats.audio_max_timing_skew; - const struct retro_system_timing *info = av_info ? - (const struct retro_system_timing*)&av_info->timing : NULL; + struct retro_system_av_info *av_info = video_viewport_get_system_av_info(); + const struct retro_system_timing *info = + (const struct retro_system_timing*)&av_info->timing; - if (!info || info->sample_rate <= 0.0) + if (info->sample_rate <= 0.0) return; timing_skew = fabs(1.0f - info->fps / video_refresh_rate); @@ -1101,13 +1114,13 @@ bool audio_driver_mixer_add_stream(audio_mixer_stream_params_t *params) if (params->state == AUDIO_STREAM_STATE_PLAYING) { voice = audio_mixer_play(handle, looped, params->volume, stop_cb); - audio_set_bool(AUDIO_ACTION_MIXER, true); + audio_mixer_active = true; } else if (params->state == AUDIO_STREAM_STATE_PLAYING_LOOPED) { looped = true; voice = audio_mixer_play(handle, looped, params->volume, stop_cb); - audio_set_bool(AUDIO_ACTION_MIXER, true); + audio_mixer_active = true; } audio_mixer_streams[audio_mixer_current_max_idx].buf = buf; @@ -1160,7 +1173,7 @@ static void audio_driver_mixer_deinit(void) { unsigned i; - audio_set_bool(AUDIO_ACTION_MIXER, false); + audio_mixer_active = false; for (i = 0; i < AUDIO_MIXER_MAX_STREAMS; i++) audio_driver_mixer_remove_stream(i); diff --git a/audio/audio_driver.h b/audio/audio_driver.h index 6dfacaa89f..e5c37a344c 100644 --- a/audio/audio_driver.h +++ b/audio/audio_driver.h @@ -271,6 +271,8 @@ bool audio_driver_deinit(void); bool audio_driver_init(void); +void audio_driver_menu_sample(void); + bool audio_driver_mixer_add_stream(audio_mixer_stream_params_t *params); enum resampler_quality audio_driver_get_resampler_quality(void); diff --git a/retroarch.c b/retroarch.c index 537ed82f37..29df4434b0 100644 --- a/retroarch.c +++ b/retroarch.c @@ -2608,6 +2608,7 @@ static enum runloop_state runloop_check_state( retro_ctx.poll_cb(); + { enum menu_action action; bool focused = false; @@ -2627,10 +2628,13 @@ static enum runloop_state runloop_check_state( rarch_menu_running_finished(); if (focused || !runloop_idle) + { menu_driver_render(runloop_idle, rarch_is_inited, (current_core_type == CORE_TYPE_DUMMY) ) ; + audio_driver_menu_sample(); + } old_input = current_input;