- fixed some warnings.

This commit is contained in:
Christoph Oelckers 2018-02-23 01:01:18 +01:00
parent d6fe1fb39f
commit f9893a700a
4 changed files with 11 additions and 14 deletions

View file

@ -310,11 +310,11 @@ int Freq::freq_initialize_fft_arrays(Sample *sp)
float Freq::freq_fourier(Sample *sp, int *chord) float Freq::freq_fourier(Sample *sp, int *chord)
{ {
uint32_t length, length0; int32_t length, length0;
int32_t maxoffset, minoffset, minoffset1, minoffset2; int32_t maxoffset, minoffset, minoffset1, minoffset2;
int32_t minbin, maxbin; int32_t minbin, maxbin;
int32_t bin; int32_t bin;
uint32_t i; int32_t i;
int32_t j, n, total; int32_t j, n, total;
unsigned int rate; unsigned int rate;
int pitch, bestpitch, minpitch, maxpitch, maxpitch2; int pitch, bestpitch, minpitch, maxpitch, maxpitch2;
@ -340,7 +340,7 @@ float Freq::freq_fourier(Sample *sp, int *chord)
/* get maximum amplitude */ /* get maximum amplitude */
maxamp = -1; maxamp = -1;
for (uint32_t i = 0; i < length0; i++) for (int32_t i = 0; i < length0; i++)
{ {
amp = abs(origdata[i]); amp = abs(origdata[i]);
if (amp >= maxamp) if (amp >= maxamp)
@ -422,7 +422,7 @@ float Freq::freq_fourier(Sample *sp, int *chord)
/* lower bound on the detected frequency */ /* lower bound on the detected frequency */
maxoffset = rate / pitch_freq_lb_table[LOWEST_PITCH] + 0.5; maxoffset = rate / pitch_freq_lb_table[LOWEST_PITCH] + 0.5;
if ((uint32_t)maxoffset > (length >> 1)) if (maxoffset > (length >> 1))
maxoffset = (length >> 1); maxoffset = (length >> 1);
min_guessfreq = (float)rate / maxoffset; min_guessfreq = (float)rate / maxoffset;
@ -550,7 +550,7 @@ float Freq::freq_fourier(Sample *sp, int *chord)
if (!minbin) if (!minbin)
minbin = 1; minbin = 1;
maxbin = ceil(maxfreq / f0); maxbin = ceil(maxfreq / f0);
if ((uint32_t)maxbin >= (length >> 1)) if (maxbin >= (length >> 1))
maxbin = (length >> 1) - 1; maxbin = (length >> 1) - 1;
/* filter out all "noise" from magnitude array */ /* filter out all "noise" from magnitude array */
@ -667,7 +667,7 @@ float Freq::freq_fourier(Sample *sp, int *chord)
minbin = minfreq2 * f0_inv; minbin = minfreq2 * f0_inv;
if (!minbin) minbin = 1; if (!minbin) minbin = 1;
maxbin = ceil(maxfreq2 * f0_inv); maxbin = ceil(maxfreq2 * f0_inv);
if ((uint32_t)maxbin >= (length >> 1)) if (maxbin >= (length >> 1))
maxbin = (length >> 1) - 1; maxbin = (length >> 1) - 1;
for (bin = minbin; bin <= maxbin; bin++) for (bin = minbin; bin <= maxbin; bin++)

View file

@ -837,11 +837,8 @@ Instrument *Instruments::load_gus_instrument(char *name, ToneBank *bank, int dr,
/* Then read the sample data */ /* Then read the sample data */
sp->data = (sample_t *)safe_malloc(sp->data_length + 4); sp->data = (sample_t *)safe_malloc(sp->data_length + 4);
sp->data_alloced = 1; sp->data_alloced = 1;
if ((j = tf_read(sp->data, 1, sp->data_length, tf)) if ((j = tf_read(sp->data, 1, sp->data_length, tf)) != (int)sp->data_length) {
!= sp->data_length) { ctl_cmsg(CMSG_ERROR, VERB_NORMAL, "Too small this patch length: %d < %d", j, sp->data_length);
ctl_cmsg(CMSG_ERROR, VERB_NORMAL,
"Too small this patch length: %d < %d",
j, sp->data_length);
goto fail; goto fail;
} }
if (!(sp->modes & MODES_16BIT)) { /* convert to 16-bit data */ if (!(sp->modes & MODES_16BIT)) { /* convert to 16-bit data */

View file

@ -553,7 +553,7 @@ public:
void set_default_instrument() 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) bool checkConfig(const char *filename)

View file

@ -58,13 +58,13 @@ typedef struct {
#endif #endif
/*! LFO */ /*! LFO */
typedef struct { struct lfo {
int32_t buf[SINE_CYCLE_LENGTH]; int32_t buf[SINE_CYCLE_LENGTH];
int32_t count, cycle; /* in samples */ int32_t count, cycle; /* in samples */
int32_t icycle; /* proportional to (SINE_CYCLE_LENGTH / cycle) */ int32_t icycle; /* proportional to (SINE_CYCLE_LENGTH / cycle) */
int type; /* current content of its buffer */ int type; /* current content of its buffer */
double freq; /* in Hz */ double freq; /* in Hz */
} lfo; };
enum { enum {
LFO_NONE = 0, LFO_NONE = 0,