From 5b125925c8a944c0b2ee432bb73e2f06c4b1c9ef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mark=20H=C3=A4mmerling?= Date: Mon, 24 Jul 2017 22:32:54 +0200 Subject: [PATCH 1/6] Fix "implicit-fallthrough" warning --- fluidsynth/src/drivers/fluid_alsa.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/fluidsynth/src/drivers/fluid_alsa.c b/fluidsynth/src/drivers/fluid_alsa.c index 776cee30..d99cbd06 100644 --- a/fluidsynth/src/drivers/fluid_alsa.c +++ b/fluidsynth/src/drivers/fluid_alsa.c @@ -359,8 +359,9 @@ static int fluid_alsa_handle_write_error (snd_pcm_t *pcm, int errval) FLUID_LOG(FLUID_ERR, "Failed to resume the audio device"); return FLUID_FAILED; } - /* fall through, since the stream got resumed, but still has to be prepared */ #endif + /* fall through ... */ + /* ... since the stream got resumed, but still has to be prepared */ case -EPIPE: case -EBADFD: if (snd_pcm_prepare(pcm) != 0) { From 9ff163218ff7a91feccf58c41212285f0cdf198a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mark=20H=C3=A4mmerling?= Date: Mon, 24 Jul 2017 22:34:48 +0200 Subject: [PATCH 2/6] Fix "format-overflow" warning --- fluidsynth/src/sfloader/fluid_defsfont.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fluidsynth/src/sfloader/fluid_defsfont.h b/fluidsynth/src/sfloader/fluid_defsfont.h index 29f3fd9e..50f987cc 100644 --- a/fluidsynth/src/sfloader/fluid_defsfont.h +++ b/fluidsynth/src/sfloader/fluid_defsfont.h @@ -435,7 +435,7 @@ struct _fluid_defpreset_t { fluid_defpreset_t* next; fluid_defsfont_t* sfont; /* the soundfont this preset belongs to */ - char name[21]; /* the name of the preset */ + char name[22]; /* the name of the preset */ unsigned int bank; /* the bank number */ unsigned int num; /* the preset number */ fluid_preset_zone_t* global_zone; /* the global zone of the preset */ From 16737e8fa34a5526e20dc7abbc93b20eb54895d7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mark=20H=C3=A4mmerling?= Date: Mon, 24 Jul 2017 22:36:17 +0200 Subject: [PATCH 3/6] Work around "maybe-uninitialized" warning --- fluidsynth/src/bindings/fluid_rtkit.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/fluidsynth/src/bindings/fluid_rtkit.c b/fluidsynth/src/bindings/fluid_rtkit.c index 193afd3b..ccbcadcb 100644 --- a/fluidsynth/src/bindings/fluid_rtkit.c +++ b/fluidsynth/src/bindings/fluid_rtkit.c @@ -146,7 +146,7 @@ finish: } int rtkit_get_max_realtime_priority(DBusConnection *connection) { - long long retval; + long long retval = 0; int err; err = rtkit_get_int_property(connection, "MaxRealtimePriority", &retval); @@ -154,7 +154,7 @@ int rtkit_get_max_realtime_priority(DBusConnection *connection) { } int rtkit_get_min_nice_level(DBusConnection *connection, int* min_nice_level) { - long long retval; + long long retval = 0; int err; err = rtkit_get_int_property(connection, "MinNiceLevel", &retval); @@ -164,7 +164,7 @@ int rtkit_get_min_nice_level(DBusConnection *connection, int* min_nice_level) { } long long rtkit_get_rttime_nsec_max(DBusConnection *connection) { - long long retval; + long long retval = 0; int err; err = rtkit_get_int_property(connection, "RTTimeNSecMax", &retval); From 7d9f980fc25de4f6005aeb8e5baacbd235bcad9d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mark=20H=C3=A4mmerling?= Date: Mon, 24 Jul 2017 22:36:48 +0200 Subject: [PATCH 4/6] Fix "misleading-indentation" warning --- fluidsynth/src/synth/fluid_voice.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/fluidsynth/src/synth/fluid_voice.c b/fluidsynth/src/synth/fluid_voice.c index e6efbac8..c13e708a 100644 --- a/fluidsynth/src/synth/fluid_voice.c +++ b/fluidsynth/src/synth/fluid_voice.c @@ -1617,10 +1617,11 @@ fluid_voice_get_overflow_prio(fluid_voice_t* voice, if (voice->has_noteoff) { // FIXME: Should take into account where on the envelope we are...? } - if (a < 0.1) + if (a < 0.1) { a = 0.1; // Avoid div by zero - this_voice_prio += score->volume / a; } + this_voice_prio += score->volume / a; + } return this_voice_prio; } From 6b4724178083fe8c3413650bbee66e7ed0f8e1c2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mark=20H=C3=A4mmerling?= Date: Mon, 24 Jul 2017 22:51:35 +0200 Subject: [PATCH 5/6] Fix misleading whitespace (clang4 complaint) --- fluidsynth/src/synth/fluid_voice.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/fluidsynth/src/synth/fluid_voice.c b/fluidsynth/src/synth/fluid_voice.c index c13e708a..f0a07a79 100644 --- a/fluidsynth/src/synth/fluid_voice.c +++ b/fluidsynth/src/synth/fluid_voice.c @@ -1538,10 +1538,10 @@ fluid_voice_optimize_sample(fluid_sample_t* s) } /* Determine the peak level */ - if (peak_max >- peak_min){ + if (peak_max > -peak_min){ peak = peak_max; } else { - peak =- peak_min; + peak = -peak_min; }; if (peak == 0){ /* Avoid division by zero */ From b612d8cd71d8c39530630584ad6842cadf7f0d45 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mark=20H=C3=A4mmerling?= Date: Mon, 24 Jul 2017 23:17:35 +0200 Subject: [PATCH 6/6] Fix a few minor cosmetic issues --- fluidsynth/src/synth/fluid_voice.c | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/fluidsynth/src/synth/fluid_voice.c b/fluidsynth/src/synth/fluid_voice.c index f0a07a79..bfc2d62b 100644 --- a/fluidsynth/src/synth/fluid_voice.c +++ b/fluidsynth/src/synth/fluid_voice.c @@ -1526,27 +1526,27 @@ fluid_voice_optimize_sample(fluid_sample_t* s) /* ignore ROM and other(?) invalid samples */ if (!s->valid) return (FLUID_OK); - if (!s->amplitude_that_reaches_noise_floor_is_valid){ /* Only once */ + if (!s->amplitude_that_reaches_noise_floor_is_valid) { /* Only once */ /* Scan the loop */ - for (i = (int)s->loopstart; i < (int) s->loopend; i ++){ + for (i = (int)s->loopstart; i < (int)s->loopend; i++){ signed short val = s->data[i]; if (val > peak_max) { - peak_max = val; + peak_max = val; } else if (val < peak_min) { - peak_min = val; + peak_min = val; } } /* Determine the peak level */ - if (peak_max > -peak_min){ + if (peak_max > -peak_min) { peak = peak_max; } else { peak = -peak_min; - }; + } if (peak == 0){ /* Avoid division by zero */ peak = 1; - }; + } /* Calculate what factor will make the loop inaudible * For example: Take a peak of 3277 (10 % of 32768). The @@ -1565,7 +1565,7 @@ fluid_voice_optimize_sample(fluid_sample_t* s) #if 0 printf("Sample peak detection: factor %f\n", (double)result); #endif - }; + } return FLUID_OK; } @@ -1585,10 +1585,9 @@ fluid_voice_get_overflow_prio(fluid_voice_t* voice, * Then it is very important. * Also skip the released and sustained scores. */ - if (voice->channel->channel_type == CHANNEL_TYPE_DRUM){ + if (voice->channel->channel_type == CHANNEL_TYPE_DRUM) { this_voice_prio += score->percussion; - } - else if (voice->has_noteoff) { + } else if (voice->has_noteoff) { /* Noteoff has */ this_voice_prio += score->released; } else if (_SUSTAINED(voice) || _HELD_BY_SOSTENUTO(voice)) { @@ -1606,8 +1605,9 @@ fluid_voice_get_overflow_prio(fluid_voice_t* voice, * chord. So give newer voices a higher score. */ if (score->age) { cur_time -= voice->start_time; - if (cur_time < 1) + if (cur_time < 1) { cur_time = 1; // Avoid div by zero + } this_voice_prio += (score->age * voice->output_rate) / cur_time; }