From f9893a700aedc3f8cc36d830f4597027a061ae37 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Fri, 23 Feb 2018 01:01:18 +0100 Subject: [PATCH] - fixed some warnings. --- src/sound/timiditypp/freq.cpp | 12 ++++++------ src/sound/timiditypp/instrum.cpp | 7 ++----- src/sound/timiditypp/instrum.h | 2 +- src/sound/timiditypp/reverb.h | 4 ++-- 4 files changed, 11 insertions(+), 14 deletions(-) diff --git a/src/sound/timiditypp/freq.cpp b/src/sound/timiditypp/freq.cpp index 4a0599b0e..e4c50a6c6 100644 --- a/src/sound/timiditypp/freq.cpp +++ b/src/sound/timiditypp/freq.cpp @@ -310,11 +310,11 @@ int Freq::freq_initialize_fft_arrays(Sample *sp) float Freq::freq_fourier(Sample *sp, int *chord) { - uint32_t length, length0; + int32_t length, length0; int32_t maxoffset, minoffset, minoffset1, minoffset2; int32_t minbin, maxbin; int32_t bin; - uint32_t i; + int32_t i; int32_t j, n, total; unsigned int rate; int pitch, bestpitch, minpitch, maxpitch, maxpitch2; @@ -340,7 +340,7 @@ float Freq::freq_fourier(Sample *sp, int *chord) /* get maximum amplitude */ maxamp = -1; - for (uint32_t i = 0; i < length0; i++) + for (int32_t i = 0; i < length0; i++) { amp = abs(origdata[i]); if (amp >= maxamp) @@ -422,7 +422,7 @@ float Freq::freq_fourier(Sample *sp, int *chord) /* lower bound on the detected frequency */ maxoffset = rate / pitch_freq_lb_table[LOWEST_PITCH] + 0.5; - if ((uint32_t)maxoffset > (length >> 1)) + if (maxoffset > (length >> 1)) maxoffset = (length >> 1); min_guessfreq = (float)rate / maxoffset; @@ -550,7 +550,7 @@ float Freq::freq_fourier(Sample *sp, int *chord) if (!minbin) minbin = 1; maxbin = ceil(maxfreq / f0); - if ((uint32_t)maxbin >= (length >> 1)) + if (maxbin >= (length >> 1)) maxbin = (length >> 1) - 1; /* filter out all "noise" from magnitude array */ @@ -667,7 +667,7 @@ float Freq::freq_fourier(Sample *sp, int *chord) minbin = minfreq2 * f0_inv; if (!minbin) minbin = 1; maxbin = ceil(maxfreq2 * f0_inv); - if ((uint32_t)maxbin >= (length >> 1)) + if (maxbin >= (length >> 1)) maxbin = (length >> 1) - 1; for (bin = minbin; bin <= maxbin; bin++) diff --git a/src/sound/timiditypp/instrum.cpp b/src/sound/timiditypp/instrum.cpp index b73825ff5..a1d7e2446 100644 --- a/src/sound/timiditypp/instrum.cpp +++ b/src/sound/timiditypp/instrum.cpp @@ -837,11 +837,8 @@ Instrument *Instruments::load_gus_instrument(char *name, ToneBank *bank, int dr, /* Then read the sample data */ sp->data = (sample_t *)safe_malloc(sp->data_length + 4); sp->data_alloced = 1; - if ((j = tf_read(sp->data, 1, sp->data_length, tf)) - != sp->data_length) { - ctl_cmsg(CMSG_ERROR, VERB_NORMAL, - "Too small this patch length: %d < %d", - j, sp->data_length); + if ((j = tf_read(sp->data, 1, sp->data_length, tf)) != (int)sp->data_length) { + ctl_cmsg(CMSG_ERROR, VERB_NORMAL, "Too small this patch length: %d < %d", j, sp->data_length); goto fail; } if (!(sp->modes & MODES_16BIT)) { /* convert to 16-bit data */ diff --git a/src/sound/timiditypp/instrum.h b/src/sound/timiditypp/instrum.h index 1894e08fe..06c40a25e 100644 --- a/src/sound/timiditypp/instrum.h +++ b/src/sound/timiditypp/instrum.h @@ -553,7 +553,7 @@ public: void set_default_instrument() { - if (def_instr_name) set_default_instrument(def_instr_name); + set_default_instrument(def_instr_name); } bool checkConfig(const char *filename) diff --git a/src/sound/timiditypp/reverb.h b/src/sound/timiditypp/reverb.h index b84475e6c..2cb230ba3 100644 --- a/src/sound/timiditypp/reverb.h +++ b/src/sound/timiditypp/reverb.h @@ -58,13 +58,13 @@ typedef struct { #endif /*! LFO */ -typedef struct { +struct lfo { int32_t buf[SINE_CYCLE_LENGTH]; int32_t count, cycle; /* in samples */ int32_t icycle; /* proportional to (SINE_CYCLE_LENGTH / cycle) */ int type; /* current content of its buffer */ double freq; /* in Hz */ -} lfo; +}; enum { LFO_NONE = 0,