| 423 | } |
| 424 | |
| 425 | void NoteStepSequencer::GridUpdated(UIGrid* grid, int col, int row, float value, float oldValue) |
| 426 | { |
| 427 | if (grid == mGrid) |
| 428 | { |
| 429 | for (int i = 0; i < mGrid->GetCols(); ++i) |
| 430 | { |
| 431 | bool colHasPitch = false; |
| 432 | for (int j = 0; j < mGrid->GetRows(); ++j) |
| 433 | { |
| 434 | float val = mGrid->GetVal(i, j); |
| 435 | if (val > 0) |
| 436 | { |
| 437 | mTones[i] = j; |
| 438 | mNoteLengths[i] = val; |
| 439 | colHasPitch = true; |
| 440 | break; |
| 441 | } |
| 442 | } |
| 443 | |
| 444 | if (!colHasPitch) |
| 445 | mVels[i] = 0; |
| 446 | else if (colHasPitch && mVels[i] == 0) |
| 447 | mVels[i] = gStepVelocityLevels[(int)StepVelocityType::Normal] * 127; |
| 448 | mVelocityGrid->SetVal(i, 0, mVels[i] / 127.0f, false); |
| 449 | } |
| 450 | } |
| 451 | if (grid == mVelocityGrid) |
| 452 | { |
| 453 | for (int i = 0; i < mVelocityGrid->GetCols(); ++i) |
| 454 | mVels[i] = mVelocityGrid->GetVal(i, 0) * 127; |
| 455 | SyncGridToSeq(); |
| 456 | } |
| 457 | } |
| 458 | |
| 459 | int NoteStepSequencer::RowToPitch(int row) |
| 460 | { |