mirror of
https://github.com/libretro/RetroArch
synced 2025-04-16 08:43:10 +00:00
Create audio_driver_menu_sample
This commit is contained in:
parent
686faa2407
commit
773fc1ebad
@ -722,6 +722,19 @@ void audio_driver_sample(int16_t left, int16_t right)
|
|||||||
audio_driver_data_ptr = 0;
|
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:
|
* audio_driver_sample_batch:
|
||||||
* @data : pointer to audio buffer.
|
* @data : pointer to audio buffer.
|
||||||
@ -837,13 +850,13 @@ void audio_driver_monitor_adjust_system_rates(void)
|
|||||||
{
|
{
|
||||||
float timing_skew;
|
float timing_skew;
|
||||||
settings_t *settings = config_get_ptr();
|
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 video_refresh_rate = settings->floats.video_refresh_rate;
|
||||||
float max_timing_skew = settings->floats.audio_max_timing_skew;
|
float max_timing_skew = settings->floats.audio_max_timing_skew;
|
||||||
const struct retro_system_timing *info = av_info ?
|
struct retro_system_av_info *av_info = video_viewport_get_system_av_info();
|
||||||
(const struct retro_system_timing*)&av_info->timing : NULL;
|
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;
|
return;
|
||||||
|
|
||||||
timing_skew = fabs(1.0f - info->fps / video_refresh_rate);
|
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)
|
if (params->state == AUDIO_STREAM_STATE_PLAYING)
|
||||||
{
|
{
|
||||||
voice = audio_mixer_play(handle, looped, params->volume, stop_cb);
|
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)
|
else if (params->state == AUDIO_STREAM_STATE_PLAYING_LOOPED)
|
||||||
{
|
{
|
||||||
looped = true;
|
looped = true;
|
||||||
voice = audio_mixer_play(handle, looped, params->volume, stop_cb);
|
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;
|
audio_mixer_streams[audio_mixer_current_max_idx].buf = buf;
|
||||||
@ -1160,7 +1173,7 @@ static void audio_driver_mixer_deinit(void)
|
|||||||
{
|
{
|
||||||
unsigned i;
|
unsigned i;
|
||||||
|
|
||||||
audio_set_bool(AUDIO_ACTION_MIXER, false);
|
audio_mixer_active = false;
|
||||||
|
|
||||||
for (i = 0; i < AUDIO_MIXER_MAX_STREAMS; i++)
|
for (i = 0; i < AUDIO_MIXER_MAX_STREAMS; i++)
|
||||||
audio_driver_mixer_remove_stream(i);
|
audio_driver_mixer_remove_stream(i);
|
||||||
|
@ -271,6 +271,8 @@ bool audio_driver_deinit(void);
|
|||||||
|
|
||||||
bool audio_driver_init(void);
|
bool audio_driver_init(void);
|
||||||
|
|
||||||
|
void audio_driver_menu_sample(void);
|
||||||
|
|
||||||
bool audio_driver_mixer_add_stream(audio_mixer_stream_params_t *params);
|
bool audio_driver_mixer_add_stream(audio_mixer_stream_params_t *params);
|
||||||
|
|
||||||
enum resampler_quality audio_driver_get_resampler_quality(void);
|
enum resampler_quality audio_driver_get_resampler_quality(void);
|
||||||
|
@ -2608,6 +2608,7 @@ static enum runloop_state runloop_check_state(
|
|||||||
|
|
||||||
retro_ctx.poll_cb();
|
retro_ctx.poll_cb();
|
||||||
|
|
||||||
|
|
||||||
{
|
{
|
||||||
enum menu_action action;
|
enum menu_action action;
|
||||||
bool focused = false;
|
bool focused = false;
|
||||||
@ -2627,10 +2628,13 @@ static enum runloop_state runloop_check_state(
|
|||||||
rarch_menu_running_finished();
|
rarch_menu_running_finished();
|
||||||
|
|
||||||
if (focused || !runloop_idle)
|
if (focused || !runloop_idle)
|
||||||
|
{
|
||||||
menu_driver_render(runloop_idle, rarch_is_inited,
|
menu_driver_render(runloop_idle, rarch_is_inited,
|
||||||
(current_core_type == CORE_TYPE_DUMMY)
|
(current_core_type == CORE_TYPE_DUMMY)
|
||||||
)
|
)
|
||||||
;
|
;
|
||||||
|
audio_driver_menu_sample();
|
||||||
|
}
|
||||||
|
|
||||||
old_input = current_input;
|
old_input = current_input;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user