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 {
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


Loading…
Cancel
Save