From 6af4f3f1412e2225476c8c44cfb6b5427f05a6b5 Mon Sep 17 00:00:00 2001 From: jhpoelen Date: Sun, 10 Feb 2019 15:24:00 -0800 Subject: [PATCH] change static midi key mapping --- src/ofPooks.cpp | 211 +++++++++++++++++++++++------------------------- src/ofPooks.h | 4 +- 2 files changed, 102 insertions(+), 113 deletions(-) diff --git a/src/ofPooks.cpp b/src/ofPooks.cpp index c17a64e..ffcd936 100644 --- a/src/ofPooks.cpp +++ b/src/ofPooks.cpp @@ -369,131 +369,120 @@ void ofPooks::renderWarpTool(int screenNumber) { } -void ofPooks::newMidiMessage(ofxMidiMessage& eventArgs) { +void ofPooks::newMidiMessage(ofxMidiMessage& midiMsg) { - // store some data from midi message in variables - value = eventArgs.control; - value2 = eventArgs.value; - id = eventArgs.channel; + // store some data from midi message in variables + control = midiMsg.control; + value = midiMsg.value; + channel = midiMsg.channel; - sprintf(msg, "value: (%i,%i), received from port: %i, id: %i \n\nwith %f milliseconds difference from last message",value,value2,port,id,timestamp); - ofLog(OF_LOG_NOTICE, "%s", msg); - float normValue2 = value2 / 16384.0f; - if (id == 1 && value == 7) { + sprintf(msg, "value: (%i,%i), received from port: %i, id: %i \n\nwith %f milliseconds difference from last message",control,value,port,channel,timestamp); + ofLog(OF_LOG_NOTICE, "%s", msg); + + float normValue2 = value / 127.0f; + if (control == 0) { int newSampleIndex = normValue2 * (samples.size() - 1); selectSampleIndex(newSampleIndex); - } else if (id == 2 && value == 7) { - for (int j=0; j 0 && id <= MAX_SCREENS) { - if (screenSettings[id-1].canEdit) { - screenSettings[id-1].alpha = normValue2; - } - } else if (id == 9) { - masterAlpha = normValue2; - masterVolume = normValue2; + } else if (control == 7) { + for (int j=0; j= 16 && control < (16 + MAX_SCREENS)) { + if (screenSettings[control-16].canEdit) { + screenSettings[control-16].alpha = normValue2; } - - if (value == 16) { - for (int i=0; i 0 && id <= MAX_LAYERS) { - screenLayerSettings[i][id-1].canEdit = normValue2 == 1.0; - } - } - } + } else if (control >= 48 && control < 48 + MAX_LAYERS) { + for (int i=0; i