aboutsummaryrefslogtreecommitdiff
path: root/src/adlmidi_midiplay.cpp
diff options
context:
space:
mode:
authorWohlstand <admin@wohlnet.ru>2023-10-05 12:54:28 +0300
committerWohlstand <admin@wohlnet.ru>2023-10-05 12:56:01 +0300
commit996056412707bddacb00bd314e5e88ba83c94347 (patch)
tree9fd9ee893f692564645f66e95995f04199b1890a /src/adlmidi_midiplay.cpp
parent62add404aa71015dd7ae9713a0292743788f3d23 (diff)
downloadlibADLMIDI-996056412707bddacb00bd314e5e88ba83c94347.tar.gz
libADLMIDI-996056412707bddacb00bd314e5e88ba83c94347.tar.bz2
libADLMIDI-996056412707bddacb00bd314e5e88ba83c94347.zip
adlmidi_midiplay.cpp: Simplify some rhythm mode related checks
Diffstat (limited to 'src/adlmidi_midiplay.cpp')
-rw-r--r--src/adlmidi_midiplay.cpp42
1 files changed, 22 insertions, 20 deletions
diff --git a/src/adlmidi_midiplay.cpp b/src/adlmidi_midiplay.cpp
index 35655d9..f682fed 100644
--- a/src/adlmidi_midiplay.cpp
+++ b/src/adlmidi_midiplay.cpp
@@ -445,16 +445,11 @@ bool MIDIplay::realTime_NoteOn(uint8_t channel, uint8_t note, uint8_t velocity)
voices[1].pseudo4op = pseudo_4op;
#endif /* __WATCOMC__ */
- if(
- (synth.m_rhythmMode == 1) &&
- (
- ((ains->flags & OplInstMeta::Mask_RhythmMode) != 0) ||
- (m_cmfPercussionMode && (channel >= 11))
- )
- )
- {
+ bool rm_ains = (ains->flags & OplInstMeta::Mask_RhythmMode) != 0;
+ bool rm_cmf = m_cmfPercussionMode && (channel >= 11);
+
+ if(synth.m_rhythmMode && (rm_ains || rm_cmf))
voices[1] = voices[0];//i[1] = i[0];
- }
bool isBlankNote = (ains->flags & OplInstMeta::Flag_NoSound) != 0;
@@ -507,24 +502,31 @@ bool MIDIplay::realTime_NoteOn(uint8_t channel, uint8_t note, uint8_t velocity)
if(synth.m_rhythmMode)
{
- if(m_cmfPercussionMode)
- {
- expected_mode = channel < 11 ? OPL3::ChanCat_Regular : (OPL3::ChanCat_Rhythm_Bass + (channel - 11)); // CMF
- }
+ if(m_cmfPercussionMode) // CMF
+ expected_mode = channel < 11 ? OPL3::ChanCat_Regular : (OPL3::ChanCat_Rhythm_Bass + (channel - 11));
else
{
- expected_mode = OPL3::ChanCat_Regular;
- uint32_t rm = (ains->flags & OplInstMeta::Mask_RhythmMode);
- if(rm == OplInstMeta::Flag_RM_BassDrum)
+ switch((ains->flags & OplInstMeta::Mask_RhythmMode))
+ {
+ default:
+ expected_mode = OPL3::ChanCat_Regular;
+ break;
+ case OplInstMeta::Flag_RM_BassDrum:
expected_mode = OPL3::ChanCat_Rhythm_Bass;
- else if(rm == OplInstMeta::Flag_RM_Snare)
+ break;
+ case OplInstMeta::Flag_RM_Snare:
expected_mode = OPL3::ChanCat_Rhythm_Snare;
- else if(rm == OplInstMeta::Flag_RM_TomTom)
+ break;
+ case OplInstMeta::Flag_RM_TomTom:
expected_mode = OPL3::ChanCat_Rhythm_Tom;
- else if(rm == OplInstMeta::Flag_RM_Cymbal)
+ break;
+ case OplInstMeta::Flag_RM_Cymbal:
expected_mode = OPL3::ChanCat_Rhythm_Cymbal;
- else if(rm == OplInstMeta::Flag_RM_HiHat)
+ break;
+ case OplInstMeta::Flag_RM_HiHat:
expected_mode = OPL3::ChanCat_Rhythm_HiHat;
+ break;
+ }
}
}