Browse Source

Type into MidiCcChoices

tags/v0.6.1
Andrew Belt 7 years ago
parent
commit
fafb63a26d
2 changed files with 32 additions and 2 deletions
  1. +1
    -1
      CHANGELOG.md
  2. +31
    -1
      src/Core/MIDICCToCVInterface.cpp

+ 1
- 1
CHANGELOG.md View File

@@ -6,7 +6,7 @@
- Added JACK support on Linux - Added JACK support on Linux
- Added velocity mode to MIDI-Trig - Added velocity mode to MIDI-Trig
- Added MIDI multiplexing so multiple MIDI modules can use the same MIDI device on Windows - Added MIDI multiplexing so multiple MIDI modules can use the same MIDI device on Windows
- Make Module Browser layout more compact
- Made Module Browser layout more compact
- Add power meter - Add power meter
- Add icons to toolbar - Add icons to toolbar
- [VCV Bridge](https://vcvrack.com/manual/Bridge.html) 0.6.1 - [VCV Bridge](https://vcvrack.com/manual/Bridge.html) 0.6.1


+ 31
- 1
src/Core/MIDICCToCVInterface.cpp View File

@@ -1,6 +1,7 @@
#include "Core.hpp" #include "Core.hpp"
#include "midi.hpp" #include "midi.hpp"
#include "dsp/filter.hpp" #include "dsp/filter.hpp"
#include "window.hpp"




struct MIDICCToCVInterface : Module { struct MIDICCToCVInterface : Module {
@@ -106,6 +107,7 @@ struct MIDICCToCVInterface : Module {
struct MidiCcChoice : GridChoice { struct MidiCcChoice : GridChoice {
MIDICCToCVInterface *module; MIDICCToCVInterface *module;
int id; int id;
int focusCc;


MidiCcChoice() { MidiCcChoice() {
box.size.y = mm2px(6.666); box.size.y = mm2px(6.666);
@@ -118,7 +120,10 @@ struct MidiCcChoice : GridChoice {


void step() override { void step() override {
if (module->learningId == id) { if (module->learningId == id) {
text = "LRN";
if (0 <= focusCc)
text = stringf("%d", focusCc);
else
text = "LRN";
color.a = 0.5; color.a = 0.5;
} }
else { else {
@@ -132,11 +137,36 @@ struct MidiCcChoice : GridChoice {
void onFocus(EventFocus &e) override { void onFocus(EventFocus &e) override {
e.consumed = true; e.consumed = true;
module->learningId = id; module->learningId = id;
focusCc = -1;
} }


void onDefocus(EventDefocus &e) override { void onDefocus(EventDefocus &e) override {
if (0 <= focusCc && focusCc < 128) {
module->learnedCcs[id] = focusCc;
}
module->learningId = -1; module->learningId = -1;
} }

void onText(EventText &e) override {
char c = e.codepoint;
if ('0' <= c && c <= '9') {
if (focusCc < 0)
focusCc = 0;
focusCc = focusCc * 10 + (c - '0');
}
e.consumed = true;
}

void onKey(EventKey &e) override {
if (gFocusedWidget == this) {
if (e.key == GLFW_KEY_ENTER || e.key == GLFW_KEY_KP_ENTER) {
EventDefocus eDefocus;
onDefocus(eDefocus);
gFocusedWidget = NULL;
e.consumed = true;
}
}
}
}; };






Loading…
Cancel
Save