From a48a3d0abf4914d0f6d745722461e7b77e0f22af Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Mon, 17 Apr 2017 15:37:45 +0200 Subject: [PATCH] - fixed some signedness warnings in OPL code. --- src/sound/oplsynth/musicblock.cpp | 7 +++---- src/sound/oplsynth/musicblock.h | 2 +- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/src/sound/oplsynth/musicblock.cpp b/src/sound/oplsynth/musicblock.cpp index 5de26f76fe..d905744d44 100644 --- a/src/sound/oplsynth/musicblock.cpp +++ b/src/sound/oplsynth/musicblock.cpp @@ -36,7 +36,7 @@ musicBlock::musicBlock () { memset (this, 0, sizeof(*this)); - for(auto &voice : voices) voice.index = -1; // mark all free. + for(auto &voice : voices) voice.index = ~0u; // mark all free. } musicBlock::~musicBlock () @@ -53,7 +53,7 @@ int musicBlock::releaseVoice(uint32_t slot, uint32_t killed) { struct OPLVoice *ch = &voices[slot]; io->WriteFrequency(slot, ch->note, ch->pitch, 0); - ch->index = -1; + ch->index = ~0u; if (killed) io->MuteChannel(slot); return slot; } @@ -68,7 +68,7 @@ int musicBlock::findFreeVoice() { for (uint32_t i = 0; i < io->NumChannels; ++i) { - if (voices[i].index == -1) + if (voices[i].index == ~0u) { releaseVoice(i, 1); return i; @@ -185,7 +185,6 @@ void musicBlock::noteOn(uint32_t channel, uint8_t key, int volume) noteOff(channel, key); return; } - uint32_t note; GenMidiInstrument *instrument; // Percussion channel is treated differently. diff --git a/src/sound/oplsynth/musicblock.h b/src/sound/oplsynth/musicblock.h index e806a45e6f..815e3d2679 100644 --- a/src/sound/oplsynth/musicblock.h +++ b/src/sound/oplsynth/musicblock.h @@ -6,7 +6,7 @@ struct OPLVoice { - int index; // Index of this voice, or -1 if not in use. + unsigned int index; // Index of this voice, or -1 if not in use. unsigned int key; // The midi key that this voice is playing. unsigned int note; // The note being played. This is normally the same as the key, but if the instrument is a fixed pitch instrument, it is different. unsigned int note_volume; // The volume of the note being played on this channel.