diff --git a/src/sound/oplsynth/musicblock.cpp b/src/sound/oplsynth/musicblock.cpp index 5de26f76f..d905744d4 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 e806a45e6..815e3d267 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.