MCPcopy Create free account
hub / github.com/BespokeSynth/BespokeSynth / MidiReceived

Method MidiReceived

Source/MidiController.cpp:495–711  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

493}
494
495void MidiController::MidiReceived(MidiMessageType messageType, int control, float value, int rawValue, int channel)
496{
497 assert(mEnabled);
498
499 mLastActivityBound = false;
500 //if (value > 0)
501 mLastActivityTime = gTime;
502
503 GetLayoutControl(control, messageType).mLastActivityTime = gTime;
504 GetLayoutControl(control, messageType).mLastValue = value;
505
506 if (JustBoundControl()) //no midi messages if we just bound something, to avoid changing that thing we just bound
507 return;
508
509 if (messageType == kMidiMessage_Control)
510 mLastInput = "cc ";
511 if (messageType == kMidiMessage_Note)
512 mLastInput = "note ";
513 if (messageType == kMidiMessage_Program)
514 mLastInput = "program change ";
515 if (messageType == kMidiMessage_PitchBend)
516 mLastInput = "pitchbend";
517
518 if (messageType != kMidiMessage_PitchBend)
519 mLastInput += ofToString(control);
520
521 mLastInput += ", value: " + ofToString(value, 2) + " (" + ofToString(rawValue) + "), channel: " + ofToString(channel);
522
523 if (mBindMode && gBindToUIControl)
524 {
525 if (messageType == kMidiMessage_Control &&
526 mLayoutControls[GetLayoutControlIndexForMidi(messageType, control + 32)].m14BitMode)
527 {
528 //this is the MSB half of a 14-bit message, do nothing and let the LSB half bind
529 }
530 else
531 {
532 AddControlConnection(messageType, control, channel, gBindToUIControl);
533 sLastBoundControlTime = gTime;
534 sLastBoundUIControl = gBindToUIControl;
535 sLastBoundUIControl->StartBeacon();
536 gBindToUIControl = nullptr;
537 return;
538 }
539 }
540
541 if (Push2Control::sBindToUIControl)
542 {
543 AddControlConnection(messageType, control, channel, Push2Control::sBindToUIControl);
544 sLastBoundControlTime = gTime;
545 sLastBoundUIControl = Push2Control::sBindToUIControl;
546 sLastBoundUIControl->StartBeacon();
547 Push2Control::sBindToUIControl = nullptr;
548 return;
549 }
550
551 if (mBindMode && gHoveredUIControl && (GetKeyModifiers() == kModifier_Shift))
552 {

Callers

nothing calls this directly

Calls 15

ofToStringFunction · 0.85
GetKeyModifiersFunction · 0.85
NextBufferTimeFunction · 0.85
ofLerpFunction · 0.85
GetGridControllerMethod · 0.80
sizeMethod · 0.80
OnInputMethod · 0.80
AddHistoryEventMethod · 0.80
StartBeaconMethod · 0.45
GetUIControlMethod · 0.45
GetMidiValueMethod · 0.45
SetFromMidiCCMethod · 0.45

Tested by

no test coverage detected