add setting for volume envelope processing

fixes #70
This commit is contained in:
derselbst 2017-09-07 11:42:01 +02:00
parent 16f2005d68
commit 29f6ac1049
3 changed files with 27 additions and 6 deletions

View file

@ -224,6 +224,7 @@ void fluid_synth_settings(fluid_settings_t* settings)
fluid_settings_add_option(settings, "synth.midi-bank-select", "xg");
fluid_settings_add_option(settings, "synth.midi-bank-select", "mma");
fluid_settings_register_str(settings, "synth.volenv", "emu", 0, NULL, NULL);
}
/**
@ -554,8 +555,19 @@ new_fluid_synth(fluid_settings_t *settings)
double gain;
int i, nbuf;
/* initialize all the conversion tables and other stuff */
if (fluid_synth_initialized == 0) {
if (fluid_synth_initialized == 0)
{
char* buf;
if(fluid_settings_getstr(settings, "synth.volenv", &buf))
{
if(FLUID_STRCMP(buf, "compliant") == 0)
fluid_conversion_set_atten_power(FLUID_ATTEN_POWER_DEFAULT_COMPLIANT);
else
fluid_conversion_set_atten_power(FLUID_ATTEN_POWER_DEFAULT_EMU);
}
fluid_synth_init();
}

View file

@ -21,6 +21,12 @@
#include "fluid_conv.h"
/* EMU 8k/10k don't follow spec in regards to volume attenuation.
* This factor is used in the equation pow (10.0, cb / FLUID_ATTEN_POWER_FACTOR).
* By the standard this should be -200.0. */
/* 07/11/2008 modified by S. Christian Collins for increased velocity sensitivity. Now it equals the response of EMU10K1 programming.*/
static double FLUID_ATTEN_POWER_FACTOR = FLUID_ATTEN_POWER_DEFAULT_EMU; /* was (-531.509)*/
/* conversion tables */
fluid_real_t fluid_ct2hz_tab[FLUID_CENTS_HZ_SIZE];
fluid_real_t fluid_cb2amp_tab[FLUID_CB_AMP_SIZE];
@ -91,6 +97,11 @@ fluid_conversion_config(void)
}
}
void fluid_conversion_set_atten_power(double atten)
{
FLUID_ATTEN_POWER_FACTOR = atten;
}
/*
* fluid_ct2hz
*/

View file

@ -29,13 +29,11 @@
#define FLUID_ATTEN_AMP_SIZE 1441
#define FLUID_PAN_SIZE 1002
/* EMU 8k/10k don't follow spec in regards to volume attenuation.
* This factor is used in the equation pow (10.0, cb / FLUID_ATTEN_POWER_FACTOR).
* By the standard this should be -200.0. */
/* 07/11/2008 modified by S. Christian Collins for increased velocity sensitivity. Now it equals the response of EMU10K1 programming.*/
#define FLUID_ATTEN_POWER_FACTOR (-200.0) /* was (-531.509)*/
#define FLUID_ATTEN_POWER_DEFAULT_EMU (-200.0)
#define FLUID_ATTEN_POWER_DEFAULT_COMPLIANT (-531.509)
void fluid_conversion_config(void);
void fluid_conversion_set_atten_power(double atten);
fluid_real_t fluid_ct2hz_real(fluid_real_t cents);
fluid_real_t fluid_ct2hz(fluid_real_t cents);