mirror of
https://github.com/CTCaer/RetroArch.git
synced 2025-01-18 00:32:46 +00:00
Get rid of RARCH_INTERNAL-specific code in resampler.c
This commit is contained in:
parent
e59dace9e1
commit
8b95cfe6e3
@ -59,44 +59,35 @@ static int find_resampler_driver_index(const char *ident)
|
||||
return -1;
|
||||
}
|
||||
|
||||
#if !defined(RESAMPLER_TEST) && defined(RARCH_INTERNAL)
|
||||
#include <string/string_list.h>
|
||||
#include "../../general.h"
|
||||
|
||||
/**
|
||||
* find_prev_resampler_driver:
|
||||
* audio_resampler_driver_find_handle:
|
||||
* @index : index of driver to get handle to.
|
||||
*
|
||||
* Finds previous driver in resampler driver array.
|
||||
* Returns: handle to audio resampler driver at index. Can be NULL
|
||||
* if nothing found.
|
||||
**/
|
||||
void find_prev_resampler_driver(void)
|
||||
const void *audio_resampler_driver_find_handle(int index)
|
||||
{
|
||||
int i = find_resampler_driver_index(g_settings.audio.resampler);
|
||||
|
||||
if (i > 0)
|
||||
strlcpy(g_settings.audio.resampler, resampler_drivers[i - 1]->ident,
|
||||
sizeof(g_settings.audio.resampler));
|
||||
else
|
||||
RARCH_WARN("Couldn't find any previous resampler driver (current one: \"%s\").\n",
|
||||
driver.resampler->ident);
|
||||
const void *drv = resampler_drivers[index];
|
||||
if (!drv)
|
||||
return NULL;
|
||||
return drv;
|
||||
}
|
||||
|
||||
/**
|
||||
* find_next_resampler_driver:
|
||||
* audio_resampler_driver_find_ident:
|
||||
* @index : index of driver to get handle to.
|
||||
*
|
||||
* Finds next driver in resampler driver array.
|
||||
* Returns: Human-readable identifier of audio resampler driver at index.
|
||||
* Can be NULL if nothing found.
|
||||
**/
|
||||
void find_next_resampler_driver(void)
|
||||
const char *audio_resampler_driver_find_ident(int index)
|
||||
{
|
||||
int i = find_resampler_driver_index(g_settings.audio.resampler);
|
||||
|
||||
if (i >= 0 && resampler_drivers[i + 1])
|
||||
strlcpy(g_settings.audio.resampler, resampler_drivers[i + 1]->ident,
|
||||
sizeof(g_settings.audio.resampler));
|
||||
else
|
||||
RARCH_WARN("Couldn't find any next resampler driver (current one: \"%s\").\n",
|
||||
driver.resampler->ident);
|
||||
const rarch_resampler_t *drv = resampler_drivers[index];
|
||||
if (!drv)
|
||||
return NULL;
|
||||
return drv->ident;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifndef DONT_HAVE_STRING_LIST
|
||||
/**
|
||||
|
@ -154,6 +154,24 @@ extern rarch_resampler_t nearest_resampler;
|
||||
const char* config_get_audio_resampler_driver_options(void);
|
||||
#endif
|
||||
|
||||
/**
|
||||
* audio_resampler_driver_find_handle:
|
||||
* @index : index of driver to get handle to.
|
||||
*
|
||||
* Returns: handle to audio resampler driver at index. Can be NULL
|
||||
* if nothing found.
|
||||
**/
|
||||
const void *audio_resampler_driver_find_handle(int index);
|
||||
|
||||
/**
|
||||
* audio_resampler_driver_find_ident:
|
||||
* @index : index of driver to get handle to.
|
||||
*
|
||||
* Returns: Human-readable identifier of audio resampler driver at index.
|
||||
* Can be NULL if nothing found.
|
||||
**/
|
||||
const char *audio_resampler_driver_find_ident(int index);
|
||||
|
||||
/**
|
||||
* rarch_resampler_realloc:
|
||||
* @re : Resampler handle
|
||||
|
6
driver.c
6
driver.c
@ -105,6 +105,12 @@ static const void *find_driver_nonempty(const char *label, int i,
|
||||
if (drv)
|
||||
strlcpy(str, audio_driver_find_ident(i), sizeof_str);
|
||||
}
|
||||
else if (!strcmp(label, "audio_resampler_driver"))
|
||||
{
|
||||
drv = audio_resampler_driver_find_handle(i);
|
||||
if (drv)
|
||||
strlcpy(str, audio_resampler_driver_find_ident(i), sizeof_str);
|
||||
}
|
||||
|
||||
return drv;
|
||||
}
|
||||
|
14
driver.h
14
driver.h
@ -347,20 +347,6 @@ void find_prev_driver(const char *label, char *str, size_t sizeof_str);
|
||||
**/
|
||||
void find_next_driver(const char *label, char *str, size_t sizeof_str);
|
||||
|
||||
/**
|
||||
* find_prev_resampler_driver:
|
||||
*
|
||||
* Find previous driver in resampler driver array.
|
||||
**/
|
||||
void find_prev_resampler_driver(void);
|
||||
|
||||
/**
|
||||
* find_next_resampler_driver:
|
||||
*
|
||||
* Find next driver in resampler driver array.
|
||||
**/
|
||||
void find_next_resampler_driver(void);
|
||||
|
||||
/**
|
||||
* driver_set_monitor_refresh_rate:
|
||||
* @hz : New refresh rate for monitor.
|
||||
|
@ -830,27 +830,6 @@ static int setting_data_string_action_toggle_driver(void *data,
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int setting_data_string_action_toggle_audio_resampler(void *data,
|
||||
unsigned action)
|
||||
{
|
||||
rarch_setting_t *setting = (rarch_setting_t*)data;
|
||||
|
||||
if (!setting)
|
||||
return -1;
|
||||
|
||||
switch (action)
|
||||
{
|
||||
case MENU_ACTION_LEFT:
|
||||
find_prev_resampler_driver();
|
||||
break;
|
||||
case MENU_ACTION_RIGHT:
|
||||
find_next_resampler_driver();
|
||||
break;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int core_list_action_toggle(void *data, unsigned action)
|
||||
{
|
||||
rarch_setting_t *setting = (rarch_setting_t *)data;
|
||||
@ -3582,7 +3561,7 @@ static bool setting_data_append_list_driver_options(
|
||||
subgroup_info.name,
|
||||
NULL,
|
||||
NULL);
|
||||
(*list)[list_info->index - 1].action_toggle = &setting_data_string_action_toggle_audio_resampler;
|
||||
settings_data_list_current_add_flags(list, list_info, SD_FLAG_IS_DRIVER);
|
||||
|
||||
CONFIG_STRING_OPTIONS(
|
||||
g_settings.camera.driver,
|
||||
|
Loading…
x
Reference in New Issue
Block a user