Start making audio_dsp_filter.c no longer dependent on Rarch
headers
This commit is contained in:
parent
f246cc7b40
commit
830cadc01d
|
@ -22,6 +22,8 @@
|
|||
#include <audio/conversion/float_to_s16.h>
|
||||
#include <audio/conversion/s16_to_float.h>
|
||||
#include <audio/audio_resampler.h>
|
||||
#include <file/file_path.h>
|
||||
#include <lists/dir_list.h>
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "../config.h"
|
||||
|
@ -31,6 +33,7 @@
|
|||
#include "audio_dsp_filter.h"
|
||||
#include "audio_thread_wrapper.h"
|
||||
#include "../record/record_driver.h"
|
||||
#include "../frontend/frontend_driver.h"
|
||||
|
||||
#include "../command.h"
|
||||
#include "../driver.h"
|
||||
|
@ -716,9 +719,27 @@ void audio_driver_dsp_filter_free(void)
|
|||
|
||||
void audio_driver_dsp_filter_init(const char *device)
|
||||
{
|
||||
audio_driver_dsp = rarch_dsp_filter_new(
|
||||
device, audio_driver_input);
|
||||
#if defined(HAVE_DYLIB) && !defined(HAVE_FILTERS_BUILTIN)
|
||||
char basedir[PATH_MAX_LENGTH];
|
||||
char ext_name[PATH_MAX_LENGTH];
|
||||
#endif
|
||||
struct string_list *plugs = NULL;
|
||||
#if defined(HAVE_DYLIB) && !defined(HAVE_FILTERS_BUILTIN)
|
||||
fill_pathname_basedir(basedir, device, sizeof(basedir));
|
||||
|
||||
if (!frontend_driver_get_core_extension(ext_name, sizeof(ext_name)))
|
||||
goto error;
|
||||
|
||||
plugs = dir_list_new(basedir, ext_name, false, true, false, false);
|
||||
if (!plugs)
|
||||
goto error;
|
||||
#endif
|
||||
audio_driver_dsp = rarch_dsp_filter_new(
|
||||
device, plugs, audio_driver_input);
|
||||
|
||||
return;
|
||||
|
||||
error:
|
||||
if (!audio_driver_dsp)
|
||||
RARCH_ERR("[DSP]: Failed to initialize DSP filter \"%s\".\n", device);
|
||||
}
|
||||
|
|
|
@ -23,16 +23,13 @@
|
|||
|
||||
#include <file/file_path.h>
|
||||
#include <file/config_file_userdata.h>
|
||||
#include <lists/dir_list.h>
|
||||
#include <features/features_cpu.h>
|
||||
#include <lists/string_list.h>
|
||||
#include <string/stdstring.h>
|
||||
|
||||
#include "audio_dsp_filter.h"
|
||||
#include "audio_filters/dspfilter.h"
|
||||
|
||||
#include "../frontend/frontend_driver.h"
|
||||
#include "../performance_counters.h"
|
||||
|
||||
struct rarch_dsp_plug
|
||||
{
|
||||
#ifdef HAVE_DYLIB
|
||||
|
@ -151,15 +148,14 @@ static const dspfilter_get_implementation_t dsp_plugs_builtin[] = {
|
|||
static bool append_plugs(rarch_dsp_filter_t *dsp, struct string_list *list)
|
||||
{
|
||||
unsigned i;
|
||||
dspfilter_simd_mask_t mask = cpu_features_get();
|
||||
dspfilter_simd_mask_t mask = cpu_features_get();
|
||||
struct rarch_dsp_plug *plugs = (struct rarch_dsp_plug*)
|
||||
calloc(ARRAY_SIZE(dsp_plugs_builtin), sizeof(*plugs));
|
||||
|
||||
(void)list;
|
||||
|
||||
dsp->plugs = (struct rarch_dsp_plug*)
|
||||
calloc(ARRAY_SIZE(dsp_plugs_builtin), sizeof(*dsp->plugs));
|
||||
if (!dsp->plugs)
|
||||
if (!plugs)
|
||||
return false;
|
||||
|
||||
dsp->plugs = plugs;
|
||||
dsp->num_plugs = ARRAY_SIZE(dsp_plugs_builtin);
|
||||
|
||||
for (i = 0; i < ARRAY_SIZE(dsp_plugs_builtin); i++)
|
||||
|
@ -229,12 +225,10 @@ static bool append_plugs(rarch_dsp_filter_t *dsp, struct string_list *list)
|
|||
#endif
|
||||
|
||||
rarch_dsp_filter_t *rarch_dsp_filter_new(
|
||||
const char *filter_config, float sample_rate)
|
||||
const char *filter_config,
|
||||
void *string_data,
|
||||
float sample_rate)
|
||||
{
|
||||
#if !defined(HAVE_FILTERS_BUILTIN) && defined(HAVE_DYLIB)
|
||||
char basedir[PATH_MAX_LENGTH];
|
||||
char ext_name[PATH_MAX_LENGTH];
|
||||
#endif
|
||||
config_file_t *conf = NULL;
|
||||
struct string_list *plugs = NULL;
|
||||
rarch_dsp_filter_t *dsp = (rarch_dsp_filter_t*)calloc(1, sizeof(*dsp));
|
||||
|
@ -248,16 +242,8 @@ rarch_dsp_filter_t *rarch_dsp_filter_new(
|
|||
|
||||
dsp->conf = conf;
|
||||
|
||||
#if !defined(HAVE_FILTERS_BUILTIN) && defined(HAVE_DYLIB)
|
||||
fill_pathname_basedir(basedir, filter_config, sizeof(basedir));
|
||||
|
||||
if (!frontend_driver_get_core_extension(ext_name, sizeof(ext_name)))
|
||||
goto error;
|
||||
|
||||
plugs = dir_list_new(basedir, ext_name, false, true, false, false);
|
||||
if (!plugs)
|
||||
goto error;
|
||||
#endif
|
||||
if (string_data)
|
||||
plugs = (struct string_list*)string_data;
|
||||
|
||||
#if defined(HAVE_DYLIB) || defined(HAVE_FILTERS_BUILTIN)
|
||||
if (!append_plugs(dsp, plugs))
|
||||
|
|
|
@ -24,7 +24,7 @@ RETRO_BEGIN_DECLS
|
|||
typedef struct rarch_dsp_filter rarch_dsp_filter_t;
|
||||
|
||||
rarch_dsp_filter_t *rarch_dsp_filter_new(const char *filter_config,
|
||||
float sample_rate);
|
||||
void *string_data, float sample_rate);
|
||||
|
||||
void rarch_dsp_filter_free(rarch_dsp_filter_t *dsp);
|
||||
|
||||
|
|
Loading…
Reference in New Issue