| 493 | } |
| 494 | |
| 495 | void 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 | { |
nothing calls this directly
no test coverage detected