From 094d07694463d2196d849cb575d0449438fee282 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Fri, 8 Feb 2013 14:39:32 +0100 Subject: [PATCH] (PS3/Xbox 1/Rmenu) Add resampler type option --- frontend/menu/rmenu.c | 49 +++++++++++++++++++++++++++++++++++++++++++ frontend/menu/rmenu.h | 1 + 2 files changed, 50 insertions(+) diff --git a/frontend/menu/rmenu.c b/frontend/menu/rmenu.c index be91002d69..aaa4b213ae 100644 --- a/frontend/menu/rmenu.c +++ b/frontend/menu/rmenu.c @@ -290,6 +290,21 @@ static void populate_setting_item(void *data, unsigned input) snprintf(current_item->setting_text, sizeof(current_item->setting_text), ""); snprintf(current_item->comment, sizeof(current_item->comment), "INFO - Set all [General Audio Settings] back to their 'DEFAULT' values."); break; + case SETTING_RESAMPLER_TYPE: + snprintf(current_item->text, sizeof(current_item->text), "Sound resampler"); +#ifdef HAVE_SINC + if (strstr(g_settings.audio.resampler, "sinc")) + { + snprintf(current_item->setting_text, sizeof(current_item->setting_text), "Sinc"); + snprintf(current_item->comment, sizeof(current_item->comment), "INFO - [Sinc resampler] - slower but moreaccurate sound."); + } + else +#endif + { + snprintf(current_item->setting_text, sizeof(current_item->setting_text), "Hermite"); + snprintf(current_item->comment, sizeof(current_item->comment), "INFO - [Hermite resampler] - faster but less accurate with high sampling rates (such as 44KHz/48KHz)."); + } + break; case SETTING_EMU_CURRENT_SAVE_STATE_SLOT: snprintf(current_item->text, sizeof(current_item->text), "Current save state slot"); snprintf(current_item->setting_text, sizeof(current_item->setting_text), "%d", g_extern.state_slot); @@ -1425,6 +1440,40 @@ static int set_setting_action(void *data, unsigned switchvalue, uint64_t input) return -1; } break; + case SETTING_RESAMPLER_TYPE: + if((input & (1ULL << RMENU_DEVICE_NAV_LEFT)) || (input & (1ULL << RMENU_DEVICE_NAV_RIGHT)) || (input & (1ULL << RMENU_DEVICE_NAV_B))) + { +#ifdef HAVE_SINC + if( strstr(g_settings.audio.resampler, "hermite")) + snprintf(g_settings.audio.resampler, sizeof(g_settings.audio.resampler), "sinc"); + else +#endif + snprintf(g_settings.audio.resampler, sizeof(g_settings.audio.resampler), "hermite"); + + if (g_extern.main_is_init) + { + if (rarch_resampler_realloc(&g_extern.audio_data.resampler_data, &g_extern.audio_data.resampler, + g_settings.audio.resampler)) + { + /* TODO */ + } + } + + } + if(input & (1ULL << RMENU_DEVICE_NAV_START)) + { + snprintf(g_settings.audio.resampler, sizeof(g_settings.audio.resampler), "hermite"); + + if (g_extern.main_is_init) + { + if (rarch_resampler_realloc(&g_extern.audio_data.resampler_data, &g_extern.audio_data.resampler, + g_settings.audio.resampler)) + { + /* TODO */ + } + } + } + break; case SETTING_EMU_AUDIO_MUTE: if((input & (1ULL << RMENU_DEVICE_NAV_LEFT)) || (input & (1ULL << RMENU_DEVICE_NAV_RIGHT)) || (input & (1ULL << RMENU_DEVICE_NAV_B))) rmenu_settings_set(S_AUDIO_MUTE); diff --git a/frontend/menu/rmenu.h b/frontend/menu/rmenu.h index ab51cc6dc5..7fa62d64fa 100644 --- a/frontend/menu/rmenu.h +++ b/frontend/menu/rmenu.h @@ -134,6 +134,7 @@ enum #ifdef HAVE_RSOUND SETTING_RSOUND_SERVER_IP_ADDRESS, #endif + SETTING_RESAMPLER_TYPE, SETTING_ENABLE_CUSTOM_BGM, SETTING_DEFAULT_AUDIO_ALL, SETTING_EMU_CURRENT_SAVE_STATE_SLOT,