Reapply "make struct _fluid_ladspa_fx_t opaque" effects from 5afb1a854b

This commit is contained in:
Marcus Weseloh 2017-10-30 10:34:54 +01:00
parent 9f6ef4e67e
commit 4b2414761b
2 changed files with 110 additions and 109 deletions

View file

@ -31,6 +31,115 @@
#include "fluid_sys.h"
#include <dlfcn.h>
#include <math.h>
#include <ladspa.h>
#define FLUID_LADSPA_MAX_LIBS 100
#define FLUID_LADSPA_MAX_EFFECTS 100
#define FLUID_LADSPA_MAX_NODES 100
#define FLUID_LADSPA_MAX_PATH_LENGTH 512
typedef enum _fluid_ladspa_state_t {
FLUID_LADSPA_INACTIVE = 0,
FLUID_LADSPA_ACTIVE,
FLUID_LADSPA_RUNNING
} fluid_ladspa_state_t;
typedef enum _fluid_ladspa_dir_t {
FLUID_LADSPA_INPUT,
FLUID_LADSPA_OUTPUT,
} fluid_ladspa_dir_t;
typedef enum _fluid_ladspa_node_type_t {
FLUID_LADSPA_NODE_AUDIO = 1,
FLUID_LADSPA_NODE_CONTROL = 2,
FLUID_LADSPA_NODE_EFFECT = 4,
FLUID_LADSPA_NODE_HOST = 8,
FLUID_LADSPA_NODE_USER = 16,
} fluid_ladspa_node_type_t;
typedef struct _fluid_ladspa_lib_t
{
char *filename;
void *dlib;
LADSPA_Descriptor_Function descriptor;
} fluid_ladspa_lib_t;
typedef struct _fluid_ladspa_node_t
{
char *name;
fluid_ladspa_node_type_t type;
/* The buffer that LADSPA effects read and/or write to.
* If FluidSynth has been compiled WITH_FLOAT, then this
* points to the host buffer, otherwise it's a separate
* buffer. */
LADSPA_Data *effect_buffer;
/* Only set for host nodes, points to the host buffer */
fluid_real_t *host_buffer;
int num_inputs;
int num_outputs;
} fluid_ladspa_node_t;
typedef struct _fluid_ladspa_effect_t
{
char *name;
/* The descriptor defines the plugin implementation, the
* handle points to an instance of that plugin */
const LADSPA_Descriptor *desc;
LADSPA_Handle *handle;
int active;
/* Decides if we should call the run (mix = 0) or run_adding (mix = 1)
* plugin interface */
int mix;
/* Used to keep track of the port connection state */
fluid_ladspa_node_t **port_nodes;
} fluid_ladspa_effect_t;
struct _fluid_ladspa_fx_t
{
unsigned long sample_rate;
/* The buffer size for all audio buffers */
int buffer_size;
fluid_ladspa_lib_t *libs[FLUID_LADSPA_MAX_LIBS];
int num_libs;
fluid_ladspa_node_t *nodes[FLUID_LADSPA_MAX_NODES];
int num_nodes;
/* Pointers to host nodes in nodes array */
fluid_ladspa_node_t *host_nodes[FLUID_LADSPA_MAX_NODES];
int num_host_nodes;
/* Pointers to user audio nodes in nodes array */
fluid_ladspa_node_t *audio_nodes[FLUID_LADSPA_MAX_NODES];
int num_audio_nodes;
fluid_ladspa_effect_t *effects[FLUID_LADSPA_MAX_EFFECTS];
int num_effects;
fluid_rec_mutex_t api_mutex;
fluid_atomic_int_t state;
int pending_deactivation;
fluid_cond_mutex_t *run_finished_mutex;
fluid_cond_t *run_finished_cond;
};
#define LADSPA_API_ENTER(_fx) (fluid_rec_mutex_lock((_fx)->api_mutex))

View file

@ -28,116 +28,8 @@
#include "fluidsynth_priv.h"
#ifdef LADSPA
#include <ladspa.h>
#define FLUID_LADSPA_MAX_LIBS 100
#define FLUID_LADSPA_MAX_EFFECTS 100
#define FLUID_LADSPA_MAX_NODES 100
#define FLUID_LADSPA_MAX_PATH_LENGTH 512
typedef enum _fluid_ladspa_state_t {
FLUID_LADSPA_INACTIVE = 0,
FLUID_LADSPA_ACTIVE,
FLUID_LADSPA_RUNNING
} fluid_ladspa_state_t;
typedef enum _fluid_ladspa_dir_t {
FLUID_LADSPA_INPUT,
FLUID_LADSPA_OUTPUT,
} fluid_ladspa_dir_t;
typedef enum _fluid_ladspa_node_type_t {
FLUID_LADSPA_NODE_AUDIO = 1,
FLUID_LADSPA_NODE_CONTROL = 2,
FLUID_LADSPA_NODE_EFFECT = 4,
FLUID_LADSPA_NODE_HOST = 8,
FLUID_LADSPA_NODE_USER = 16,
} fluid_ladspa_node_type_t;
typedef struct _fluid_ladspa_lib_t
{
char *filename;
void *dlib;
LADSPA_Descriptor_Function descriptor;
} fluid_ladspa_lib_t;
typedef struct _fluid_ladspa_node_t
{
char *name;
fluid_ladspa_node_type_t type;
/* The buffer that LADSPA effects read and/or write to.
* If FluidSynth has been compiled WITH_FLOAT, then this
* points to the host buffer, otherwise it's a separate
* buffer. */
LADSPA_Data *effect_buffer;
/* Only set for host nodes, points to the host buffer */
fluid_real_t *host_buffer;
int num_inputs;
int num_outputs;
} fluid_ladspa_node_t;
typedef struct _fluid_ladspa_effect_t
{
char *name;
/* The descriptor defines the plugin implementation, the
* handle points to an instance of that plugin */
const LADSPA_Descriptor *desc;
LADSPA_Handle *handle;
int active;
/* Decides if we should call the run (mix = 0) or run_adding (mix = 1)
* plugin interface */
int mix;
/* Used to keep track of the port connection state */
fluid_ladspa_node_t **port_nodes;
} fluid_ladspa_effect_t;
typedef struct _fluid_ladspa_fx_t
{
unsigned long sample_rate;
/* The buffer size for all audio buffers */
int buffer_size;
fluid_ladspa_lib_t *libs[FLUID_LADSPA_MAX_LIBS];
int num_libs;
fluid_ladspa_node_t *nodes[FLUID_LADSPA_MAX_NODES];
int num_nodes;
/* Pointers to host nodes in nodes array */
fluid_ladspa_node_t *host_nodes[FLUID_LADSPA_MAX_NODES];
int num_host_nodes;
/* Pointers to user audio nodes in nodes array */
fluid_ladspa_node_t *audio_nodes[FLUID_LADSPA_MAX_NODES];
int num_audio_nodes;
fluid_ladspa_effect_t *effects[FLUID_LADSPA_MAX_EFFECTS];
int num_effects;
fluid_rec_mutex_t api_mutex;
fluid_atomic_int_t state;
int pending_deactivation;
fluid_cond_mutex_t *run_finished_mutex;
fluid_cond_t *run_finished_cond;
} fluid_ladspa_fx_t;
typedef struct _fluid_ladspa_fx_t fluid_ladspa_fx_t;
fluid_ladspa_fx_t *new_fluid_ladspa_fx(fluid_real_t sample_rate, int buffer_size);
void delete_fluid_ladspa_fx(fluid_ladspa_fx_t *fx);