aboutsummaryrefslogtreecommitdiff
path: root/src/adlmidi_midiplay.cpp
diff options
context:
space:
mode:
authorJP Cimalando <jpcima@users.noreply.github.com>2018-07-03 22:50:53 +0200
committerJP Cimalando <jpcima@users.noreply.github.com>2018-07-03 22:50:53 +0200
commitcd307098b7cf846b74f265d1d59285b2a6f81ada (patch)
tree0f448afcac8139b88b6aa13964a0b6653c7f3809 /src/adlmidi_midiplay.cpp
parentb2a05a8912ff6b38c160494b64e999be55e10983 (diff)
downloadlibADLMIDI-cd307098b7cf846b74f265d1d59285b2a6f81ada.tar.gz
libADLMIDI-cd307098b7cf846b74f265d1d59285b2a6f81ada.tar.bz2
libADLMIDI-cd307098b7cf846b74f265d1d59285b2a6f81ada.zip
fix indexing errors in channel description
Diffstat (limited to 'src/adlmidi_midiplay.cpp')
-rw-r--r--src/adlmidi_midiplay.cpp17
1 files changed, 9 insertions, 8 deletions
diff --git a/src/adlmidi_midiplay.cpp b/src/adlmidi_midiplay.cpp
index 4ca9550..cd8a5d6 100644
--- a/src/adlmidi_midiplay.cpp
+++ b/src/adlmidi_midiplay.cpp
@@ -1731,32 +1731,32 @@ void MIDIplay::describeChannels(char *str, char *attr, size_t size)
uint32_t numChannels = synth.m_numChannels;
uint32_t index = 0;
- for(uint32_t i = 0; index < numChannels && index < size - 1; ++i)
+ while(index < numChannels && index < size - 1)
{
- const AdlChannel &adlChannel = m_chipChannels[i];
+ const AdlChannel &adlChannel = m_chipChannels[index];
AdlChannel::LocationData *loc = adlChannel.users_first;
if(!loc) // off
{
- str[index++] = '-';
+ str[index] = '-';
}
else if(loc->next) // arpeggio
{
- str[index++] = '@';
+ str[index] = '@';
}
else // on
{
- switch(synth.m_channelCategory[i])
+ switch(synth.m_channelCategory[index])
{
case OPL3::ChanCat_Regular:
- str[index++] = '+';
+ str[index] = '+';
break;
case OPL3::ChanCat_4op_Master:
case OPL3::ChanCat_4op_Slave:
- str[index++] = '#';
+ str[index] = '#';
break;
default: // rhythm-mode percussion
- str[index++] = 'r';
+ str[index] = 'r';
break;
}
}
@@ -1766,6 +1766,7 @@ void MIDIplay::describeChannels(char *str, char *attr, size_t size)
attribute |= (uint8_t)(loc->loc.MidCh & 0xF);
attr[index] = (char)attribute;
+ ++index;
}
str[index] = 0;