mirror of
https://github.com/libretro/RetroArch.git
synced 2024-11-24 08:30:16 +00:00
Simplify resampler.c
This commit is contained in:
parent
db0ff2a212
commit
06d3fd16ae
@ -22,36 +22,14 @@
|
||||
|
||||
#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)
|
||||
{
|
||||
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;
|
||||
|
||||
*backend = &sinc_resampler;
|
||||
*re = (*backend)->init(bw_ratio);
|
||||
|
||||
if (!*re)
|
||||
{
|
||||
*backend = NULL;
|
||||
|
@ -65,9 +65,13 @@ bool rarch_resampler_realloc(void **re, const rarch_resampler_t **backend, const
|
||||
*handle = NULL; \
|
||||
} 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 { \
|
||||
(backend)->process(handle, data); \
|
||||
} while(0)
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user