From aa61a4257aab60fa1e354ad0b711146db0ba2ba3 Mon Sep 17 00:00:00 2001 From: Vitaly Novichkov Date: Tue, 10 Apr 2018 03:17:14 +0300 Subject: Added support for CC120 "All sounds off" (#48) --- src/adlmidi_midiplay.cpp | 9 ++++++++- src/adlmidi_private.hpp | 4 +++- 2 files changed, 11 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/adlmidi_midiplay.cpp b/src/adlmidi_midiplay.cpp index 7b15349..b053f01 100644 --- a/src/adlmidi_midiplay.cpp +++ b/src/adlmidi_midiplay.cpp @@ -1338,6 +1338,10 @@ void MIDIplay::realTime_Controller(uint8_t channel, uint8_t type, uint8_t value) KillSustainingNotes(channel); break; + case 120: // All sounds off + NoteUpdate_All(channel, Upt_OffMute); + break; + case 123: // All notes off NoteUpdate_All(channel, Upd_Off); break; @@ -1490,7 +1494,8 @@ void MIDIplay::NoteUpdate(uint16_t MidCh, uint16_t c = j->first; const MIDIchannel::NoteInfo::Phys &ins = j->second; - if(select_adlchn >= 0 && c != select_adlchn) continue; + if(select_adlchn >= 0 && c != select_adlchn) + continue; if(props_mask & Upd_Off) // note off { @@ -1507,6 +1512,8 @@ void MIDIplay::NoteUpdate(uint16_t MidCh, if(ch[c].users.empty()) { opl.NoteOff(c); + if(props_mask & Upd_Mute) // Mute the note + opl.Touch_Real(c, 0); ch[c].koff_time_until_neglible = ains.ms_sound_koff; } diff --git a/src/adlmidi_private.hpp b/src/adlmidi_private.hpp index 82a6627..4f727e2 100644 --- a/src/adlmidi_private.hpp +++ b/src/adlmidi_private.hpp @@ -943,7 +943,9 @@ private: Upd_Volume = 0x4, Upd_Pitch = 0x8, Upd_All = Upd_Pan + Upd_Volume + Upd_Pitch, - Upd_Off = 0x20 + Upd_Off = 0x20, + Upd_Mute = 0x40, + Upt_OffMute = Upd_Off + Upd_Mute }; void NoteUpdate(uint16_t MidCh, -- cgit v1.2.3