| 534 | } |
| 535 | |
| 536 | bool NoteStepSequencer::OnPush2Control(Push2Control* push2, MidiMessageType type, int controlIndex, float midiValue) |
| 537 | { |
| 538 | if (mPush2GridDisplayMode == Push2GridDisplayMode::PerStep) |
| 539 | { |
| 540 | int sequenceRows, pitchCols, pitchRows; |
| 541 | GetPush2Layout(sequenceRows, pitchCols, pitchRows); |
| 542 | |
| 543 | if (type == kMidiMessage_Note) |
| 544 | { |
| 545 | if (controlIndex == 12) |
| 546 | { |
| 547 | mPush2VelocityHeld = (midiValue > 0); |
| 548 | return true; |
| 549 | } |
| 550 | |
| 551 | if (controlIndex >= 36 && controlIndex <= 99) |
| 552 | { |
| 553 | int gridIndex = controlIndex - 36; |
| 554 | int x = gridIndex % 8; |
| 555 | int y = 7 - gridIndex / 8; |
| 556 | |
| 557 | if (gridIndex >= 0 && gridIndex < 64 && y < sequenceRows) |
| 558 | { |
| 559 | int index = x + y * 8; |
| 560 | if (midiValue > 0) |
| 561 | { |
| 562 | mPush2HeldStep = index; |
| 563 | mPush2HeldStepWasEdited = false; |
| 564 | mPush2ButtonPressTime = gTime; |
| 565 | } |
| 566 | else if (index == mPush2HeldStep) |
| 567 | { |
| 568 | if (mVels[mPush2HeldStep] == 0) |
| 569 | mVels[mPush2HeldStep] = mQueuedPush2Vel; |
| 570 | else if (!mPush2HeldStepWasEdited && gTime - mPush2ButtonPressTime < 500) |
| 571 | mVels[index] = 0; |
| 572 | mPush2HeldStep = -1; |
| 573 | } |
| 574 | } |
| 575 | else if (y < sequenceRows + pitchRows) |
| 576 | { |
| 577 | if (midiValue > 0) |
| 578 | { |
| 579 | int index = x + (pitchRows - 1 - (y - sequenceRows)) * pitchCols; |
| 580 | if (index < 0 || index >= mNoteRange || x >= pitchCols) |
| 581 | { |
| 582 | //out of range |
| 583 | mQueuedPush2Tone = -2; |
| 584 | } |
| 585 | else if (mPush2HeldStep != -1) |
| 586 | { |
| 587 | mTones[mPush2HeldStep] = index; |
| 588 | mPush2HeldStepWasEdited = true; |
| 589 | } |
| 590 | else |
| 591 | { |
| 592 | mQueuedPush2Tone = index; |
| 593 | } |
nothing calls this directly
no test coverage detected