diff options
author | JP Cimalando <jpcima@users.noreply.github.com> | 2018-06-28 01:10:37 +0200 |
---|---|---|
committer | JP Cimalando <jpcima@users.noreply.github.com> | 2018-06-28 01:28:39 +0200 |
commit | 7181959675c1658cff313a161f3a96f88a118baa (patch) | |
tree | 184a8e273d97e7c8edc7b4fb310751b1c4d3d5ad /src/adlmidi_midiplay.cpp | |
parent | 96960d1dd9ff21adfc4e5171f4a6ef4f2a3e57a6 (diff) | |
download | libADLMIDI-7181959675c1658cff313a161f3a96f88a118baa.tar.gz libADLMIDI-7181959675c1658cff313a161f3a96f88a118baa.tar.bz2 libADLMIDI-7181959675c1658cff313a161f3a96f88a118baa.zip |
basic channel description API
Diffstat (limited to 'src/adlmidi_midiplay.cpp')
-rw-r--r-- | src/adlmidi_midiplay.cpp | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/src/adlmidi_midiplay.cpp b/src/adlmidi_midiplay.cpp index 9841f73..76d54ab 100644 --- a/src/adlmidi_midiplay.cpp +++ b/src/adlmidi_midiplay.cpp @@ -1722,6 +1722,51 @@ void MIDIplay::updateGlide(double amount) } } +void MIDIplay::describeChannels(char *str, char *attr, size_t size) +{ + if (!str || size <= 0) + return; + + OPL3 &synth = m_synth; + uint32_t numChannels = synth.m_numChannels; + + uint32_t index = 0; + for(uint32_t i = 0; index < numChannels && index < size - 1; ++i) + { + const AdlChannel &adlChannel = m_chipChannels[i]; + + AdlChannel::LocationData *loc = adlChannel.users_first; + if(!loc) // off + { + str[index++] = '-'; + } + else if(loc->next) // arpeggio + { + str[index++] = '@'; + } + else // on + { + switch(synth.m_channelCategory[i]) + { + case OPL3::ChanCat_Regular: + str[index++] = '+'; + break; + case OPL3::ChanCat_4op_Master: + case OPL3::ChanCat_4op_Slave: + str[index++] = '#'; + break; + default: // rhythm-mode percussion + str[index++] = 'r'; + break; + } + } + + attr[index] = '\0'; // TODO + } + + str[index] = 0; + attr[index] = 0; +} #ifndef ADLMIDI_DISABLE_CPP_EXTRAS |