mirror of
https://github.com/ZDoom/fluidsynth.git
synced 2024-12-01 00:21:14 +00:00
add 24bit sample support to rvoice_dsp interpolation functions
This commit is contained in:
parent
7de0e02a82
commit
9a21e10e10
1 changed files with 109 additions and 81 deletions
|
@ -119,6 +119,27 @@ void fluid_rvoice_dsp_config (void)
|
||||||
fluid_check_fpe("interpolation table calculation");
|
fluid_check_fpe("interpolation table calculation");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Combines the most significant 16 bit part of a sample with a potentially present
|
||||||
|
* least sig. 8 bit part in order to create a 24 bit sample.
|
||||||
|
*/
|
||||||
|
static int32_t fluid_rvoice_get_sample(const short int* dsp_msb, const char* dsp_lsb, unsigned int idx)
|
||||||
|
{
|
||||||
|
/* cast sample to unsigned type, so we can safely shift and bitwise or
|
||||||
|
* without relying on undefined behaviour (should never happen anyway ofc...) */
|
||||||
|
uint32_t msb = (uint32_t)dsp_msb[idx];
|
||||||
|
uint8_t lsb = 0U;
|
||||||
|
|
||||||
|
/* most soundfonts have 16 bit samples, assume that it's unlikely we
|
||||||
|
* experience 24 bit samples here */
|
||||||
|
if(G_UNLIKELY(dsp_lsb != NULL))
|
||||||
|
{
|
||||||
|
lsb = (uint8_t)dsp_lsb[idx];
|
||||||
|
}
|
||||||
|
|
||||||
|
return (int32_t)((msb << 8) | lsb);
|
||||||
|
}
|
||||||
|
|
||||||
/* No interpolation. Just take the sample, which is closest to
|
/* No interpolation. Just take the sample, which is closest to
|
||||||
* the playback pointer. Questionable quality, but very
|
* the playback pointer. Questionable quality, but very
|
||||||
* efficient. */
|
* efficient. */
|
||||||
|
@ -128,6 +149,7 @@ fluid_rvoice_dsp_interpolate_none (fluid_rvoice_dsp_t *voice)
|
||||||
fluid_phase_t dsp_phase = voice->phase;
|
fluid_phase_t dsp_phase = voice->phase;
|
||||||
fluid_phase_t dsp_phase_incr;
|
fluid_phase_t dsp_phase_incr;
|
||||||
short int *dsp_data = voice->sample->data;
|
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_buf = voice->dsp_buf;
|
||||||
fluid_real_t dsp_amp = voice->amp;
|
fluid_real_t dsp_amp = voice->amp;
|
||||||
fluid_real_t dsp_amp_incr = voice->amp_incr;
|
fluid_real_t dsp_amp_incr = voice->amp_incr;
|
||||||
|
@ -151,7 +173,7 @@ fluid_rvoice_dsp_interpolate_none (fluid_rvoice_dsp_t *voice)
|
||||||
/* interpolate sequence of sample points */
|
/* interpolate sequence of sample points */
|
||||||
for ( ; dsp_i < FLUID_BUFSIZE && dsp_phase_index <= end_index; dsp_i++)
|
for ( ; dsp_i < FLUID_BUFSIZE && dsp_phase_index <= end_index; dsp_i++)
|
||||||
{
|
{
|
||||||
dsp_buf[dsp_i] = dsp_amp * dsp_data[dsp_phase_index];
|
dsp_buf[dsp_i] = dsp_amp * fluid_rvoice_get_sample(dsp_data, dsp_data24, dsp_phase_index);
|
||||||
|
|
||||||
/* increment phase and amplitude */
|
/* increment phase and amplitude */
|
||||||
fluid_phase_incr (dsp_phase, dsp_phase_incr);
|
fluid_phase_incr (dsp_phase, dsp_phase_incr);
|
||||||
|
@ -189,13 +211,14 @@ fluid_rvoice_dsp_interpolate_linear (fluid_rvoice_dsp_t *voice)
|
||||||
fluid_phase_t dsp_phase = voice->phase;
|
fluid_phase_t dsp_phase = voice->phase;
|
||||||
fluid_phase_t dsp_phase_incr;
|
fluid_phase_t dsp_phase_incr;
|
||||||
short int *dsp_data = voice->sample->data;
|
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_buf = voice->dsp_buf;
|
||||||
fluid_real_t dsp_amp = voice->amp;
|
fluid_real_t dsp_amp = voice->amp;
|
||||||
fluid_real_t dsp_amp_incr = voice->amp_incr;
|
fluid_real_t dsp_amp_incr = voice->amp_incr;
|
||||||
unsigned int dsp_i = 0;
|
unsigned int dsp_i = 0;
|
||||||
unsigned int dsp_phase_index;
|
unsigned int dsp_phase_index;
|
||||||
unsigned int end_index;
|
unsigned int end_index;
|
||||||
short int point;
|
int32_t point;
|
||||||
fluid_real_t *coeffs;
|
fluid_real_t *coeffs;
|
||||||
int looping;
|
int looping;
|
||||||
|
|
||||||
|
@ -209,8 +232,8 @@ fluid_rvoice_dsp_interpolate_linear (fluid_rvoice_dsp_t *voice)
|
||||||
end_index = (looping ? voice->loopend - 1 : voice->end) - 1;
|
end_index = (looping ? voice->loopend - 1 : voice->end) - 1;
|
||||||
|
|
||||||
/* 2nd interpolation point to use at end of loop or sample */
|
/* 2nd interpolation point to use at end of loop or sample */
|
||||||
if (looping) point = dsp_data[voice->loopstart]; /* loop start */
|
if (looping) point = fluid_rvoice_get_sample(dsp_data, dsp_data24, voice->loopstart); /* loop start */
|
||||||
else point = dsp_data[voice->end]; /* duplicate end for samples no longer looping */
|
else point = fluid_rvoice_get_sample(dsp_data, dsp_data24, voice->end); /* duplicate end for samples no longer looping */
|
||||||
|
|
||||||
while (1)
|
while (1)
|
||||||
{
|
{
|
||||||
|
@ -220,8 +243,8 @@ fluid_rvoice_dsp_interpolate_linear (fluid_rvoice_dsp_t *voice)
|
||||||
for ( ; dsp_i < FLUID_BUFSIZE && dsp_phase_index <= end_index; dsp_i++)
|
for ( ; dsp_i < FLUID_BUFSIZE && dsp_phase_index <= end_index; dsp_i++)
|
||||||
{
|
{
|
||||||
coeffs = interp_coeff_linear[fluid_phase_fract_to_tablerow (dsp_phase)];
|
coeffs = interp_coeff_linear[fluid_phase_fract_to_tablerow (dsp_phase)];
|
||||||
dsp_buf[dsp_i] = dsp_amp * (coeffs[0] * dsp_data[dsp_phase_index]
|
dsp_buf[dsp_i] = dsp_amp * (coeffs[0] * fluid_rvoice_get_sample(dsp_data, dsp_data24, dsp_phase_index)
|
||||||
+ coeffs[1] * dsp_data[dsp_phase_index+1]);
|
+ coeffs[1] * fluid_rvoice_get_sample(dsp_data, dsp_data24, dsp_phase_index+1));
|
||||||
|
|
||||||
/* increment phase and amplitude */
|
/* increment phase and amplitude */
|
||||||
fluid_phase_incr (dsp_phase, dsp_phase_incr);
|
fluid_phase_incr (dsp_phase, dsp_phase_incr);
|
||||||
|
@ -238,8 +261,8 @@ fluid_rvoice_dsp_interpolate_linear (fluid_rvoice_dsp_t *voice)
|
||||||
for (; dsp_phase_index <= end_index && dsp_i < FLUID_BUFSIZE; dsp_i++)
|
for (; dsp_phase_index <= end_index && dsp_i < FLUID_BUFSIZE; dsp_i++)
|
||||||
{
|
{
|
||||||
coeffs = interp_coeff_linear[fluid_phase_fract_to_tablerow (dsp_phase)];
|
coeffs = interp_coeff_linear[fluid_phase_fract_to_tablerow (dsp_phase)];
|
||||||
dsp_buf[dsp_i] = dsp_amp * (coeffs[0] * dsp_data[dsp_phase_index]
|
dsp_buf[dsp_i] = dsp_amp * (coeffs[0] * fluid_rvoice_get_sample(dsp_data, dsp_data24, dsp_phase_index)
|
||||||
+ coeffs[1] * point);
|
+ coeffs[1] * point);
|
||||||
|
|
||||||
/* increment phase and amplitude */
|
/* increment phase and amplitude */
|
||||||
fluid_phase_incr (dsp_phase, dsp_phase_incr);
|
fluid_phase_incr (dsp_phase, dsp_phase_incr);
|
||||||
|
@ -278,13 +301,14 @@ fluid_rvoice_dsp_interpolate_4th_order (fluid_rvoice_dsp_t *voice)
|
||||||
fluid_phase_t dsp_phase = voice->phase;
|
fluid_phase_t dsp_phase = voice->phase;
|
||||||
fluid_phase_t dsp_phase_incr;
|
fluid_phase_t dsp_phase_incr;
|
||||||
short int *dsp_data = voice->sample->data;
|
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_buf = voice->dsp_buf;
|
||||||
fluid_real_t dsp_amp = voice->amp;
|
fluid_real_t dsp_amp = voice->amp;
|
||||||
fluid_real_t dsp_amp_incr = voice->amp_incr;
|
fluid_real_t dsp_amp_incr = voice->amp_incr;
|
||||||
unsigned int dsp_i = 0;
|
unsigned int dsp_i = 0;
|
||||||
unsigned int dsp_phase_index;
|
unsigned int dsp_phase_index;
|
||||||
unsigned int start_index, end_index;
|
unsigned int start_index, end_index;
|
||||||
short int start_point, end_point1, end_point2;
|
int32_t start_point, end_point1, end_point2;
|
||||||
fluid_real_t *coeffs;
|
fluid_real_t *coeffs;
|
||||||
int looping;
|
int looping;
|
||||||
|
|
||||||
|
@ -300,23 +324,23 @@ fluid_rvoice_dsp_interpolate_4th_order (fluid_rvoice_dsp_t *voice)
|
||||||
if (voice->has_looped) /* set start_index and start point if looped or not */
|
if (voice->has_looped) /* set start_index and start point if looped or not */
|
||||||
{
|
{
|
||||||
start_index = voice->loopstart;
|
start_index = voice->loopstart;
|
||||||
start_point = dsp_data[voice->loopend - 1]; /* last point in loop (wrap around) */
|
start_point = fluid_rvoice_get_sample(dsp_data, dsp_data24, voice->loopend - 1); /* last point in loop (wrap around) */
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
start_index = voice->start;
|
start_index = voice->start;
|
||||||
start_point = dsp_data[voice->start]; /* just duplicate the point */
|
start_point = fluid_rvoice_get_sample(dsp_data, dsp_data24, voice->start); /* just duplicate the point */
|
||||||
}
|
}
|
||||||
|
|
||||||
/* get points off the end (loop start if looping, duplicate point if end) */
|
/* get points off the end (loop start if looping, duplicate point if end) */
|
||||||
if (looping)
|
if (looping)
|
||||||
{
|
{
|
||||||
end_point1 = dsp_data[voice->loopstart];
|
end_point1 = fluid_rvoice_get_sample(dsp_data, dsp_data24, voice->loopstart);
|
||||||
end_point2 = dsp_data[voice->loopstart + 1];
|
end_point2 = fluid_rvoice_get_sample(dsp_data, dsp_data24, voice->loopstart + 1);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
end_point1 = dsp_data[voice->end];
|
end_point1 = fluid_rvoice_get_sample(dsp_data, dsp_data24, voice->end);
|
||||||
end_point2 = end_point1;
|
end_point2 = end_point1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -328,10 +352,11 @@ fluid_rvoice_dsp_interpolate_4th_order (fluid_rvoice_dsp_t *voice)
|
||||||
for ( ; dsp_phase_index == start_index && dsp_i < FLUID_BUFSIZE; dsp_i++)
|
for ( ; dsp_phase_index == start_index && dsp_i < FLUID_BUFSIZE; dsp_i++)
|
||||||
{
|
{
|
||||||
coeffs = interp_coeff[fluid_phase_fract_to_tablerow (dsp_phase)];
|
coeffs = interp_coeff[fluid_phase_fract_to_tablerow (dsp_phase)];
|
||||||
dsp_buf[dsp_i] = dsp_amp * (coeffs[0] * start_point
|
dsp_buf[dsp_i] = dsp_amp *
|
||||||
+ coeffs[1] * dsp_data[dsp_phase_index]
|
( coeffs[0] * start_point
|
||||||
+ coeffs[2] * dsp_data[dsp_phase_index+1]
|
+ coeffs[1] * fluid_rvoice_get_sample(dsp_data, dsp_data24, dsp_phase_index)
|
||||||
+ coeffs[3] * dsp_data[dsp_phase_index+2]);
|
+ coeffs[2] * fluid_rvoice_get_sample(dsp_data, dsp_data24, dsp_phase_index+1)
|
||||||
|
+ coeffs[3] * fluid_rvoice_get_sample(dsp_data, dsp_data24, dsp_phase_index+2));
|
||||||
|
|
||||||
/* increment phase and amplitude */
|
/* increment phase and amplitude */
|
||||||
fluid_phase_incr (dsp_phase, dsp_phase_incr);
|
fluid_phase_incr (dsp_phase, dsp_phase_incr);
|
||||||
|
@ -343,10 +368,11 @@ fluid_rvoice_dsp_interpolate_4th_order (fluid_rvoice_dsp_t *voice)
|
||||||
for ( ; dsp_i < FLUID_BUFSIZE && dsp_phase_index <= end_index; dsp_i++)
|
for ( ; dsp_i < FLUID_BUFSIZE && dsp_phase_index <= end_index; dsp_i++)
|
||||||
{
|
{
|
||||||
coeffs = interp_coeff[fluid_phase_fract_to_tablerow (dsp_phase)];
|
coeffs = interp_coeff[fluid_phase_fract_to_tablerow (dsp_phase)];
|
||||||
dsp_buf[dsp_i] = dsp_amp * (coeffs[0] * dsp_data[dsp_phase_index-1]
|
dsp_buf[dsp_i] = dsp_amp *
|
||||||
+ coeffs[1] * dsp_data[dsp_phase_index]
|
( coeffs[0] * fluid_rvoice_get_sample(dsp_data, dsp_data24, dsp_phase_index-1)
|
||||||
+ coeffs[2] * dsp_data[dsp_phase_index+1]
|
+ coeffs[1] * fluid_rvoice_get_sample(dsp_data, dsp_data24, dsp_phase_index)
|
||||||
+ coeffs[3] * dsp_data[dsp_phase_index+2]);
|
+ coeffs[2] * fluid_rvoice_get_sample(dsp_data, dsp_data24, dsp_phase_index+1)
|
||||||
|
+ coeffs[3] * fluid_rvoice_get_sample(dsp_data, dsp_data24, dsp_phase_index+2));
|
||||||
|
|
||||||
/* increment phase and amplitude */
|
/* increment phase and amplitude */
|
||||||
fluid_phase_incr (dsp_phase, dsp_phase_incr);
|
fluid_phase_incr (dsp_phase, dsp_phase_incr);
|
||||||
|
@ -363,10 +389,11 @@ fluid_rvoice_dsp_interpolate_4th_order (fluid_rvoice_dsp_t *voice)
|
||||||
for (; dsp_phase_index <= end_index && dsp_i < FLUID_BUFSIZE; dsp_i++)
|
for (; dsp_phase_index <= end_index && dsp_i < FLUID_BUFSIZE; dsp_i++)
|
||||||
{
|
{
|
||||||
coeffs = interp_coeff[fluid_phase_fract_to_tablerow (dsp_phase)];
|
coeffs = interp_coeff[fluid_phase_fract_to_tablerow (dsp_phase)];
|
||||||
dsp_buf[dsp_i] = dsp_amp * (coeffs[0] * dsp_data[dsp_phase_index-1]
|
dsp_buf[dsp_i] = dsp_amp *
|
||||||
+ coeffs[1] * dsp_data[dsp_phase_index]
|
( coeffs[0] * fluid_rvoice_get_sample(dsp_data, dsp_data24, dsp_phase_index-1)
|
||||||
+ coeffs[2] * dsp_data[dsp_phase_index+1]
|
+ coeffs[1] * fluid_rvoice_get_sample(dsp_data, dsp_data24, dsp_phase_index)
|
||||||
+ coeffs[3] * end_point1);
|
+ coeffs[2] * fluid_rvoice_get_sample(dsp_data, dsp_data24, dsp_phase_index+1)
|
||||||
|
+ coeffs[3] * end_point1);
|
||||||
|
|
||||||
/* increment phase and amplitude */
|
/* increment phase and amplitude */
|
||||||
fluid_phase_incr (dsp_phase, dsp_phase_incr);
|
fluid_phase_incr (dsp_phase, dsp_phase_incr);
|
||||||
|
@ -380,10 +407,11 @@ fluid_rvoice_dsp_interpolate_4th_order (fluid_rvoice_dsp_t *voice)
|
||||||
for (; dsp_phase_index <= end_index && dsp_i < FLUID_BUFSIZE; dsp_i++)
|
for (; dsp_phase_index <= end_index && dsp_i < FLUID_BUFSIZE; dsp_i++)
|
||||||
{
|
{
|
||||||
coeffs = interp_coeff[fluid_phase_fract_to_tablerow (dsp_phase)];
|
coeffs = interp_coeff[fluid_phase_fract_to_tablerow (dsp_phase)];
|
||||||
dsp_buf[dsp_i] = dsp_amp * (coeffs[0] * dsp_data[dsp_phase_index-1]
|
dsp_buf[dsp_i] = dsp_amp *
|
||||||
+ coeffs[1] * dsp_data[dsp_phase_index]
|
( coeffs[0] * fluid_rvoice_get_sample(dsp_data, dsp_data24, dsp_phase_index-1)
|
||||||
+ coeffs[2] * end_point1
|
+ coeffs[1] * fluid_rvoice_get_sample(dsp_data, dsp_data24, dsp_phase_index)
|
||||||
+ coeffs[3] * end_point2);
|
+ coeffs[2] * end_point1
|
||||||
|
+ coeffs[3] * end_point2);
|
||||||
|
|
||||||
/* increment phase and amplitude */
|
/* increment phase and amplitude */
|
||||||
fluid_phase_incr (dsp_phase, dsp_phase_incr);
|
fluid_phase_incr (dsp_phase, dsp_phase_incr);
|
||||||
|
@ -402,7 +430,7 @@ fluid_rvoice_dsp_interpolate_4th_order (fluid_rvoice_dsp_t *voice)
|
||||||
{
|
{
|
||||||
voice->has_looped = 1;
|
voice->has_looped = 1;
|
||||||
start_index = voice->loopstart;
|
start_index = voice->loopstart;
|
||||||
start_point = dsp_data[voice->loopend - 1];
|
start_point = fluid_rvoice_get_sample(dsp_data, dsp_data24, voice->loopend-1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -428,14 +456,14 @@ fluid_rvoice_dsp_interpolate_7th_order (fluid_rvoice_dsp_t *voice)
|
||||||
fluid_phase_t dsp_phase = voice->phase;
|
fluid_phase_t dsp_phase = voice->phase;
|
||||||
fluid_phase_t dsp_phase_incr;
|
fluid_phase_t dsp_phase_incr;
|
||||||
short int *dsp_data = voice->sample->data;
|
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_buf = voice->dsp_buf;
|
||||||
fluid_real_t dsp_amp = voice->amp;
|
fluid_real_t dsp_amp = voice->amp;
|
||||||
fluid_real_t dsp_amp_incr = voice->amp_incr;
|
fluid_real_t dsp_amp_incr = voice->amp_incr;
|
||||||
unsigned int dsp_i = 0;
|
unsigned int dsp_i = 0;
|
||||||
unsigned int dsp_phase_index;
|
unsigned int dsp_phase_index;
|
||||||
unsigned int start_index, end_index;
|
unsigned int start_index, end_index;
|
||||||
short int start_points[3];
|
int32_t start_points[3], end_points[3];
|
||||||
short int end_points[3];
|
|
||||||
fluid_real_t *coeffs;
|
fluid_real_t *coeffs;
|
||||||
int looping;
|
int looping;
|
||||||
|
|
||||||
|
@ -455,14 +483,14 @@ fluid_rvoice_dsp_interpolate_7th_order (fluid_rvoice_dsp_t *voice)
|
||||||
if (voice->has_looped) /* set start_index and start point if looped or not */
|
if (voice->has_looped) /* set start_index and start point if looped or not */
|
||||||
{
|
{
|
||||||
start_index = voice->loopstart;
|
start_index = voice->loopstart;
|
||||||
start_points[0] = dsp_data[voice->loopend - 1];
|
start_points[0] = fluid_rvoice_get_sample(dsp_data, dsp_data24, voice->loopend - 1);
|
||||||
start_points[1] = dsp_data[voice->loopend - 2];
|
start_points[1] = fluid_rvoice_get_sample(dsp_data, dsp_data24, voice->loopend - 2);
|
||||||
start_points[2] = dsp_data[voice->loopend - 3];
|
start_points[2] = fluid_rvoice_get_sample(dsp_data, dsp_data24, voice->loopend - 3);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
start_index = voice->start;
|
start_index = voice->start;
|
||||||
start_points[0] = dsp_data[voice->start]; /* just duplicate the start point */
|
start_points[0] = fluid_rvoice_get_sample(dsp_data, dsp_data24, voice->start); /* just duplicate the start point */
|
||||||
start_points[1] = start_points[0];
|
start_points[1] = start_points[0];
|
||||||
start_points[2] = start_points[0];
|
start_points[2] = start_points[0];
|
||||||
}
|
}
|
||||||
|
@ -470,13 +498,13 @@ fluid_rvoice_dsp_interpolate_7th_order (fluid_rvoice_dsp_t *voice)
|
||||||
/* get the 3 points off the end (loop start if looping, duplicate point if end) */
|
/* get the 3 points off the end (loop start if looping, duplicate point if end) */
|
||||||
if (looping)
|
if (looping)
|
||||||
{
|
{
|
||||||
end_points[0] = dsp_data[voice->loopstart];
|
end_points[0] = fluid_rvoice_get_sample(dsp_data, dsp_data24, voice->loopstart);
|
||||||
end_points[1] = dsp_data[voice->loopstart + 1];
|
end_points[1] = fluid_rvoice_get_sample(dsp_data, dsp_data24, voice->loopstart + 1);
|
||||||
end_points[2] = dsp_data[voice->loopstart + 2];
|
end_points[2] = fluid_rvoice_get_sample(dsp_data, dsp_data24, voice->loopstart + 2);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
end_points[0] = dsp_data[voice->end];
|
end_points[0] = fluid_rvoice_get_sample(dsp_data, dsp_data24, voice->end);
|
||||||
end_points[1] = end_points[0];
|
end_points[1] = end_points[0];
|
||||||
end_points[2] = end_points[0];
|
end_points[2] = end_points[0];
|
||||||
}
|
}
|
||||||
|
@ -494,10 +522,10 @@ fluid_rvoice_dsp_interpolate_7th_order (fluid_rvoice_dsp_t *voice)
|
||||||
* (coeffs[0] * (fluid_real_t)start_points[2]
|
* (coeffs[0] * (fluid_real_t)start_points[2]
|
||||||
+ coeffs[1] * (fluid_real_t)start_points[1]
|
+ coeffs[1] * (fluid_real_t)start_points[1]
|
||||||
+ coeffs[2] * (fluid_real_t)start_points[0]
|
+ coeffs[2] * (fluid_real_t)start_points[0]
|
||||||
+ coeffs[3] * (fluid_real_t)dsp_data[dsp_phase_index]
|
+ coeffs[3] * (fluid_real_t)fluid_rvoice_get_sample(dsp_data, dsp_data24, dsp_phase_index)
|
||||||
+ coeffs[4] * (fluid_real_t)dsp_data[dsp_phase_index+1]
|
+ coeffs[4] * (fluid_real_t)fluid_rvoice_get_sample(dsp_data, dsp_data24, dsp_phase_index+1)
|
||||||
+ coeffs[5] * (fluid_real_t)dsp_data[dsp_phase_index+2]
|
+ coeffs[5] * (fluid_real_t)fluid_rvoice_get_sample(dsp_data, dsp_data24, dsp_phase_index+2)
|
||||||
+ coeffs[6] * (fluid_real_t)dsp_data[dsp_phase_index+3]);
|
+ coeffs[6] * (fluid_real_t)fluid_rvoice_get_sample(dsp_data, dsp_data24, dsp_phase_index+3));
|
||||||
|
|
||||||
/* increment phase and amplitude */
|
/* increment phase and amplitude */
|
||||||
fluid_phase_incr (dsp_phase, dsp_phase_incr);
|
fluid_phase_incr (dsp_phase, dsp_phase_incr);
|
||||||
|
@ -515,11 +543,11 @@ fluid_rvoice_dsp_interpolate_7th_order (fluid_rvoice_dsp_t *voice)
|
||||||
dsp_buf[dsp_i] = dsp_amp
|
dsp_buf[dsp_i] = dsp_amp
|
||||||
* (coeffs[0] * (fluid_real_t)start_points[1]
|
* (coeffs[0] * (fluid_real_t)start_points[1]
|
||||||
+ coeffs[1] * (fluid_real_t)start_points[0]
|
+ coeffs[1] * (fluid_real_t)start_points[0]
|
||||||
+ coeffs[2] * (fluid_real_t)dsp_data[dsp_phase_index-1]
|
+ coeffs[2] * (fluid_real_t)fluid_rvoice_get_sample(dsp_data, dsp_data24, dsp_phase_index-1)
|
||||||
+ coeffs[3] * (fluid_real_t)dsp_data[dsp_phase_index]
|
+ coeffs[3] * (fluid_real_t)fluid_rvoice_get_sample(dsp_data, dsp_data24, dsp_phase_index)
|
||||||
+ coeffs[4] * (fluid_real_t)dsp_data[dsp_phase_index+1]
|
+ coeffs[4] * (fluid_real_t)fluid_rvoice_get_sample(dsp_data, dsp_data24, dsp_phase_index+1)
|
||||||
+ coeffs[5] * (fluid_real_t)dsp_data[dsp_phase_index+2]
|
+ coeffs[5] * (fluid_real_t)fluid_rvoice_get_sample(dsp_data, dsp_data24, dsp_phase_index+2)
|
||||||
+ coeffs[6] * (fluid_real_t)dsp_data[dsp_phase_index+3]);
|
+ coeffs[6] * (fluid_real_t)fluid_rvoice_get_sample(dsp_data, dsp_data24, dsp_phase_index+3));
|
||||||
|
|
||||||
/* increment phase and amplitude */
|
/* increment phase and amplitude */
|
||||||
fluid_phase_incr (dsp_phase, dsp_phase_incr);
|
fluid_phase_incr (dsp_phase, dsp_phase_incr);
|
||||||
|
@ -536,12 +564,12 @@ fluid_rvoice_dsp_interpolate_7th_order (fluid_rvoice_dsp_t *voice)
|
||||||
|
|
||||||
dsp_buf[dsp_i] = dsp_amp
|
dsp_buf[dsp_i] = dsp_amp
|
||||||
* (coeffs[0] * (fluid_real_t)start_points[0]
|
* (coeffs[0] * (fluid_real_t)start_points[0]
|
||||||
+ coeffs[1] * (fluid_real_t)dsp_data[dsp_phase_index-2]
|
+ coeffs[1] * (fluid_real_t)fluid_rvoice_get_sample(dsp_data, dsp_data24, dsp_phase_index-2)
|
||||||
+ coeffs[2] * (fluid_real_t)dsp_data[dsp_phase_index-1]
|
+ coeffs[2] * (fluid_real_t)fluid_rvoice_get_sample(dsp_data, dsp_data24, dsp_phase_index-1)
|
||||||
+ coeffs[3] * (fluid_real_t)dsp_data[dsp_phase_index]
|
+ coeffs[3] * (fluid_real_t)fluid_rvoice_get_sample(dsp_data, dsp_data24, dsp_phase_index)
|
||||||
+ coeffs[4] * (fluid_real_t)dsp_data[dsp_phase_index+1]
|
+ coeffs[4] * (fluid_real_t)fluid_rvoice_get_sample(dsp_data, dsp_data24, dsp_phase_index+1)
|
||||||
+ coeffs[5] * (fluid_real_t)dsp_data[dsp_phase_index+2]
|
+ coeffs[5] * (fluid_real_t)fluid_rvoice_get_sample(dsp_data, dsp_data24, dsp_phase_index+2)
|
||||||
+ coeffs[6] * (fluid_real_t)dsp_data[dsp_phase_index+3]);
|
+ coeffs[6] * (fluid_real_t)fluid_rvoice_get_sample(dsp_data, dsp_data24, dsp_phase_index+3));
|
||||||
|
|
||||||
/* increment phase and amplitude */
|
/* increment phase and amplitude */
|
||||||
fluid_phase_incr (dsp_phase, dsp_phase_incr);
|
fluid_phase_incr (dsp_phase, dsp_phase_incr);
|
||||||
|
@ -558,13 +586,13 @@ fluid_rvoice_dsp_interpolate_7th_order (fluid_rvoice_dsp_t *voice)
|
||||||
coeffs = sinc_table7[fluid_phase_fract_to_tablerow (dsp_phase)];
|
coeffs = sinc_table7[fluid_phase_fract_to_tablerow (dsp_phase)];
|
||||||
|
|
||||||
dsp_buf[dsp_i] = dsp_amp
|
dsp_buf[dsp_i] = dsp_amp
|
||||||
* (coeffs[0] * (fluid_real_t)dsp_data[dsp_phase_index-3]
|
* (coeffs[0] * (fluid_real_t)fluid_rvoice_get_sample(dsp_data, dsp_data24, dsp_phase_index-3)
|
||||||
+ coeffs[1] * (fluid_real_t)dsp_data[dsp_phase_index-2]
|
+ coeffs[1] * (fluid_real_t)fluid_rvoice_get_sample(dsp_data, dsp_data24, dsp_phase_index-2)
|
||||||
+ coeffs[2] * (fluid_real_t)dsp_data[dsp_phase_index-1]
|
+ coeffs[2] * (fluid_real_t)fluid_rvoice_get_sample(dsp_data, dsp_data24, dsp_phase_index-1)
|
||||||
+ coeffs[3] * (fluid_real_t)dsp_data[dsp_phase_index]
|
+ coeffs[3] * (fluid_real_t)fluid_rvoice_get_sample(dsp_data, dsp_data24, dsp_phase_index)
|
||||||
+ coeffs[4] * (fluid_real_t)dsp_data[dsp_phase_index+1]
|
+ coeffs[4] * (fluid_real_t)fluid_rvoice_get_sample(dsp_data, dsp_data24, dsp_phase_index+1)
|
||||||
+ coeffs[5] * (fluid_real_t)dsp_data[dsp_phase_index+2]
|
+ coeffs[5] * (fluid_real_t)fluid_rvoice_get_sample(dsp_data, dsp_data24, dsp_phase_index+2)
|
||||||
+ coeffs[6] * (fluid_real_t)dsp_data[dsp_phase_index+3]);
|
+ coeffs[6] * (fluid_real_t)fluid_rvoice_get_sample(dsp_data, dsp_data24, dsp_phase_index+3));
|
||||||
|
|
||||||
/* increment phase and amplitude */
|
/* increment phase and amplitude */
|
||||||
fluid_phase_incr (dsp_phase, dsp_phase_incr);
|
fluid_phase_incr (dsp_phase, dsp_phase_incr);
|
||||||
|
@ -583,12 +611,12 @@ fluid_rvoice_dsp_interpolate_7th_order (fluid_rvoice_dsp_t *voice)
|
||||||
coeffs = sinc_table7[fluid_phase_fract_to_tablerow (dsp_phase)];
|
coeffs = sinc_table7[fluid_phase_fract_to_tablerow (dsp_phase)];
|
||||||
|
|
||||||
dsp_buf[dsp_i] = dsp_amp
|
dsp_buf[dsp_i] = dsp_amp
|
||||||
* (coeffs[0] * (fluid_real_t)dsp_data[dsp_phase_index-3]
|
* (coeffs[0] * (fluid_real_t)fluid_rvoice_get_sample(dsp_data, dsp_data24, dsp_phase_index-3)
|
||||||
+ coeffs[1] * (fluid_real_t)dsp_data[dsp_phase_index-2]
|
+ coeffs[1] * (fluid_real_t)fluid_rvoice_get_sample(dsp_data, dsp_data24, dsp_phase_index-2)
|
||||||
+ coeffs[2] * (fluid_real_t)dsp_data[dsp_phase_index-1]
|
+ coeffs[2] * (fluid_real_t)fluid_rvoice_get_sample(dsp_data, dsp_data24, dsp_phase_index-1)
|
||||||
+ coeffs[3] * (fluid_real_t)dsp_data[dsp_phase_index]
|
+ coeffs[3] * (fluid_real_t)fluid_rvoice_get_sample(dsp_data, dsp_data24, dsp_phase_index)
|
||||||
+ coeffs[4] * (fluid_real_t)dsp_data[dsp_phase_index+1]
|
+ coeffs[4] * (fluid_real_t)fluid_rvoice_get_sample(dsp_data, dsp_data24, dsp_phase_index+1)
|
||||||
+ coeffs[5] * (fluid_real_t)dsp_data[dsp_phase_index+2]
|
+ coeffs[5] * (fluid_real_t)fluid_rvoice_get_sample(dsp_data, dsp_data24, dsp_phase_index+2)
|
||||||
+ coeffs[6] * (fluid_real_t)end_points[0]);
|
+ coeffs[6] * (fluid_real_t)end_points[0]);
|
||||||
|
|
||||||
/* increment phase and amplitude */
|
/* increment phase and amplitude */
|
||||||
|
@ -605,11 +633,11 @@ fluid_rvoice_dsp_interpolate_7th_order (fluid_rvoice_dsp_t *voice)
|
||||||
coeffs = sinc_table7[fluid_phase_fract_to_tablerow (dsp_phase)];
|
coeffs = sinc_table7[fluid_phase_fract_to_tablerow (dsp_phase)];
|
||||||
|
|
||||||
dsp_buf[dsp_i] = dsp_amp
|
dsp_buf[dsp_i] = dsp_amp
|
||||||
* (coeffs[0] * (fluid_real_t)dsp_data[dsp_phase_index-3]
|
* (coeffs[0] * (fluid_real_t)fluid_rvoice_get_sample(dsp_data, dsp_data24, dsp_phase_index-3)
|
||||||
+ coeffs[1] * (fluid_real_t)dsp_data[dsp_phase_index-2]
|
+ coeffs[1] * (fluid_real_t)fluid_rvoice_get_sample(dsp_data, dsp_data24, dsp_phase_index-2)
|
||||||
+ coeffs[2] * (fluid_real_t)dsp_data[dsp_phase_index-1]
|
+ coeffs[2] * (fluid_real_t)fluid_rvoice_get_sample(dsp_data, dsp_data24, dsp_phase_index-1)
|
||||||
+ coeffs[3] * (fluid_real_t)dsp_data[dsp_phase_index]
|
+ coeffs[3] * (fluid_real_t)fluid_rvoice_get_sample(dsp_data, dsp_data24, dsp_phase_index)
|
||||||
+ coeffs[4] * (fluid_real_t)dsp_data[dsp_phase_index+1]
|
+ coeffs[4] * (fluid_real_t)fluid_rvoice_get_sample(dsp_data, dsp_data24, dsp_phase_index+1)
|
||||||
+ coeffs[5] * (fluid_real_t)end_points[0]
|
+ coeffs[5] * (fluid_real_t)end_points[0]
|
||||||
+ coeffs[6] * (fluid_real_t)end_points[1]);
|
+ coeffs[6] * (fluid_real_t)end_points[1]);
|
||||||
|
|
||||||
|
@ -627,10 +655,10 @@ fluid_rvoice_dsp_interpolate_7th_order (fluid_rvoice_dsp_t *voice)
|
||||||
coeffs = sinc_table7[fluid_phase_fract_to_tablerow (dsp_phase)];
|
coeffs = sinc_table7[fluid_phase_fract_to_tablerow (dsp_phase)];
|
||||||
|
|
||||||
dsp_buf[dsp_i] = dsp_amp
|
dsp_buf[dsp_i] = dsp_amp
|
||||||
* (coeffs[0] * (fluid_real_t)dsp_data[dsp_phase_index-3]
|
* (coeffs[0] * (fluid_real_t)fluid_rvoice_get_sample(dsp_data, dsp_data24, dsp_phase_index-3)
|
||||||
+ coeffs[1] * (fluid_real_t)dsp_data[dsp_phase_index-2]
|
+ coeffs[1] * (fluid_real_t)fluid_rvoice_get_sample(dsp_data, dsp_data24, dsp_phase_index-2)
|
||||||
+ coeffs[2] * (fluid_real_t)dsp_data[dsp_phase_index-1]
|
+ coeffs[2] * (fluid_real_t)fluid_rvoice_get_sample(dsp_data, dsp_data24, dsp_phase_index-1)
|
||||||
+ coeffs[3] * (fluid_real_t)dsp_data[dsp_phase_index]
|
+ coeffs[3] * (fluid_real_t)fluid_rvoice_get_sample(dsp_data, dsp_data24, dsp_phase_index)
|
||||||
+ coeffs[4] * (fluid_real_t)end_points[0]
|
+ coeffs[4] * (fluid_real_t)end_points[0]
|
||||||
+ coeffs[5] * (fluid_real_t)end_points[1]
|
+ coeffs[5] * (fluid_real_t)end_points[1]
|
||||||
+ coeffs[6] * (fluid_real_t)end_points[2]);
|
+ coeffs[6] * (fluid_real_t)end_points[2]);
|
||||||
|
@ -652,9 +680,9 @@ fluid_rvoice_dsp_interpolate_7th_order (fluid_rvoice_dsp_t *voice)
|
||||||
{
|
{
|
||||||
voice->has_looped = 1;
|
voice->has_looped = 1;
|
||||||
start_index = voice->loopstart;
|
start_index = voice->loopstart;
|
||||||
start_points[0] = dsp_data[voice->loopend - 1];
|
start_points[0] = fluid_rvoice_get_sample(dsp_data, dsp_data24, voice->loopend - 1);
|
||||||
start_points[1] = dsp_data[voice->loopend - 2];
|
start_points[1] = fluid_rvoice_get_sample(dsp_data, dsp_data24, voice->loopend - 2);
|
||||||
start_points[2] = dsp_data[voice->loopend - 3];
|
start_points[2] = fluid_rvoice_get_sample(dsp_data, dsp_data24, voice->loopend - 3);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue