mirror of
https://github.com/ZDoom/fluidsynth.git
synced 2025-02-20 19:02:04 +00:00
Experimental and untested: enable LADSPA again. At least it compiles now.
This commit is contained in:
parent
9e0dda3ef3
commit
e00d5a1455
3 changed files with 58 additions and 13 deletions
|
@ -24,6 +24,7 @@
|
|||
#include "fluid_rev.h"
|
||||
#include "fluid_chorus.h"
|
||||
#include "fluidsynth_priv.h"
|
||||
#include "fluid_ladspa.h"
|
||||
|
||||
#define SYNTH_REVERB_CHANNEL 0
|
||||
#define SYNTH_CHORUS_CHANNEL 1
|
||||
|
@ -76,6 +77,10 @@ struct _fluid_rvoice_mixer_t {
|
|||
int active_voices; /**< Read-only: Number of non-null voices */
|
||||
int current_blockcount; /**< Read-only: how many blocks to process this time */
|
||||
|
||||
#ifdef LADSPA
|
||||
fluid_LADSPA_FxUnit_t* LADSPA_FxUnit; /**< Used by mixer only: Effects unit for LADSPA support. Never created or freed */
|
||||
#endif
|
||||
|
||||
#ifdef ENABLE_MIXER_THREADS
|
||||
// int sleeping_threads; /**< Atomic: number of threads currently asleep */
|
||||
// int active_threads; /**< Atomic: number of threads in the thread loop */
|
||||
|
@ -131,6 +136,38 @@ fluid_rvoice_mixer_process_fx(fluid_rvoice_mixer_t* mixer)
|
|||
}
|
||||
fluid_profile(FLUID_PROF_ONE_BLOCK_CHORUS, prof_ref);
|
||||
}
|
||||
|
||||
#ifdef LADSPA
|
||||
/* Run the signal through the LADSPA Fx unit */
|
||||
if (mixer->LADSPA_FxUnit) {
|
||||
int j;
|
||||
FLUID_DECLARE_VLA(fluid_real_t*, left_buf, mixer->buffers.buf_count);
|
||||
FLUID_DECLARE_VLA(fluid_real_t*, right_buf, mixer->buffers.buf_count);
|
||||
FLUID_DECLARE_VLA(fluid_real_t*, fx_left_buf, mixer->buffers.fx_buf_count);
|
||||
FLUID_DECLARE_VLA(fluid_real_t*, fx_right_buf, mixer->buffers.fx_buf_count);
|
||||
for (j=0; j < mixer->buffers.buf_count; j++) {
|
||||
left_buf[j] = mixer->buffers.left_buf[j];
|
||||
right_buf[j] = mixer->buffers.right_buf[j];
|
||||
}
|
||||
for (j=0; j < mixer->buffers.fx_buf_count; j++) {
|
||||
fx_left_buf[j] = mixer->buffers.fx_left_buf[j];
|
||||
fx_right_buf[j] = mixer->buffers.fx_right_buf[j];
|
||||
}
|
||||
for (i=0; i < mixer->current_blockcount * FLUID_BUFSIZE; i += FLUID_BUFSIZE) {
|
||||
fluid_LADSPA_run(mixer->LADSPA_FxUnit, left_buf, right_buf, fx_left_buf,
|
||||
fx_right_buf);
|
||||
for (j=0; j < mixer->buffers.buf_count; j++) {
|
||||
left_buf[j] += FLUID_BUFSIZE;
|
||||
right_buf[j] += FLUID_BUFSIZE;
|
||||
}
|
||||
for (j=0; j < mixer->buffers.fx_buf_count; j++) {
|
||||
fx_left_buf[j] += FLUID_BUFSIZE;
|
||||
fx_right_buf[j] += FLUID_BUFSIZE;
|
||||
}
|
||||
}
|
||||
fluid_check_fpe("LADSPA");
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -598,6 +635,14 @@ void delete_fluid_rvoice_mixer(fluid_rvoice_mixer_t* mixer)
|
|||
}
|
||||
|
||||
|
||||
#ifdef LADSPA
|
||||
void fluid_rvoice_mixer_set_ladspa(fluid_rvoice_mixer_t* mixer,
|
||||
fluid_LADSPA_FxUnit_t* ladspa)
|
||||
{
|
||||
mixer->LADSPA_FxUnit = ladspa;
|
||||
}
|
||||
#endif
|
||||
|
||||
void fluid_rvoice_mixer_set_reverb_enabled(fluid_rvoice_mixer_t* mixer, int on)
|
||||
{
|
||||
mixer->fx.with_reverb = on;
|
||||
|
|
|
@ -24,6 +24,7 @@
|
|||
|
||||
#include "fluidsynth_priv.h"
|
||||
#include "fluid_rvoice.h"
|
||||
#include "fluid_ladspa.h"
|
||||
|
||||
typedef struct _fluid_rvoice_mixer_t fluid_rvoice_mixer_t;
|
||||
|
||||
|
@ -60,6 +61,11 @@ void fluid_rvoice_mixer_reset_fx(fluid_rvoice_mixer_t* mixer);
|
|||
|
||||
void fluid_rvoice_mixer_set_threads(fluid_rvoice_mixer_t* mixer, int thread_count,
|
||||
int prio_level);
|
||||
|
||||
#ifdef LADSPA
|
||||
void fluid_rvoice_mixer_set_ladspa(fluid_rvoice_mixer_t* mixer,
|
||||
fluid_LADSPA_FxUnit_t* ladspa);
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
|
|
|
@ -684,11 +684,6 @@ new_fluid_synth(fluid_settings_t *settings)
|
|||
nbuf = synth->audio_groups;
|
||||
}
|
||||
|
||||
#ifdef LADSPA
|
||||
/* Create and initialize the Fx unit.*/
|
||||
synth->LADSPA_FxUnit = new_fluid_LADSPA_FxUnit(synth);
|
||||
#endif
|
||||
|
||||
/* as soon as the synth is created it starts playing. */
|
||||
synth->state = FLUID_SYNTH_PLAYING;
|
||||
synth->sfont_info = NULL;
|
||||
|
@ -706,7 +701,13 @@ new_fluid_synth(fluid_settings_t *settings)
|
|||
nbuf, synth->effects_channels);
|
||||
if (synth->eventhandler == NULL)
|
||||
goto error_recovery;
|
||||
|
||||
|
||||
#ifdef LADSPA
|
||||
/* Create and initialize the Fx unit.*/
|
||||
synth->LADSPA_FxUnit = new_fluid_LADSPA_FxUnit(synth);
|
||||
fluid_rvoice_mixer_set_ladspa(synth->eventhandler->mixer, synth->LADSPA_FxUnit);
|
||||
#endif
|
||||
|
||||
/* allocate and add the default sfont loader */
|
||||
loader = new_fluid_defsfloader();
|
||||
|
||||
|
@ -3296,13 +3297,6 @@ fluid_synth_render_blocks(fluid_synth_t* synth, int blockcount)
|
|||
// !do_not_mix_fx_to_out);
|
||||
blockcount = fluid_rvoice_mixer_render(synth->eventhandler->mixer, blockcount);
|
||||
|
||||
|
||||
#ifdef LADSPA
|
||||
/* Run the signal through the LADSPA Fx unit */
|
||||
fluid_LADSPA_run(synth->LADSPA_FxUnit, synth->left_buf, synth->right_buf, synth->fx_left_buf, synth->fx_right_buf);
|
||||
fluid_check_fpe("LADSPA");
|
||||
#endif
|
||||
|
||||
#if 0
|
||||
/* Signal return queue thread if there are any events pending */
|
||||
if (fluid_atomic_int_get (&synth->return_queue->count) > 0)
|
||||
|
|
Loading…
Reference in a new issue