diff --git a/src/synth/fluid_synth.c b/src/synth/fluid_synth.c index c44baf88..ff7a5f3f 100644 --- a/src/synth/fluid_synth.c +++ b/src/synth/fluid_synth.c @@ -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(); } diff --git a/src/utils/fluid_conv.c b/src/utils/fluid_conv.c index 50ab1010..6a3ee103 100644 --- a/src/utils/fluid_conv.c +++ b/src/utils/fluid_conv.c @@ -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 */ diff --git a/src/utils/fluid_conv.h b/src/utils/fluid_conv.h index f0b91168..838b1496 100644 --- a/src/utils/fluid_conv.h +++ b/src/utils/fluid_conv.h @@ -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);