mirror of
https://github.com/CTCaer/RetroArch.git
synced 2024-12-14 06:18:34 +00:00
Should fix audio filters regression
This commit is contained in:
parent
8d705844de
commit
10b1d121c6
@ -142,18 +142,13 @@ static const dspfilter_get_implementation_t dsp_plugs_builtin[] = {
|
||||
eq_dspfilter_get_implementation,
|
||||
chorus_dspfilter_get_implementation,
|
||||
};
|
||||
#endif
|
||||
|
||||
static bool append_plugs(rarch_dsp_filter_t *dsp, struct string_list *list)
|
||||
{
|
||||
unsigned i;
|
||||
dspfilter_simd_mask_t mask = retro_get_cpu_features();
|
||||
|
||||
(void)mask;
|
||||
(void)list;
|
||||
(void)i;
|
||||
|
||||
#if defined(HAVE_FILTERS_BUILTIN)
|
||||
|
||||
dsp->plugs = (struct rarch_dsp_plug*)
|
||||
calloc(ARRAY_SIZE(dsp_plugs_builtin), sizeof(*dsp->plugs));
|
||||
@ -168,20 +163,26 @@ static bool append_plugs(rarch_dsp_filter_t *dsp, struct string_list *list)
|
||||
if (!dsp->plugs[i].impl)
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
#elif defined(HAVE_DYLIB)
|
||||
static bool append_plugs(rarch_dsp_filter_t *dsp, struct string_list *list)
|
||||
{
|
||||
unsigned i;
|
||||
dspfilter_simd_mask_t mask = retro_get_cpu_features();
|
||||
|
||||
for (i = 0; i < list->size; i++)
|
||||
{
|
||||
dspfilter_get_implementation_t cb;
|
||||
const struct dspfilter_implementation *impl = NULL;
|
||||
struct rarch_dsp_plug *new_plugs = NULL;
|
||||
struct rarch_dsp_plug *new_plugs = NULL;
|
||||
dylib_t lib = dylib_load(list->elems[i].data);
|
||||
dspfilter_get_implementation_t cb;
|
||||
|
||||
if (!lib)
|
||||
continue;
|
||||
|
||||
cb = (dspfilter_get_implementation_t)
|
||||
dylib_proc(lib, "dspfilter_get_implementation");
|
||||
|
||||
cb = (dspfilter_get_implementation_t)dylib_proc(lib, "dspfilter_get_implementation");
|
||||
if (!cb)
|
||||
{
|
||||
dylib_close(lib);
|
||||
@ -210,36 +211,27 @@ static bool append_plugs(rarch_dsp_filter_t *dsp, struct string_list *list)
|
||||
}
|
||||
|
||||
/* Found plug. */
|
||||
dsp->plugs = new_plugs;
|
||||
dsp->plugs[dsp->num_plugs].lib = lib;
|
||||
|
||||
dsp->plugs = new_plugs;
|
||||
dsp->plugs[dsp->num_plugs].lib = lib;
|
||||
dsp->plugs[dsp->num_plugs].impl = impl;
|
||||
dsp->num_plugs++;
|
||||
}
|
||||
#endif
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
int allocate_plugs(struct string_list *plugs, const char *filter_config)
|
||||
{
|
||||
#if !defined(HAVE_FILTERS_BUILTIN) && defined(HAVE_DYLIB)
|
||||
char basedir[PATH_MAX_LENGTH];
|
||||
fill_pathname_basedir(basedir, filter_config, sizeof(basedir));
|
||||
|
||||
plugs = dir_list_new(basedir, EXT_EXECUTABLES, false, false);
|
||||
if (!plugs)
|
||||
return -1;
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
||||
rarch_dsp_filter_t *rarch_dsp_filter_new(
|
||||
const char *filter_config, float sample_rate)
|
||||
{
|
||||
char basedir[PATH_MAX_LENGTH] = {0};
|
||||
struct string_list *plugs = NULL;
|
||||
rarch_dsp_filter_t *dsp = (rarch_dsp_filter_t*)
|
||||
calloc(1, sizeof(*dsp));
|
||||
rarch_dsp_filter_t *dsp = NULL;
|
||||
|
||||
(void)basedir;
|
||||
|
||||
dsp = (rarch_dsp_filter_t*)calloc(1, sizeof(*dsp));
|
||||
if (!dsp)
|
||||
return NULL;
|
||||
|
||||
@ -247,11 +239,18 @@ rarch_dsp_filter_t *rarch_dsp_filter_new(
|
||||
if (!dsp->conf) /* Did not find config. */
|
||||
goto error;
|
||||
|
||||
if (allocate_plugs(plugs, filter_config) == -1)
|
||||
goto error;
|
||||
#if !defined(HAVE_FILTERS_BUILTIN) && defined(HAVE_DYLIB)
|
||||
fill_pathname_basedir(basedir, filter_config, sizeof(basedir));
|
||||
|
||||
plugs = dir_list_new(basedir, EXT_EXECUTABLES, false, false);
|
||||
if (!plugs)
|
||||
goto error;
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_DYLIB) || defined(HAVE_FILTERS_BUILTIN)
|
||||
if (!append_plugs(dsp, plugs))
|
||||
goto error;
|
||||
#endif
|
||||
|
||||
if (plugs)
|
||||
string_list_free(plugs);
|
||||
@ -318,4 +317,3 @@ void rarch_dsp_filter_process(rarch_dsp_filter_t *dsp,
|
||||
data->output = output.samples;
|
||||
data->output_frames = output.frames;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user