mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-14 18:46:34 +01:00
Update Fluidsynth to v2.0.2
This commit is contained in:
parent
f28b03c305
commit
8c4c97d1e2
34 changed files with 16320 additions and 648 deletions
|
|
@ -19,74 +19,7 @@
|
|||
*/
|
||||
|
||||
#include "fluid_conv.h"
|
||||
|
||||
#define FLUID_CENTS_HZ_SIZE 1200
|
||||
#define FLUID_VEL_CB_SIZE 128
|
||||
#define FLUID_CB_AMP_SIZE 1441
|
||||
#define FLUID_PAN_SIZE 1002
|
||||
|
||||
/* conversion tables */
|
||||
static fluid_real_t fluid_ct2hz_tab[FLUID_CENTS_HZ_SIZE];
|
||||
static fluid_real_t fluid_cb2amp_tab[FLUID_CB_AMP_SIZE];
|
||||
static fluid_real_t fluid_concave_tab[FLUID_VEL_CB_SIZE];
|
||||
static fluid_real_t fluid_convex_tab[FLUID_VEL_CB_SIZE];
|
||||
static fluid_real_t fluid_pan_tab[FLUID_PAN_SIZE];
|
||||
|
||||
/*
|
||||
* void fluid_synth_init
|
||||
*
|
||||
* Does all the initialization for this module.
|
||||
*/
|
||||
void
|
||||
fluid_conversion_config(void)
|
||||
{
|
||||
int i;
|
||||
double x;
|
||||
|
||||
for(i = 0; i < FLUID_CENTS_HZ_SIZE; i++)
|
||||
{
|
||||
fluid_ct2hz_tab[i] = (fluid_real_t) pow(2.0, (double) i / 1200.0);
|
||||
}
|
||||
|
||||
/* centibels to amplitude conversion
|
||||
* Note: SF2.01 section 8.1.3: Initial attenuation range is
|
||||
* between 0 and 144 dB. Therefore a negative attenuation is
|
||||
* not allowed.
|
||||
*/
|
||||
for(i = 0; i < FLUID_CB_AMP_SIZE; i++)
|
||||
{
|
||||
fluid_cb2amp_tab[i] = (fluid_real_t) pow(10.0, (double) i / -200.0);
|
||||
}
|
||||
|
||||
/* initialize the conversion tables (see fluid_mod.c
|
||||
fluid_mod_get_value cases 4 and 8) */
|
||||
|
||||
/* concave unipolar positive transform curve */
|
||||
fluid_concave_tab[0] = 0.0;
|
||||
fluid_concave_tab[FLUID_VEL_CB_SIZE - 1] = 1.0;
|
||||
|
||||
/* convex unipolar positive transform curve */
|
||||
fluid_convex_tab[0] = 0;
|
||||
fluid_convex_tab[FLUID_VEL_CB_SIZE - 1] = 1.0;
|
||||
|
||||
/* There seems to be an error in the specs. The equations are
|
||||
implemented according to the pictures on SF2.01 page 73. */
|
||||
|
||||
for(i = 1; i < FLUID_VEL_CB_SIZE - 1; i++)
|
||||
{
|
||||
x = (-200.0 / FLUID_PEAK_ATTENUATION) * log((i * i) / (fluid_real_t)((FLUID_VEL_CB_SIZE - 1) * (FLUID_VEL_CB_SIZE - 1))) / M_LN10;
|
||||
fluid_convex_tab[i] = (fluid_real_t)(1.0 - x);
|
||||
fluid_concave_tab[(FLUID_VEL_CB_SIZE - 1) - i] = (fluid_real_t) x;
|
||||
}
|
||||
|
||||
/* initialize the pan conversion table */
|
||||
x = M_PI / 2.0 / (FLUID_PAN_SIZE - 1.0);
|
||||
|
||||
for(i = 0; i < FLUID_PAN_SIZE; i++)
|
||||
{
|
||||
fluid_pan_tab[i] = (fluid_real_t) sin(i * x);
|
||||
}
|
||||
}
|
||||
#include "fluid_conv_tables.c"
|
||||
|
||||
/*
|
||||
* fluid_ct2hz
|
||||
|
|
@ -299,6 +232,13 @@ fluid_tc2sec_release(fluid_real_t tc)
|
|||
* fluid_act2hz
|
||||
*
|
||||
* Convert from absolute cents to Hertz
|
||||
*
|
||||
* The inverse operation, converting from Hertz to cents, was unused and implemented as
|
||||
*
|
||||
fluid_hz2ct(fluid_real_t f)
|
||||
{
|
||||
return (fluid_real_t)(6900 + (1200 / M_LN2) * log(f / 440.0));
|
||||
}
|
||||
*/
|
||||
fluid_real_t
|
||||
fluid_act2hz(fluid_real_t c)
|
||||
|
|
@ -306,17 +246,6 @@ fluid_act2hz(fluid_real_t c)
|
|||
return (fluid_real_t)(8.176 * pow(2.0, (double) c / 1200.0));
|
||||
}
|
||||
|
||||
/*
|
||||
* fluid_hz2ct
|
||||
*
|
||||
* Convert from Hertz to cents
|
||||
*/
|
||||
fluid_real_t
|
||||
fluid_hz2ct(fluid_real_t f)
|
||||
{
|
||||
return (fluid_real_t)(6900 + 1200 * log(f / 440.0) / M_LN2);
|
||||
}
|
||||
|
||||
/*
|
||||
* fluid_pan
|
||||
*/
|
||||
|
|
@ -407,3 +336,4 @@ fluid_convex(fluid_real_t val)
|
|||
|
||||
return fluid_convex_tab[(int) val];
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue