Simplify resampler.c

This commit is contained in:
twinaphex 2013-04-07 18:38:21 +02:00
parent db0ff2a212
commit 06d3fd16ae
2 changed files with 6 additions and 24 deletions

View File

@ -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;

View File

@ -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