Browse Source

Update midi modules for refactor of event framework (8e251c0ddb)

tags/v0.5.0
ben 7 years ago
parent
commit
a18eac9a0c
6 changed files with 35 additions and 28 deletions
  1. +12
    -8
      src/core/MidiCCToCV.cpp
  2. +2
    -2
      src/core/MidiClockToCV.cpp
  3. +4
    -4
      src/core/MidiIO.cpp
  4. +4
    -4
      src/core/MidiIO.hpp
  5. +11
    -8
      src/core/MidiTriggerToCV.cpp
  6. +2
    -2
      src/core/QuadMidiToCV.cpp

+ 12
- 8
src/core/MidiCCToCV.cpp View File

@@ -169,11 +169,11 @@ struct CCTextField : TextField {

void draw(NVGcontext *vg);

void onMouseDownOpaque(int button);
void onMouseDown(EventMouseDown &e);

void onMouseUpOpaque(int button);
void onMouseUp(EventMouseUp &e);

void onMouseLeave();
void onMouseLeave(EventMouseLeave &e);

int outNum;

@@ -196,21 +196,25 @@ void CCTextField::draw(NVGcontext *vg) {
TextField::draw(vg);
}

void CCTextField::onMouseUpOpaque(int button) {
if (button == 1) {
void CCTextField::onMouseUp(EventMouseUp &e) {
if (e.button == 1) {
module->cc[outNum].numSelected = false;
e.consumed = true;
}


}

void CCTextField::onMouseDownOpaque(int button) {
if (button == 1) {
void CCTextField::onMouseDown(EventMouseDown &e) {
if (e.button == 1) {
module->cc[outNum].numSelected = true;
e.consumed = true;
}
}

void CCTextField::onMouseLeave() {
void CCTextField::onMouseLeave(EventMouseLeave &e) {
module->cc[outNum].numSelected = false;
e.consumed = true;
}




+ 2
- 2
src/core/MidiClockToCV.cpp View File

@@ -210,7 +210,7 @@ struct ClockRatioItem : MenuItem {
int ratio;
int *clockRatio;

void onAction() {
void onAction(EventAction &e) {
*clockRatio = ratio;
}
};
@@ -226,7 +226,7 @@ struct ClockRatioChoice : ChoiceButton {
const std::vector<std::string> ratioNames_short = {"1:4 ratio", "1:3 ratio", "1:2 ratio", "2:3 ratio", "1:1 ratio",
"4:3", "2:1 ratio", "4:1 ratio", "8:1 ratio"};

void onAction() {
void onAction(EventAction &e) {
Menu *menu = gScene->createMenu();
menu->box.pos = getAbsoluteOffset(Vec(0, box.size.y)).round();
menu->box.size.x = box.size.x;


+ 4
- 4
src/core/MidiIO.cpp View File

@@ -195,11 +195,11 @@ void MidiIO::close() {
}


void MidiItem::onAction() {
void MidiItem::onAction(EventAction &e) {
midiModule->openDevice(text);
}

void MidiChoice::onAction() {
void MidiChoice::onAction(EventAction &e) {
Menu *menu = gScene->createMenu();
menu->box.pos = getAbsoluteOffset(Vec(0, box.size.y)).round();
menu->box.size.x = box.size.x;
@@ -229,12 +229,12 @@ void MidiChoice::step() {
text = ellipsize(name, 15);
}

void ChannelItem::onAction() {
void ChannelItem::onAction(EventAction &e) {
midiModule->resetMidi(); // reset Midi values
midiModule->setChannel(channel);
}

void ChannelChoice::onAction() {
void ChannelChoice::onAction(EventAction &e) {
Menu *menu = gScene->createMenu();
menu->box.pos = getAbsoluteOffset(Vec(0, box.size.y)).round();
menu->box.size.x = box.size.x;


+ 4
- 4
src/core/MidiIO.hpp View File

@@ -174,13 +174,13 @@ struct TransitionSmoother {
struct MidiItem : MenuItem {
MidiIO *midiModule;

void onAction();
void onAction(EventAction &e);
};

struct MidiChoice : ChoiceButton {
MidiIO *midiModule;

void onAction();
void onAction(EventAction &e);

void step();
};
@@ -189,13 +189,13 @@ struct ChannelItem : MenuItem {
MidiIO *midiModule;
int channel;

void onAction();
void onAction(EventAction &e);
};

struct ChannelChoice : ChoiceButton {
MidiIO *midiModule;

void onAction();
void onAction(EventAction &e);

void step();
};


+ 11
- 8
src/core/MidiTriggerToCV.cpp View File

@@ -135,11 +135,11 @@ struct TriggerTextField : TextField {

void draw(NVGcontext *vg);

void onMouseDownOpaque(int button);
void onMouseDown(EventMouseDown &e);

void onMouseUpOpaque(int button);
void onMouseUp(EventMouseUp &e);

void onMouseLeave();
void onMouseLeave(EventMouseLeave &e);

int outNum;
MIDITriggerToCVInterface *module;
@@ -180,21 +180,24 @@ void TriggerTextField::onTextChange() {
};
}

void TriggerTextField::onMouseUpOpaque(int button) {
if (button == 1) {
void TriggerTextField::onMouseUp(EventMouseUp &e) {
if (e.button == 1) {
module->trigger[outNum].onFocus = false;
e.consumed = true;
}

}

void TriggerTextField::onMouseDownOpaque(int button) {
if (button == 1) {
void TriggerTextField::onMouseDown(EventMouseDown &e) {
if (e.button == 1) {
module->trigger[outNum].onFocus = true;
e.consumed = true;
}
}

void TriggerTextField::onMouseLeave() {
void TriggerTextField::onMouseLeave(EventMouseLeave &e) {
module->trigger[outNum].onFocus = false;
e.consumed = true;
}

MIDITriggerToCVWidget::MIDITriggerToCVWidget() {


+ 2
- 2
src/core/QuadMidiToCV.cpp View File

@@ -254,7 +254,7 @@ struct ModeItem : MenuItem {
int mode;
QuadMIDIToCVInterface *module;

void onAction() {
void onAction(EventAction &e) {
module->setMode(mode);
}
};
@@ -264,7 +264,7 @@ struct ModeChoice : ChoiceButton {
const std::vector<std::string> modeNames = {"ROTATE", "RESET", "REASSIGN"};


void onAction() {
void onAction(EventAction &e) {
Menu *menu = gScene->createMenu();
menu->box.pos = getAbsoluteOffset(Vec(0, box.size.y)).round();
menu->box.size.x = box.size.x;


Loading…
Cancel
Save