Backport Themaister - Move g_settings.audio.in_rate to g_extern.audio_data.

It's not a setting.
This commit is contained in:
twinaphex 2014-07-23 07:15:57 +02:00
parent 624a983d8e
commit 65a64c1111
4 changed files with 15 additions and 12 deletions

View File

@ -404,13 +404,13 @@ static void adjust_system_rates(void)
RARCH_LOG("Game FPS > Monitor FPS. Cannot rely on VSync.\n");
}
g_settings.audio.in_rate = info->sample_rate;
g_extern.audio_data.in_rate = info->sample_rate;
}
else
g_settings.audio.in_rate = info->sample_rate *
g_extern.audio_data.in_rate = info->sample_rate *
(g_settings.video.refresh_rate / info->fps);
RARCH_LOG("Set audio input rate to: %.2f Hz.\n", g_settings.audio.in_rate);
RARCH_LOG("Set audio input rate to: %.2f Hz.\n", g_extern.audio_data.in_rate);
if (driver.video_data)
{
@ -433,7 +433,7 @@ void driver_set_monitor_refresh_rate(float hz)
g_extern.audio_data.orig_src_ratio =
g_extern.audio_data.src_ratio =
(double)g_settings.audio.out_rate / g_settings.audio.in_rate;
(double)g_settings.audio.out_rate / g_extern.audio_data.in_rate;
}
void driver_set_nonblock_state(bool nonblock)
@ -701,7 +701,7 @@ void rarch_init_dsp_filter(void)
if (!*g_settings.audio.dsp_plugin)
return;
g_extern.audio_data.dsp = rarch_dsp_filter_new(g_settings.audio.dsp_plugin, g_settings.audio.in_rate);
g_extern.audio_data.dsp = rarch_dsp_filter_new(g_settings.audio.dsp_plugin, g_extern.audio_data.in_rate);
if (!g_extern.audio_data.dsp)
RARCH_ERR("[DSP]: Failed to initialize DSP filter \"%s\".\n", g_settings.audio.dsp_plugin);
}
@ -779,9 +779,16 @@ void init_audio(void)
g_extern.audio_data.chunk_size = g_extern.audio_data.nonblock_chunk_size;
}
// Should never happen.
if (g_extern.audio_data.in_rate <= 0.0f)
{
RARCH_WARN("Input rate is invalid (%.3f Hz). Using output rate (%u Hz).\n", g_extern.audio_data.in_rate, g_settings.audio.out_rate);
g_extern.audio_data.in_rate = g_settings.audio.out_rate;
}
g_extern.audio_data.orig_src_ratio =
g_extern.audio_data.src_ratio =
(double)g_settings.audio.out_rate / g_settings.audio.in_rate;
(double)g_settings.audio.out_rate / g_extern.audio_data.in_rate;
if (!rarch_resampler_realloc(&g_extern.audio_data.resampler_data, &g_extern.audio_data.resampler,
g_settings.audio.resampler, g_extern.audio_data.orig_src_ratio))
@ -794,7 +801,7 @@ void init_audio(void)
g_extern.audio_data.data_ptr = 0;
rarch_assert(g_settings.audio.out_rate < g_settings.audio.in_rate * AUDIO_MAX_RATIO);
rarch_assert(g_settings.audio.out_rate < g_extern.audio_data.in_rate * AUDIO_MAX_RATIO);
rarch_assert(g_extern.audio_data.outsamples = (float*)malloc(outsamples_max * sizeof(float)));
g_extern.audio_data.rate_control = false;

View File

@ -262,7 +262,6 @@ struct settings
bool enable;
unsigned out_rate;
unsigned block_frames;
float in_rate;
char device[PATH_MAX];
unsigned latency;
bool sync;
@ -512,6 +511,7 @@ struct global
size_t block_chunk_size;
double src_ratio;
float in_rate;
bool use_float;
bool mute;

View File

@ -333,7 +333,6 @@ void config_set_defaults(void)
g_settings.audio.enable = audio_enable;
g_settings.audio.out_rate = out_rate;
g_settings.audio.block_frames = 0;
g_settings.audio.in_rate = out_rate;
if (audio_device)
strlcpy(g_settings.audio.device, audio_device, sizeof(g_settings.audio.device));

View File

@ -561,8 +561,6 @@ static void general_change_handler(const void *data)
}
else if (!strcmp(setting->name, "audio_out_rate"))
g_settings.audio.out_rate = *setting->value.unsigned_integer;
else if (!strcmp(setting->name, "audio_in_rate"))
g_settings.audio.in_rate = *setting->value.fraction;
else if (!strcmp(setting->name, "input_autodetect_enable"))
g_settings.input.autodetect_enable = *setting->value.boolean;
else if (!strcmp(setting->name, "input_turbo_period"))
@ -990,7 +988,6 @@ rarch_setting_t* setting_data_get_list(void)
START_SUB_GROUP("Miscellaneous")
CONFIG_STRING(g_settings.audio.device, "audio_device", "Device", "", GROUP_NAME, SUBGROUP_NAME, general_change_handler)
CONFIG_FLOAT(g_settings.audio.in_rate, "audio_in_rate", "Audio Input Rate", out_rate, GROUP_NAME, SUBGROUP_NAME, general_change_handler)
CONFIG_UINT(g_settings.audio.out_rate, "audio_out_rate", "Audio Output Rate", out_rate, GROUP_NAME, SUBGROUP_NAME, general_change_handler)
CONFIG_PATH(g_settings.audio.dsp_plugin, "audio_dsp_plugin", "DSP Plugin", "", GROUP_NAME, SUBGROUP_NAME, general_change_handler) WITH_FLAGS(SD_FLAG_ALLOW_EMPTY)
END_SUB_GROUP()