Browse Source

fix initialisation

tags/v0.4.0
ben 7 years ago
parent
commit
b421dd8471
1 changed files with 11 additions and 5 deletions
  1. +11
    -5
      src/core/MidiInterface.cpp

+ 11
- 5
src/core/MidiInterface.cpp View File

@@ -611,18 +611,24 @@ void MIDICCToCVInterface::processMidi(std::vector<unsigned char> msg) {


struct CCTextField : TextField { struct CCTextField : TextField {
void onTextChange(); void onTextChange();
void draw(NVGcontext *vg);
int *ccNum; int *ccNum;
bool *inited; 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() { void CCTextField::onTextChange() {
if (text.size() > 0) { if (text.size() > 0) {
if (*inited) {
*inited = false;
text = std::to_string(*ccNum);
}

try { try {
*ccNum = std::stoi(text); *ccNum = std::stoi(text);
// Only allow valid cc numbers // Only allow valid cc numbers


Loading…
Cancel
Save