From 4e1b39236d836ca6335df01ead0f54a9ff71ff08 Mon Sep 17 00:00:00 2001 From: Volker Fischer Date: Sat, 19 Jan 2019 08:19:31 +0000 Subject: [PATCH] implement MIDI controller parsing (first version, not yet tested) --- src/soundbase.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/soundbase.cpp b/src/soundbase.cpp index a4684a2b..22de2937 100755 --- a/src/soundbase.cpp +++ b/src/soundbase.cpp @@ -124,13 +124,21 @@ printf ( "\n" ); // make sure paket is long enough if ( vMIDIPaketBytes.Size() > 2 ) { + // we are assuming that the controller number is the same + // as the audio fader index and the range is 0-127 + const int iFaderLevel = static_cast ( static_cast ( + qMin ( vMIDIPaketBytes[2], uint8_t ( 127 ) ) ) / 127 * AUD_MIX_FADER_MAX ); + EmitControllerInFaderLevel ( vMIDIPaketBytes[1], iFaderLevel ); + +/* // TEST TD-20 Hi-Hat control for fader 0 level if ( vMIDIPaketBytes[1] == 4 ) { const int iFaderLevel = static_cast ( static_cast ( vMIDIPaketBytes[2] ) / 256 * AUD_MIX_FADER_MAX ); EmitControllerInFaderLevel ( 0, AUD_MIX_FADER_MAX - iFaderLevel ); // invert fader } +*/ } }