diff options
author | Vitaly Novichkov <Wohlstand@users.noreply.github.com> | 2018-06-29 05:26:44 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-06-29 05:26:44 +0300 |
commit | c8595d01aba305694d9fd8754ecc6fe4ac0f1ec2 (patch) | |
tree | 819889893b3aafb1286044cc5282c6b4b1d30680 /src/adlmidi_midiplay.cpp | |
parent | 242fb110d6910c1c15656daf5982812437b3e8c1 (diff) | |
parent | 7181959675c1658cff313a161f3a96f88a118baa (diff) | |
download | libADLMIDI-c8595d01aba305694d9fd8754ecc6fe4ac0f1ec2.tar.gz libADLMIDI-c8595d01aba305694d9fd8754ecc6fe4ac0f1ec2.tar.bz2 libADLMIDI-c8595d01aba305694d9fd8754ecc6fe4ac0f1ec2.zip |
Merge pull request #123 from jpcima/describe-channels
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 |