Mercurial > hg > touchkeys
changeset 43:fa39caec190b
Fix to default values of MIDI controllers
author | Andrew McPherson <andrewm@eecs.qmul.ac.uk> |
---|---|
date | Sat, 23 Aug 2014 21:39:46 +0100 |
parents | 1526d2fbe01e |
children | 73576f49ad1c |
files | Source/Mappings/Control/TouchkeyControlMappingFactory.cpp Source/TouchKeys/MidiKeyboardSegment.cpp Source/TouchKeys/OscMidiConverter.cpp |
diffstat | 3 files changed, 15 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/Source/Mappings/Control/TouchkeyControlMappingFactory.cpp Thu Aug 21 17:02:39 2014 +0100 +++ b/Source/Mappings/Control/TouchkeyControlMappingFactory.cpp Sat Aug 23 21:39:46 2014 +0100 @@ -240,6 +240,7 @@ properties.setValue("ignoresTwoFingers", ignoresTwoFingers_); properties.setValue("ignoresThreeFingers", ignoresThreeFingers_); properties.setValue("direction", direction_); + properties.setValue("use14Bit", use14BitControl_); XmlElement* preset = properties.createXml("MappingFactory"); preset->setAttribute("type", "Control"); @@ -277,6 +278,11 @@ ignoresThreeFingers_ = properties.getBoolValue("ignoresThreeFingers"); direction_ = properties.getIntValue("direction"); + // These values added to later versions of the presets so check + // whether they actually exist or not + if(properties.containsKey("use14Bit")) + use14BitControl_ = properties.getBoolValue("use14Bit"); + // Update MIDI information; this doesn't actually change the controller // (which is already set) but it adds a listener and updates the ranges setController(midiControllerNumber_);
--- a/Source/TouchKeys/MidiKeyboardSegment.cpp Thu Aug 21 17:02:39 2014 +0100 +++ b/Source/TouchKeys/MidiKeyboardSegment.cpp Sat Aug 23 21:39:46 2014 +0100 @@ -39,7 +39,7 @@ #include <string> #include <sstream> -#define DEBUG_MIDI_KEYBOARD_SEGMENT +#undef DEBUG_MIDI_KEYBOARD_SEGMENT const int MidiKeyboardSegment::kMidiControllerDamperPedal = 64; const int MidiKeyboardSegment::kPedalActiveValue = 64;
--- a/Source/TouchKeys/OscMidiConverter.cpp Thu Aug 21 17:02:39 2014 +0100 +++ b/Source/TouchKeys/OscMidiConverter.cpp Sat Aug 23 21:39:46 2014 +0100 @@ -23,7 +23,7 @@ #include "OscMidiConverter.h" #include "MidiKeyboardSegment.h" -#undef DEBUG_OSC_MIDI_CONVERTER +#define DEBUG_OSC_MIDI_CONVERTER // Main constructor: set up OSC reception from the keyboard OscMidiConverter::OscMidiConverter(PianoKeyboard& keyboard, MidiKeyboardSegment& segment, int controllerId) : @@ -73,8 +73,13 @@ if(centerValue >= 0) controlCenterValue_ = centerValue; - else - controlCenterValue_ = controlDefaultValue_; + else { + // Set center value with same procedure as default value + if(controller_ == MidiKeyboardSegment::kControlPitchWheel) + controlCenterValue_ = 8192; + else + controlCenterValue_ = 0; + } // Pitch wheel is always 14 bit. Aftertouch is always 7 bit. // Other CCs are selectable (though according to MIDI spec not every