void gController::__cb_recAction() { glue_startStopActionRec(); }
int gKeyboard::handle(int e) { int ret = Fl_Group::handle(e); // assume the buttons won't handle the Keyboard events switch (e) { case FL_FOCUS: case FL_UNFOCUS: { ret = 1; // enables receiving Keyboard events break; } case FL_SHORTCUT: // in case widget that isn't ours has focus case FL_KEYDOWN: // Keyboard key pushed case FL_KEYUP: { // Keyboard key released /* rewind session. Avoid retrigs */ if (e == FL_KEYDOWN) { if (Fl::event_key() == FL_BackSpace && !bckspcPressed) { bckspcPressed = true; glue_rewindSeq(); ret = 1; break; } else if (Fl::event_key() == FL_End && !endPressed) { endPressed = true; glue_startStopInputRec(false); // update gui ret = 1; break; } else if (Fl::event_key() == FL_Enter && !enterPressed) { enterPressed = true; glue_startStopActionRec(false); // update gui ret = 1; break; } else if (Fl::event_key() == ' ' && !spacePressed) { spacePressed = true; glue_startStopSeq(false); // update gui ret = 1; break; } } else if (e == FL_KEYUP) { if (Fl::event_key() == FL_BackSpace) bckspcPressed = false; else if (Fl::event_key() == FL_End) endPressed = false; else if (Fl::event_key() == ' ') spacePressed = false; else if (Fl::event_key() == FL_Enter) enterPressed = false; } /* Walk button arrays, trying to match button's label with the Keyboard event. * If found, set that button's value() based on up/down event, * and invoke that button's callback() */ for (unsigned i=0; i<columns.size(); i++) for (int k=1; k<columns.at(i)->children(); k++) ret &= ((geChannel*)columns.at(i)->child(k))->keyPress(e); break; } } return ret; }
void callback(double t, std::vector<unsigned char> *msg, void *data) { /* 0.8.0 - for now we handle other midi signals (common and real-time * messages) as unknown, for debugging purposes */ if (msg->size() < 3) { printf("[KM] MIDI received - unkown signal - size=%d, value=0x", (int) msg->size()); for (unsigned i=0; i<msg->size(); i++) printf("%X", (int) msg->at(i)); printf("\n"); return; } /* in this place we want to catch two things: a) note on/note off * from a keyboard and b) knob/wheel/slider movements from a * controller */ uint32_t input = getIValue(msg->at(0), msg->at(1), msg->at(2)); uint32_t chan = input & 0x0F000000; uint32_t value = input & 0x0000FF00; uint32_t pure = input & 0xFFFF0000; // input without 'value' byte printf("[KM] MIDI received - 0x%X (chan %d)", input, chan >> 24); /* start dispatcher. If midi learn is on don't parse channels, just * learn incoming midi signal. Otherwise process master events first, * then each channel in the stack. This way incoming signals don't * get processed by glue_* when midi learning is on. */ if (cb_learn) { printf("\n"); cb_learn(pure, cb_data); } else { /* process master events */ if (pure == G_Conf.midiInRewind) { printf(" >>> rewind (global) (pure=0x%X)", pure); glue_rewindSeq(); } else if (pure == G_Conf.midiInStartStop) { printf(" >>> startStop (global) (pure=0x%X)", pure); glue_startStopSeq(); } else if (pure == G_Conf.midiInActionRec) { printf(" >>> actionRec (global) (pure=0x%X)", pure); glue_startStopActionRec(); } else if (pure == G_Conf.midiInInputRec) { printf(" >>> inputRec (global) (pure=0x%X)", pure); glue_startStopInputRec(false, false); // update gui, no popup messages } else if (pure == G_Conf.midiInMetronome) { printf(" >>> metronome (global) (pure=0x%X)", pure); glue_startStopMetronome(false); } else if (pure == G_Conf.midiInVolumeIn) { float vf = (value >> 8)/127.0f; printf(" >>> input volume (global) (pure=0x%X, value=%d, float=%f)", pure, value >> 8, vf); glue_setInVol(vf, false); } else if (pure == G_Conf.midiInVolumeOut) {