mirror of
https://github.com/ZDoom/fluidsynth.git
synced 2025-03-01 15:10:43 +00:00
Merge pull request #180 from markh-de/fix_gcc7_and_clang4_warnings
Fix GCC 7 and Clang 4 compiler warnings
This commit is contained in:
commit
c4420e297b
4 changed files with 22 additions and 20 deletions
|
@ -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);
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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 */
|
||||
|
|
|
@ -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;
|
||||
};
|
||||
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;
|
||||
}
|
||||
|
||||
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue