mirror of
https://github.com/libretro/RetroArch
synced 2025-03-06 04:13:52 +00:00
Simplify resampler.c
This commit is contained in:
parent
db0ff2a212
commit
06d3fd16ae
@ -22,36 +22,14 @@
|
|||||||
|
|
||||||
#include "../general.h"
|
#include "../general.h"
|
||||||
|
|
||||||
static const rarch_resampler_t *backends[] = {
|
|
||||||
&sinc_resampler,
|
|
||||||
};
|
|
||||||
|
|
||||||
bool rarch_resampler_realloc(void **re, const rarch_resampler_t **backend, const char *ident, double bw_ratio)
|
bool rarch_resampler_realloc(void **re, const rarch_resampler_t **backend, const char *ident, double bw_ratio)
|
||||||
{
|
{
|
||||||
if (*re && *backend)
|
if (*re && *backend)
|
||||||
(*backend)->free(*re);
|
(*backend)->free(*re);
|
||||||
|
|
||||||
*re = NULL;
|
*backend = &sinc_resampler;
|
||||||
*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);
|
*re = (*backend)->init(bw_ratio);
|
||||||
|
|
||||||
if (!*re)
|
if (!*re)
|
||||||
{
|
{
|
||||||
*backend = NULL;
|
*backend = NULL;
|
||||||
|
@ -65,9 +65,13 @@ bool rarch_resampler_realloc(void **re, const rarch_resampler_t **backend, const
|
|||||||
*handle = NULL; \
|
*handle = NULL; \
|
||||||
} while(0)
|
} while(0)
|
||||||
|
|
||||||
|
#ifdef RARCH_CONSOLE
|
||||||
|
#define rarch_resampler_process(backend, handle, data) resampler_sinc_process(handle, data)
|
||||||
|
#else
|
||||||
#define rarch_resampler_process(backend, handle, data) do { \
|
#define rarch_resampler_process(backend, handle, data) do { \
|
||||||
(backend)->process(handle, data); \
|
(backend)->process(handle, data); \
|
||||||
} while(0)
|
} while(0)
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user