mirror of
https://github.com/libretro/RetroArch.git
synced 2024-11-27 18:20:27 +00:00
Start documenting resampler.c
This commit is contained in:
parent
2ba1a3a527
commit
e28f7c4862
@ -37,11 +37,21 @@ static const struct resampler_config resampler_config = {
|
||||
config_userdata_free,
|
||||
};
|
||||
|
||||
static int find_resampler_driver_index(const char *drv)
|
||||
/**
|
||||
* find_resampler_driver_index:
|
||||
* @ident : Identifier of resampler driver to find.
|
||||
*
|
||||
* Finds resampler driver index by @ident name.
|
||||
*
|
||||
* Returns: resampler driver index if resampler driver was found, otherwise
|
||||
* -1.
|
||||
**/
|
||||
static int find_resampler_driver_index(const char *ident)
|
||||
{
|
||||
unsigned i;
|
||||
|
||||
for (i = 0; resampler_drivers[i]; i++)
|
||||
if (strcasecmp(drv, resampler_drivers[i]->ident) == 0)
|
||||
if (strcasecmp(ident, resampler_drivers[i]->ident) == 0)
|
||||
return i;
|
||||
return -1;
|
||||
}
|
||||
@ -50,9 +60,15 @@ static int find_resampler_driver_index(const char *drv)
|
||||
#include <string/string_list.h>
|
||||
#include "../../general.h"
|
||||
|
||||
/**
|
||||
* find_prev_resampler_driver:
|
||||
*
|
||||
* Find previous driver in resampler driver array.
|
||||
**/
|
||||
void find_prev_resampler_driver(void)
|
||||
{
|
||||
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));
|
||||
@ -61,9 +77,15 @@ void find_prev_resampler_driver(void)
|
||||
driver.resampler->ident);
|
||||
}
|
||||
|
||||
/**
|
||||
* find_next_resampler_driver:
|
||||
*
|
||||
* Find next driver in resampler driver array.
|
||||
**/
|
||||
void find_next_resampler_driver(void)
|
||||
{
|
||||
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));
|
||||
@ -72,6 +94,13 @@ void find_next_resampler_driver(void)
|
||||
driver.resampler->ident);
|
||||
}
|
||||
|
||||
/**
|
||||
* config_get_audio_resampler_driver_options:
|
||||
*
|
||||
* Get an enumerated list of all resampler driver names, separated by '|'.
|
||||
*
|
||||
* Returns: string listing of all resampler driver names, separated by '|'.
|
||||
**/
|
||||
const char* config_get_audio_resampler_driver_options(void)
|
||||
{
|
||||
union string_list_elem_attr attr;
|
||||
@ -100,18 +129,24 @@ const char* config_get_audio_resampler_driver_options(void)
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Resampler is used by multiple modules so avoid
|
||||
* clobbering driver.resampler here. */
|
||||
|
||||
/**
|
||||
* find_resampler_driver:
|
||||
* @ident : Identifier of resampler driver to find.
|
||||
*
|
||||
* Finds resampler by @ident name.
|
||||
*
|
||||
* Returns: resampler driver if resampler driver was found, otherwise
|
||||
* NULL.
|
||||
**/
|
||||
static const rarch_resampler_t *find_resampler_driver(const char *ident)
|
||||
{
|
||||
unsigned d;
|
||||
int i = find_resampler_driver_index(ident);
|
||||
|
||||
if (i >= 0)
|
||||
return resampler_drivers[i];
|
||||
else
|
||||
{
|
||||
|
||||
#ifdef RARCH_INTERNAL
|
||||
unsigned d;
|
||||
RARCH_ERR("Couldn't find any resampler driver named \"%s\"\n", ident);
|
||||
RARCH_LOG_OUTPUT("Available resampler drivers are:\n");
|
||||
for (d = 0; resampler_drivers[d]; d++)
|
||||
@ -122,8 +157,17 @@ static const rarch_resampler_t *find_resampler_driver(const char *ident)
|
||||
|
||||
return resampler_drivers[0];
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* resampler_append_plugs:
|
||||
* @re : Resampler handle
|
||||
* @backend : Resampler backend that is about to be set.
|
||||
* @bw_ratio : Bandwidth ratio.
|
||||
*
|
||||
* Initializes resampler driver based on queried CPU features.
|
||||
*
|
||||
* Returns: true (1) if successfully initialized, otherwise false (0).
|
||||
**/
|
||||
static bool resampler_append_plugs(void **re,
|
||||
const rarch_resampler_t **backend,
|
||||
double bw_ratio)
|
||||
@ -137,6 +181,18 @@ static bool resampler_append_plugs(void **re,
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* rarch_resampler_realloc:
|
||||
* @re : Resampler handle
|
||||
* @backend : Resampler backend that is about to be set.
|
||||
* @ident : Identifier name for resampler we want.
|
||||
* @bw_ratio : Bandwidth ratio.
|
||||
*
|
||||
* Reallocates resampler. Will free previous handle before
|
||||
* allocating a new one. If ident is NULL, first resampler will be used.
|
||||
*
|
||||
* Returns: true (1) if successful, otherwise false (0).
|
||||
**/
|
||||
bool rarch_resampler_realloc(void **re, const rarch_resampler_t **backend,
|
||||
const char *ident, double bw_ratio)
|
||||
{
|
||||
|
@ -143,8 +143,18 @@ extern rarch_resampler_t sinc_resampler;
|
||||
extern rarch_resampler_t CC_resampler;
|
||||
extern rarch_resampler_t nearest_resampler;
|
||||
|
||||
/* Reallocs resampler. Will free previous handle before
|
||||
* allocating a new one. If ident is NULL, first resampler will be used. */
|
||||
/**
|
||||
* rarch_resampler_realloc:
|
||||
* @re : Resampler handle
|
||||
* @backend : Resampler backend that is about to be set.
|
||||
* @ident : Identifier name for resampler we want.
|
||||
* @bw_ratio : Bandwidth ratio.
|
||||
*
|
||||
* Reallocates resampler. Will free previous handle before
|
||||
* allocating a new one. If ident is NULL, first resampler will be used.
|
||||
*
|
||||
* Returns: true (1) if successful, otherwise false (0).
|
||||
**/
|
||||
bool rarch_resampler_realloc(void **re, const rarch_resampler_t **backend,
|
||||
const char *ident, double bw_ratio);
|
||||
|
||||
|
17
driver.h
17
driver.h
@ -585,10 +585,27 @@ 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);
|
||||
|
||||
/**
|
||||
* config_get_audio_resampler_driver_options:
|
||||
*
|
||||
* Get an enumerated list of all resampler driver names, separated by '|'.
|
||||
*
|
||||
* Returns: string listing of all resampler driver names, separated by '|'.
|
||||
**/
|
||||
const char* config_get_audio_resampler_driver_options(void);
|
||||
|
||||
/**
|
||||
* 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);
|
||||
|
||||
void driver_set_monitor_refresh_rate(float hz);
|
||||
|
Loading…
Reference in New Issue
Block a user