aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--README.md1
-rw-r--r--src/adlmidi_midiplay.cpp7
-rw-r--r--src/adlmidi_private.hpp2
3 files changed, 10 insertions, 0 deletions
diff --git a/README.md b/README.md
index 3106ba1..ff9f82d 100644
--- a/README.md
+++ b/README.md
@@ -156,6 +156,7 @@ To build that example you will need to have installed SDL2 library.
* Added support for GS way of custom drum channels (through SysEx events)
* Ignore some NRPN events and lsb bank number when using GS standard (after catching of GS Reset SysEx call)
* Added support for CC66-Sostenuto controller (Pedal hold of currently-pressed notes only while CC64 holds also all next notes)
+ * Added support for CC67-SoftPedal controller (SoftPedal lowers the volume of notes played)
## 1.3.3 2018-06-19
* Fixed an inability to load another custom bank without of library re-initialization
diff --git a/src/adlmidi_midiplay.cpp b/src/adlmidi_midiplay.cpp
index d4bb4ff..a044859 100644
--- a/src/adlmidi_midiplay.cpp
+++ b/src/adlmidi_midiplay.cpp
@@ -464,6 +464,9 @@ bool MIDIplay::realTime_NoteOn(uint8_t channel, uint8_t note, uint8_t velocity)
//if(hooks.onDebugMessage)
// hooks.onDebugMessage(hooks.onDebugMessage_userData, "i1=%d:%d, i2=%d:%d", i[0],adlchannel[0], i[1],adlchannel[1]);
+ if(midiChan.softPedal) // Apply Soft Pedal level reducing
+ velocity = static_cast<uint8_t>(std::floor(static_cast<float>(velocity) * 0.8f));
+
// Allocate active note for MIDI channel
std::pair<MIDIchannel::activenoteiterator, bool>
ir = midiChan.activenotes_insert(note);
@@ -598,6 +601,10 @@ void MIDIplay::realTime_Controller(uint8_t channel, uint8_t type, uint8_t value)
KillSustainingNotes(channel, -1, AdlChannel::LocationData::Sustain_Sostenuto);
break;
+ case 67: // Enable/disable soft-pedal
+ Ch[channel].softPedal = (value >= 64);
+ break;
+
case 11: // Change expression (another volume factor)
Ch[channel].expression = value;
NoteUpdate_All(channel, Upd_Volume);
diff --git a/src/adlmidi_private.hpp b/src/adlmidi_private.hpp
index 1d68bae..840ba21 100644
--- a/src/adlmidi_private.hpp
+++ b/src/adlmidi_private.hpp
@@ -352,6 +352,7 @@ public:
uint8_t panning, vibrato, aftertouch;
uint16_t portamento;
bool sustain;
+ bool softPedal;
bool portamentoEnable;
int8_t portamentoSource; // note number or -1
double portamentoRate;
@@ -566,6 +567,7 @@ public:
volume = 100;
expression = 127;
sustain = false;
+ softPedal = false;
vibrato = 0;
aftertouch = 0;
std::memset(noteAftertouch, 0, 128);