mirror of
https://github.com/libretro/RetroArch.git
synced 2024-11-24 00:20:01 +00:00
Add builtin crap for DSP plugs.
This commit is contained in:
parent
0e85445420
commit
7aaa0c254f
@ -220,7 +220,33 @@ static bool create_filter_graph(rarch_dsp_filter_t *dsp, float sample_rate)
|
||||
return true;
|
||||
}
|
||||
|
||||
#ifdef HAVE_DYLIB
|
||||
#if defined(HAVE_FILTERS_BUILTIN)
|
||||
extern const struct dspfilter_implementation *panning_dspfilter_get_implementation(dspfilter_simd_mask_t mask);
|
||||
|
||||
static const dspfilter_get_implementation_t dsp_plugs_builtin[] = {
|
||||
panning_dspfilter_get_implementation,
|
||||
};
|
||||
|
||||
static bool append_plugs(rarch_dsp_filter_t *dsp)
|
||||
{
|
||||
unsigned i;
|
||||
dspfilter_simd_mask_t mask = rarch_get_cpu_features();
|
||||
|
||||
dsp->plugs = (struct rarch_dsp_plug*)calloc(ARRAY_SIZE(dsp_plugs_builtin), sizeof(*dsp->plugs));
|
||||
if (!dsp->plugs)
|
||||
return false;
|
||||
dsp->num_plugs = ARRAY_SIZE(dsp_plugs_builtin);
|
||||
|
||||
for (i = 0; i < ARRAY_SIZE(dsp_plugs_builtin); i++)
|
||||
{
|
||||
dsp->plugs[i].impl = dsp_plugs_builtin[i](mask);
|
||||
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;
|
||||
@ -269,13 +295,13 @@ static bool append_plugs(rarch_dsp_filter_t *dsp, struct string_list *list)
|
||||
|
||||
return true;
|
||||
}
|
||||
#else
|
||||
// Append from built-in filters.
|
||||
#endif
|
||||
|
||||
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 = (rarch_dsp_filter_t*)calloc(1, sizeof(*dsp));
|
||||
@ -289,7 +315,10 @@ rarch_dsp_filter_t *rarch_dsp_filter_new(const char *filter_config, float sample
|
||||
goto error;
|
||||
}
|
||||
|
||||
#ifdef HAVE_DYLIB
|
||||
#if defined(HAVE_FILTERS_BUILTIN)
|
||||
if (!append_plugs(dsp))
|
||||
goto error;
|
||||
#elif defined(HAVE_DYLIB)
|
||||
fill_pathname_basedir(basedir, filter_config, sizeof(basedir));
|
||||
|
||||
plugs = dir_list_new(basedir, EXT_EXECUTABLES, false);
|
||||
@ -301,9 +330,6 @@ rarch_dsp_filter_t *rarch_dsp_filter_new(const char *filter_config, float sample
|
||||
|
||||
string_list_free(plugs);
|
||||
plugs = NULL;
|
||||
#else
|
||||
if (!append_plugs(dsp))
|
||||
goto error;
|
||||
#endif
|
||||
|
||||
if (!create_filter_graph(dsp, sample_rate))
|
||||
@ -332,7 +358,10 @@ void rarch_dsp_filter_free(rarch_dsp_filter_t *dsp)
|
||||
|
||||
#ifdef HAVE_DYLIB
|
||||
for (i = 0; i < dsp->num_plugs; i++)
|
||||
dylib_close(dsp->plugs[i].lib);
|
||||
{
|
||||
if (dsp->plugs[i].lib)
|
||||
dylib_close(dsp->plugs[i].lib);
|
||||
}
|
||||
free(dsp->plugs);
|
||||
#endif
|
||||
|
||||
|
@ -91,9 +91,15 @@ static const struct dspfilter_implementation panning = {
|
||||
"panning",
|
||||
};
|
||||
|
||||
#ifdef HAVE_FILTERS_BUILTIN
|
||||
#define dspfilter_get_implementation panning_dspfilter_get_implementation
|
||||
#endif
|
||||
|
||||
const struct dspfilter_implementation *dspfilter_get_implementation(dspfilter_simd_mask_t mask)
|
||||
{
|
||||
(void)mask;
|
||||
return &panning;
|
||||
}
|
||||
|
||||
#undef dspfilter_get_implementation
|
||||
|
||||
|
2
driver.h
2
driver.h
@ -709,8 +709,6 @@ extern const struct softfilter_implementation *supertwoxsai_get_implementation(s
|
||||
extern const struct softfilter_implementation *twoxbr_get_implementation(softfilter_simd_mask_t simd);
|
||||
extern const struct softfilter_implementation *darken_get_implementation(softfilter_simd_mask_t simd);
|
||||
extern const struct softfilter_implementation *scale2x_get_implementation(softfilter_simd_mask_t simd);
|
||||
|
||||
// TODO: DSP plugs.
|
||||
#endif
|
||||
|
||||
#include "driver_funcs.h"
|
||||
|
@ -485,7 +485,7 @@ FILTERS
|
||||
#include "../gfx/filters/lq2x.c"
|
||||
#include "../gfx/filters/phosphor2x.c"
|
||||
|
||||
// TODO: Audio plugs.
|
||||
#include "../audio/filters/panning.c"
|
||||
#endif
|
||||
/*============================================================
|
||||
DYNAMIC
|
||||
|
Loading…
Reference in New Issue
Block a user