| 496 | } |
| 497 | |
| 498 | bool NoteTable::OnPush2Control(Push2Control* push2, MidiMessageType type, int controlIndex, float midiValue) |
| 499 | { |
| 500 | if (mPush2GridDisplayMode == Push2GridDisplayMode::PerStep) |
| 501 | { |
| 502 | int sequenceRows, pitchCols, pitchRows; |
| 503 | GetPush2Layout(sequenceRows, pitchCols, pitchRows); |
| 504 | |
| 505 | if (type == kMidiMessage_Note) |
| 506 | { |
| 507 | if (controlIndex >= 36 && controlIndex <= 99) |
| 508 | { |
| 509 | int gridIndex = controlIndex - 36; |
| 510 | int x = gridIndex % 8; |
| 511 | int y = 7 - gridIndex / 8; |
| 512 | |
| 513 | if (y < sequenceRows) |
| 514 | { |
| 515 | int index = x + y * 8; |
| 516 | if (midiValue > 0) |
| 517 | mPush2HeldStep = index; |
| 518 | else if (index == mPush2HeldStep) |
| 519 | mPush2HeldStep = -1; |
| 520 | } |
| 521 | else if (y < sequenceRows + pitchRows) |
| 522 | { |
| 523 | if (midiValue > 0) |
| 524 | { |
| 525 | int index = x + (pitchRows - 1 - (y - sequenceRows)) * pitchCols; |
| 526 | if (index < 0 || index >= mNoteRange) |
| 527 | { |
| 528 | //out of range, do nothing |
| 529 | } |
| 530 | else if (mPush2HeldStep != -1) |
| 531 | { |
| 532 | mGrid->SetVal(mPush2HeldStep, index, mGrid->GetVal(mPush2HeldStep, index) > 0 ? 0 : 1); |
| 533 | } |
| 534 | else |
| 535 | { |
| 536 | //I'm not liking this "queued pitch" behavior, let's disable it for now |
| 537 | //mQueuedPitches[RowToPitch(index)] = true; |
| 538 | } |
| 539 | } |
| 540 | } |
| 541 | |
| 542 | return true; |
| 543 | } |
| 544 | } |
| 545 | } |
| 546 | else if (mPush2GridDisplayMode == Push2GridDisplayMode::GridView) |
| 547 | { |
| 548 | if (type == kMidiMessage_Note) |
| 549 | { |
| 550 | int gridIndex = controlIndex - 36; |
| 551 | int x = gridIndex % 8; |
| 552 | int y = gridIndex / 8; |
| 553 | int col = x + mGridControlOffsetX; |
| 554 | int row = y + mGridControlOffsetY; |
| 555 | if (gridIndex >= 0 && gridIndex < 64 && |
nothing calls this directly
no test coverage detected