remove fluid_rvoice_dsp_t::dsp_buf

pass dsp_buf to interpolation functions directly
This commit is contained in:
derselbst 2018-04-11 22:14:18 +02:00
parent 9178eebf39
commit b95266cf6c
3 changed files with 15 additions and 21 deletions

View file

@ -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");

View file

@ -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);
/*

View file

@ -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 */