aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWohlstand <admin@wohlnet.ru>2025-05-27 01:18:52 +0300
committerWohlstand <admin@wohlnet.ru>2025-05-27 01:18:52 +0300
commitac371993c1af812eaf4445a5d5b6d537f9e1d87c (patch)
tree39d301e03fabf6423545968adf10a99e09116477
parente18263c54f43e8d08cef691507ec4abd0bd04a1b (diff)
downloadlibADLMIDI-ac371993c1af812eaf4445a5d5b6d537f9e1d87c.tar.gz
libADLMIDI-ac371993c1af812eaf4445a5d5b6d537f9e1d87c.tar.bz2
libADLMIDI-ac371993c1af812eaf4445a5d5b6d537f9e1d87c.zip
describeChannels: Don't show absent OPL2 channels
When destination chip is OPL2, then don't show channels are de-facto absent on hardware.
-rw-r--r--src/adlmidi_midiplay.cpp27
1 files changed, 17 insertions, 10 deletions
diff --git a/src/adlmidi_midiplay.cpp b/src/adlmidi_midiplay.cpp
index 99b5bf0..d001a60 100644
--- a/src/adlmidi_midiplay.cpp
+++ b/src/adlmidi_midiplay.cpp
@@ -2029,9 +2029,9 @@ void MIDIplay::describeChannels(char *str, char *attr, size_t size)
Synth &synth = *m_synth;
uint32_t numChannels = synth.m_numChannels;
- uint32_t index = 0;
+ uint32_t index = 0, index_out = 0;
- while(index < numChannels && index < size - 1)
+ while(index < numChannels && index_out < size - 1)
{
const AdlChannel &adlChannel = m_chipChannels[index];
@@ -2041,23 +2041,29 @@ void MIDIplay::describeChannels(char *str, char *attr, size_t size)
if(!loc.is_end())
++locnext;
+ if(synth.m_channelCategory[index] == Synth::ChanCat_None)
+ {
+ ++index; // Skip OPL2-absent channels
+ continue;
+ }
+
if(loc.is_end()) // off
- str[index] = '-';
+ str[index_out] = '-';
else if(!locnext.is_end()) // arpeggio
- str[index] = '@';
+ str[index_out] = '@';
else // on
{
switch(synth.m_channelCategory[index])
{
case Synth::ChanCat_Regular:
- str[index] = '+';
+ str[index_out] = '+';
break;
case Synth::ChanCat_4op_First:
case Synth::ChanCat_4op_Second:
- str[index] = '#';
+ str[index_out] = '#';
break;
default: // rhythm-mode percussion
- str[index] = 'r';
+ str[index_out] = 'r';
break;
}
}
@@ -2066,10 +2072,11 @@ void MIDIplay::describeChannels(char *str, char *attr, size_t size)
if(!loc.is_end()) // 4-bit color index of MIDI channel
attribute |= (uint8_t)(loc->value.loc.MidCh & 0xF);
- attr[index] = (char)attribute;
+ attr[index_out] = (char)attribute;
++index;
+ ++index_out;
}
- str[index] = 0;
- attr[index] = 0;
+ str[index_out] = 0;
+ attr[index_out] = 0;
}