From 4d785fdf37010a2678ab3e30951d91d26916a605 Mon Sep 17 00:00:00 2001
From: probonopd <probonopd@users.noreply.github.com>
Date: Thu, 17 Mar 2022 18:48:13 +0100
Subject: [PATCH] Add Sustain, #10

https://github.com/probonopd/MiniDexed/issues/10#issuecomment-1068434590
Thanks @rsta2
---
 src/mididevice.cpp | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/src/mididevice.cpp b/src/mididevice.cpp
index 16164cb..d5559dd 100644
--- a/src/mididevice.cpp
+++ b/src/mididevice.cpp
@@ -34,6 +34,7 @@
 	#define MIDI_CC_MODULATION		1
 	#define MIDI_CC_VOLUME			7
 	#define MIDI_CC_BANK_SELECT_LSB		32
+	#define MIDI_CC_BANK_SUSTAIN		64
 #define MIDI_PROGRAM_CHANGE	0b1100
 #define MIDI_PITCH_BEND		0b1110
 
@@ -144,6 +145,10 @@ void CMIDIDevice::MIDIMessageHandler (const u8 *pMessage, size_t nLength, unsign
 		case MIDI_CC_BANK_SELECT_LSB:
 			m_pSynthesizer->BankSelectLSB (pMessage[2]);
 			break;
+
+		case MIDI_CC_BANK_SUSTAIN:
+			m_pSynthesizer->setSustain (pMessage[2] >= 64);
+			break;
 		}
 		break;