mirror of
https://github.com/libretro/RetroArch.git
synced 2024-11-23 16:09:47 +00:00
(audio/dsp_filter.c) Cleanups
This commit is contained in:
parent
cbfd7ad881
commit
9fee7f5c80
@ -136,11 +136,13 @@ static const dspfilter_get_implementation_t dsp_plugs_builtin[] = {
|
||||
chorus_dspfilter_get_implementation,
|
||||
};
|
||||
|
||||
static bool append_plugs(rarch_dsp_filter_t *dsp)
|
||||
static bool append_plugs(rarch_dsp_filter_t *dsp, struct string_list *list)
|
||||
{
|
||||
unsigned i;
|
||||
dspfilter_simd_mask_t mask = rarch_get_cpu_features();
|
||||
|
||||
(void)list;
|
||||
|
||||
dsp->plugs = (struct rarch_dsp_plug*)
|
||||
calloc(ARRAY_SIZE(dsp_plugs_builtin), sizeof(*dsp->plugs));
|
||||
if (!dsp->plugs)
|
||||
@ -212,12 +214,13 @@ static bool append_plugs(rarch_dsp_filter_t *dsp, struct string_list *list)
|
||||
rarch_dsp_filter_t *rarch_dsp_filter_new(
|
||||
const char *filter_config, float sample_rate)
|
||||
{
|
||||
#if !defined(HAVE_FILTERS_BUILTIN) && defined(HAVE_DYLIB)
|
||||
char basedir[PATH_MAX];
|
||||
#endif
|
||||
struct string_list *plugs = NULL;
|
||||
rarch_dsp_filter_t *dsp = NULL;
|
||||
|
||||
rarch_dsp_filter_t *dsp = (rarch_dsp_filter_t*)calloc(1, sizeof(*dsp));
|
||||
(void)basedir;
|
||||
|
||||
dsp = (rarch_dsp_filter_t*)calloc(1, sizeof(*dsp));
|
||||
if (!dsp)
|
||||
return NULL;
|
||||
|
||||
@ -228,22 +231,19 @@ rarch_dsp_filter_t *rarch_dsp_filter_new(
|
||||
goto error;
|
||||
}
|
||||
|
||||
#if defined(HAVE_FILTERS_BUILTIN)
|
||||
if (!append_plugs(dsp))
|
||||
goto error;
|
||||
#elif defined(HAVE_DYLIB)
|
||||
#if !defined(HAVE_FILTERS_BUILTIN) && defined(HAVE_DYLIB)
|
||||
fill_pathname_basedir(basedir, filter_config, sizeof(basedir));
|
||||
|
||||
plugs = dir_list_new(basedir, EXT_EXECUTABLES, false);
|
||||
if (!plugs)
|
||||
goto error;
|
||||
|
||||
#endif
|
||||
if (!append_plugs(dsp, plugs))
|
||||
goto error;
|
||||
|
||||
string_list_free(plugs);
|
||||
if (plugs)
|
||||
string_list_free(plugs);
|
||||
plugs = NULL;
|
||||
#endif
|
||||
|
||||
if (!create_filter_graph(dsp, sample_rate))
|
||||
goto error;
|
||||
@ -251,7 +251,8 @@ rarch_dsp_filter_t *rarch_dsp_filter_new(
|
||||
return dsp;
|
||||
|
||||
error:
|
||||
string_list_free(plugs);
|
||||
if (plugs)
|
||||
string_list_free(plugs);
|
||||
rarch_dsp_filter_free(dsp);
|
||||
return NULL;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user