From b95266cf6ce2dcc3ff7de841e05419f0f46445a3 Mon Sep 17 00:00:00 2001 From: derselbst Date: Wed, 11 Apr 2018 22:14:18 +0200 Subject: [PATCH] remove fluid_rvoice_dsp_t::dsp_buf pass dsp_buf to interpolation functions directly --- src/rvoice/fluid_rvoice.c | 9 ++++----- src/rvoice/fluid_rvoice.h | 9 ++++----- src/rvoice/fluid_rvoice_dsp.c | 18 +++++++----------- 3 files changed, 15 insertions(+), 21 deletions(-) diff --git a/src/rvoice/fluid_rvoice.c b/src/rvoice/fluid_rvoice.c index 6cddcc77..e22c8af1 100644 --- a/src/rvoice/fluid_rvoice.c +++ b/src/rvoice/fluid_rvoice.c @@ -367,22 +367,21 @@ fluid_rvoice_write (fluid_rvoice_t* voice, fluid_real_t *dsp_buf) * The buffer has to be filled from 0 to FLUID_BUFSIZE-1. * Depending on the position in the loop and the loop size, this * may require several runs. */ - voice->dsp.dsp_buf = dsp_buf; switch (voice->dsp.interp_method) { case FLUID_INTERP_NONE: - count = fluid_rvoice_dsp_interpolate_none (&voice->dsp); + count = fluid_rvoice_dsp_interpolate_none (&voice->dsp, dsp_buf); break; case FLUID_INTERP_LINEAR: - count = fluid_rvoice_dsp_interpolate_linear (&voice->dsp); + count = fluid_rvoice_dsp_interpolate_linear (&voice->dsp, dsp_buf); break; case FLUID_INTERP_4THORDER: default: - count = fluid_rvoice_dsp_interpolate_4th_order (&voice->dsp); + count = fluid_rvoice_dsp_interpolate_4th_order (&voice->dsp, dsp_buf); break; case FLUID_INTERP_7THORDER: - count = fluid_rvoice_dsp_interpolate_7th_order (&voice->dsp); + count = fluid_rvoice_dsp_interpolate_7th_order (&voice->dsp, dsp_buf); break; } fluid_check_fpe ("voice_write interpolation"); diff --git a/src/rvoice/fluid_rvoice.h b/src/rvoice/fluid_rvoice.h index f544a418..29fac833 100644 --- a/src/rvoice/fluid_rvoice.h +++ b/src/rvoice/fluid_rvoice.h @@ -121,7 +121,6 @@ struct _fluid_rvoice_dsp_t /* Dynamic input to the interpolator below */ - fluid_real_t *dsp_buf; /* buffer to store interpolated sample data to */ fluid_real_t amp; /* current linear amplitude */ fluid_real_t amp_incr; /* amplitude increment value for the next FLUID_BUFSIZE samples */ @@ -194,10 +193,10 @@ DECLARE_FLUID_RVOICE_FUNCTION(fluid_rvoice_set_sample); /* defined in fluid_rvoice_dsp.c */ void fluid_rvoice_dsp_config (void); -int fluid_rvoice_dsp_interpolate_none (fluid_rvoice_dsp_t *voice); -int fluid_rvoice_dsp_interpolate_linear (fluid_rvoice_dsp_t *voice); -int fluid_rvoice_dsp_interpolate_4th_order (fluid_rvoice_dsp_t *voice); -int fluid_rvoice_dsp_interpolate_7th_order (fluid_rvoice_dsp_t *voice); +int fluid_rvoice_dsp_interpolate_none (fluid_rvoice_dsp_t *voice, fluid_real_t *FLUID_RESTRICT dsp_buf); +int fluid_rvoice_dsp_interpolate_linear (fluid_rvoice_dsp_t *voice, fluid_real_t *FLUID_RESTRICT dsp_buf); +int fluid_rvoice_dsp_interpolate_4th_order (fluid_rvoice_dsp_t *voice, fluid_real_t *FLUID_RESTRICT dsp_buf); +int fluid_rvoice_dsp_interpolate_7th_order (fluid_rvoice_dsp_t *voice, fluid_real_t *FLUID_RESTRICT dsp_buf); /* diff --git a/src/rvoice/fluid_rvoice_dsp.c b/src/rvoice/fluid_rvoice_dsp.c index 8275b11e..65d7ace5 100644 --- a/src/rvoice/fluid_rvoice_dsp.c +++ b/src/rvoice/fluid_rvoice_dsp.c @@ -130,13 +130,12 @@ fluid_rvoice_get_float_sample(const short int* dsp_msb, const char* dsp_lsb, uns * the playback pointer. Questionable quality, but very * efficient. */ int -fluid_rvoice_dsp_interpolate_none (fluid_rvoice_dsp_t *voice) +fluid_rvoice_dsp_interpolate_none (fluid_rvoice_dsp_t *voice, fluid_real_t *FLUID_RESTRICT dsp_buf) { fluid_phase_t dsp_phase = voice->phase; fluid_phase_t dsp_phase_incr; short int *dsp_data = voice->sample->data; char *dsp_data24 = voice->sample->data24; - fluid_real_t *dsp_buf = voice->dsp_buf; fluid_real_t dsp_amp = voice->amp; fluid_real_t dsp_amp_incr = voice->amp_incr; unsigned int dsp_i = 0; @@ -192,20 +191,19 @@ fluid_rvoice_dsp_interpolate_none (fluid_rvoice_dsp_t *voice) * smaller if end of sample occurs). */ int -fluid_rvoice_dsp_interpolate_linear (fluid_rvoice_dsp_t *voice) +fluid_rvoice_dsp_interpolate_linear (fluid_rvoice_dsp_t *voice, fluid_real_t *FLUID_RESTRICT dsp_buf) { fluid_phase_t dsp_phase = voice->phase; fluid_phase_t dsp_phase_incr; short int *dsp_data = voice->sample->data; char *dsp_data24 = voice->sample->data24; - fluid_real_t *dsp_buf = voice->dsp_buf; fluid_real_t dsp_amp = voice->amp; fluid_real_t dsp_amp_incr = voice->amp_incr; unsigned int dsp_i = 0; unsigned int dsp_phase_index; unsigned int end_index; fluid_real_t point; - fluid_real_t *coeffs; + const fluid_real_t *FLUID_RESTRICT coeffs; int looping; /* Convert playback "speed" floating point value to phase index/fract */ @@ -282,20 +280,19 @@ fluid_rvoice_dsp_interpolate_linear (fluid_rvoice_dsp_t *voice) * smaller if end of sample occurs). */ int -fluid_rvoice_dsp_interpolate_4th_order (fluid_rvoice_dsp_t *voice) +fluid_rvoice_dsp_interpolate_4th_order (fluid_rvoice_dsp_t *voice, fluid_real_t *FLUID_RESTRICT dsp_buf) { fluid_phase_t dsp_phase = voice->phase; fluid_phase_t dsp_phase_incr; short int *dsp_data = voice->sample->data; char *dsp_data24 = voice->sample->data24; - fluid_real_t *dsp_buf = voice->dsp_buf; fluid_real_t dsp_amp = voice->amp; fluid_real_t dsp_amp_incr = voice->amp_incr; unsigned int dsp_i = 0; unsigned int dsp_phase_index; unsigned int start_index, end_index; fluid_real_t start_point, end_point1, end_point2; - fluid_real_t *coeffs; + const fluid_real_t *FLUID_RESTRICT coeffs; int looping; /* Convert playback "speed" floating point value to phase index/fract */ @@ -437,20 +434,19 @@ fluid_rvoice_dsp_interpolate_4th_order (fluid_rvoice_dsp_t *voice) * smaller if end of sample occurs). */ int -fluid_rvoice_dsp_interpolate_7th_order (fluid_rvoice_dsp_t *voice) +fluid_rvoice_dsp_interpolate_7th_order (fluid_rvoice_dsp_t *voice, fluid_real_t *FLUID_RESTRICT dsp_buf) { fluid_phase_t dsp_phase = voice->phase; fluid_phase_t dsp_phase_incr; short int *dsp_data = voice->sample->data; char *dsp_data24 = voice->sample->data24; - fluid_real_t *dsp_buf = voice->dsp_buf; fluid_real_t dsp_amp = voice->amp; fluid_real_t dsp_amp_incr = voice->amp_incr; unsigned int dsp_i = 0; unsigned int dsp_phase_index; unsigned int start_index, end_index; fluid_real_t start_points[3], end_points[3]; - fluid_real_t *coeffs; + const fluid_real_t *FLUID_RESTRICT coeffs; int looping; /* Convert playback "speed" floating point value to phase index/fract */