diff --git a/src/core/MidiInterface.cpp b/src/core/MidiInterface.cpp index 63585bbd..d6d5f46a 100644 --- a/src/core/MidiInterface.cpp +++ b/src/core/MidiInterface.cpp @@ -611,18 +611,24 @@ void MIDICCToCVInterface::processMidi(std::vector msg) { struct CCTextField : TextField { void onTextChange(); + void draw(NVGcontext *vg); int *ccNum; bool *inited; }; +void CCTextField::draw(NVGcontext *vg) { + /* This is necessary, since the save + * file is loaded after constructing the widget*/ + if (*inited) { + *inited = false; + text = std::to_string(*ccNum); + } + + TextField::draw(vg); +} void CCTextField::onTextChange() { if (text.size() > 0) { - if (*inited) { - *inited = false; - text = std::to_string(*ccNum); - } - try { *ccNum = std::stoi(text); // Only allow valid cc numbers