- fixed some signedness warnings in OPL code.

This commit is contained in:
Christoph Oelckers 2017-04-17 15:37:45 +02:00
parent 96d328de9b
commit a48a3d0abf
2 changed files with 4 additions and 5 deletions

View file

@ -36,7 +36,7 @@
musicBlock::musicBlock () musicBlock::musicBlock ()
{ {
memset (this, 0, sizeof(*this)); 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 () musicBlock::~musicBlock ()
@ -53,7 +53,7 @@ int musicBlock::releaseVoice(uint32_t slot, uint32_t killed)
{ {
struct OPLVoice *ch = &voices[slot]; struct OPLVoice *ch = &voices[slot];
io->WriteFrequency(slot, ch->note, ch->pitch, 0); io->WriteFrequency(slot, ch->note, ch->pitch, 0);
ch->index = -1; ch->index = ~0u;
if (killed) io->MuteChannel(slot); if (killed) io->MuteChannel(slot);
return slot; return slot;
} }
@ -68,7 +68,7 @@ int musicBlock::findFreeVoice()
{ {
for (uint32_t i = 0; i < io->NumChannels; ++i) for (uint32_t i = 0; i < io->NumChannels; ++i)
{ {
if (voices[i].index == -1) if (voices[i].index == ~0u)
{ {
releaseVoice(i, 1); releaseVoice(i, 1);
return i; return i;
@ -185,7 +185,6 @@ void musicBlock::noteOn(uint32_t channel, uint8_t key, int volume)
noteOff(channel, key); noteOff(channel, key);
return; return;
} }
uint32_t note;
GenMidiInstrument *instrument; GenMidiInstrument *instrument;
// Percussion channel is treated differently. // Percussion channel is treated differently.

View file

@ -6,7 +6,7 @@
struct OPLVoice 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 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; // 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. unsigned int note_volume; // The volume of the note being played on this channel.