mirror of
https://github.com/libretro/RetroArch
synced 2025-01-30 03:32:46 +00:00
Make resampler "driver" hook code consistent with rest.
This commit is contained in:
parent
69267a8fa2
commit
cd597dc247
@ -24,44 +24,9 @@
|
||||
|
||||
static const rarch_resampler_t *backends[] = {
|
||||
&sinc_resampler,
|
||||
NULL,
|
||||
};
|
||||
|
||||
bool rarch_resampler_realloc(void **re, const rarch_resampler_t **backend, const char *ident, double bw_ratio)
|
||||
{
|
||||
if (*re && *backend)
|
||||
(*backend)->free(*re);
|
||||
|
||||
*re = NULL;
|
||||
*backend = NULL;
|
||||
|
||||
if (ident)
|
||||
{
|
||||
for (unsigned i = 0; i < ARRAY_SIZE(backends); i++)
|
||||
{
|
||||
if (strcmp(backends[i]->ident, ident) == 0)
|
||||
{
|
||||
*backend = backends[i];
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
*backend = backends[0];
|
||||
|
||||
if (!*backend)
|
||||
return false;
|
||||
|
||||
*re = (*backend)->init(bw_ratio);
|
||||
|
||||
if (!*re)
|
||||
{
|
||||
*backend = NULL;
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
static int find_resampler_driver_index(const char *driver)
|
||||
{
|
||||
unsigned i;
|
||||
@ -71,7 +36,7 @@ static int find_resampler_driver_index(const char *driver)
|
||||
return -1;
|
||||
}
|
||||
|
||||
void find_resampler_driver(void)
|
||||
static void find_resampler_driver(void)
|
||||
{
|
||||
int i = find_resampler_driver_index(g_settings.audio.resampler);
|
||||
if (i >= 0)
|
||||
@ -105,3 +70,24 @@ void find_next_resampler_driver(void)
|
||||
else
|
||||
RARCH_WARN("Couldn't find any next resampler driver (current one: \"%s\").\n", g_extern.audio_data.resampler->ident);
|
||||
}
|
||||
|
||||
bool rarch_resampler_realloc(void **re, const rarch_resampler_t **backend, const char *ident, double bw_ratio)
|
||||
{
|
||||
if (*re && *backend)
|
||||
(*backend)->free(*re);
|
||||
|
||||
*re = NULL;
|
||||
*backend = NULL;
|
||||
|
||||
find_resampler_driver();
|
||||
*re = g_extern.audio_data.resampler->init(bw_ratio);
|
||||
|
||||
if (!*re)
|
||||
{
|
||||
*backend = NULL;
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -2031,18 +2031,18 @@ void menu_populate_entries(void *data, unsigned menu_type)
|
||||
break;
|
||||
case RGUI_SETTINGS_DRIVERS:
|
||||
file_list_clear(rgui->selection_buf);
|
||||
file_list_push(rgui->selection_buf, "Video driver", RGUI_SETTINGS_DRIVER_VIDEO, 0);
|
||||
file_list_push(rgui->selection_buf, "Audio driver", RGUI_SETTINGS_DRIVER_AUDIO, 0);
|
||||
file_list_push(rgui->selection_buf, "Audio resampler driver", RGUI_SETTINGS_DRIVER_AUDIO_RESAMPLER, 0);
|
||||
file_list_push(rgui->selection_buf, "Input driver", RGUI_SETTINGS_DRIVER_INPUT, 0);
|
||||
file_list_push(rgui->selection_buf, "Video Driver", RGUI_SETTINGS_DRIVER_VIDEO, 0);
|
||||
file_list_push(rgui->selection_buf, "Audio Driver", RGUI_SETTINGS_DRIVER_AUDIO, 0);
|
||||
file_list_push(rgui->selection_buf, "Audio Resampler", RGUI_SETTINGS_DRIVER_AUDIO_RESAMPLER, 0);
|
||||
file_list_push(rgui->selection_buf, "Input Driver", RGUI_SETTINGS_DRIVER_INPUT, 0);
|
||||
#ifdef HAVE_CAMERA
|
||||
file_list_push(rgui->selection_buf, "Camera driver", RGUI_SETTINGS_DRIVER_CAMERA, 0);
|
||||
file_list_push(rgui->selection_buf, "Camera Driver", RGUI_SETTINGS_DRIVER_CAMERA, 0);
|
||||
#endif
|
||||
#ifdef HAVE_LOCATION
|
||||
file_list_push(rgui->selection_buf, "Location driver", RGUI_SETTINGS_DRIVER_LOCATION, 0);
|
||||
file_list_push(rgui->selection_buf, "Location Driver", RGUI_SETTINGS_DRIVER_LOCATION, 0);
|
||||
#endif
|
||||
#ifdef HAVE_MENU
|
||||
file_list_push(rgui->selection_buf, "Menu driver", RGUI_SETTINGS_DRIVER_MENU, 0);
|
||||
file_list_push(rgui->selection_buf, "Menu Driver", RGUI_SETTINGS_DRIVER_MENU, 0);
|
||||
#endif
|
||||
break;
|
||||
case RGUI_SETTINGS:
|
||||
|
Loading…
x
Reference in New Issue
Block a user