Merge branch 'carlo-bramini-misc-fixes-1'

This commit is contained in:
derselbst 2017-10-25 17:52:17 +02:00
commit a1810385e1
3 changed files with 18 additions and 8 deletions

View file

@ -48,7 +48,7 @@ extern "C" {
#if defined(__GNUC__) || defined(__clang__)
# define FLUID_DEPRECATED __attribute__((deprecated))
#elif defined(_MSC_VER)
#elif defined(_MSC_VER) && _MSC_VER > 1200
# define FLUID_DEPRECATED __declspec(deprecated)
#else
# define FLUID_DEPRECATED

View file

@ -387,6 +387,7 @@ fluid_source(fluid_cmd_handler_t* handler, const char *filename)
{
int file;
fluid_shell_t shell;
int result;
#ifdef WIN32
file = _open(filename, _O_RDONLY);
@ -397,7 +398,15 @@ fluid_source(fluid_cmd_handler_t* handler, const char *filename)
return file;
}
fluid_shell_init(&shell, NULL, handler, file, fluid_get_stdout());
return fluid_shell_run(&shell);
result = fluid_shell_run(&shell);
#ifdef WIN32
_close(file);
#else
close(file);
#endif
return result;
}
/**

View file

@ -502,8 +502,9 @@ static int
fluid_voice_calculate_runtime_synthesis_parameters(fluid_voice_t* voice)
{
int i;
unsigned int n;
int list_of_generators_to_initialize[35] = {
static int const list_of_generators_to_initialize[] = {
GEN_STARTADDROFS, /* SF2.01 page 48 #0 */
GEN_ENDADDROFS, /* #1 */
GEN_STARTLOOPADDROFS, /* #2 */
@ -553,8 +554,8 @@ fluid_voice_calculate_runtime_synthesis_parameters(fluid_voice_t* voice)
/* GEN_COARSETUNE [1] #51 */
/* GEN_FINETUNE [1] #52 */
GEN_OVERRIDEROOTKEY, /* #58 */
GEN_PITCH, /* --- */
-1}; /* end-of-list marker */
GEN_PITCH /* --- */
};
/* When the voice is made ready for the synthesis process, a lot of
* voice-internal parameters have to be calculated.
@ -598,8 +599,8 @@ fluid_voice_calculate_runtime_synthesis_parameters(fluid_voice_t* voice)
*/
/* Calculate the voice parameter(s) dependent on each generator. */
for (i = 0; list_of_generators_to_initialize[i] != -1; i++) {
fluid_voice_update_param(voice, list_of_generators_to_initialize[i]);
for (n = 0; n < FLUID_N_ELEMENTS(list_of_generators_to_initialize); n++) {
fluid_voice_update_param(voice, list_of_generators_to_initialize[n]);
}
/* Make an estimate on how loud this voice can get at any time (attenuation). */
@ -702,7 +703,7 @@ fluid_voice_update_param(fluid_voice_t* voice, int gen)
fluid_real_t y;
unsigned int count, z;
// Alternate attenuation scale used by EMU10K1 cards when setting the attenuation at the preset or instrument level within the SoundFont bank.
static const float ALT_ATTENUATION_SCALE = 0.4;
static const float ALT_ATTENUATION_SCALE = 0.4f;
switch (gen) {