| 896 | } |
| 897 | |
| 898 | void StepSequencer::DropdownUpdated(DropdownList* list, int oldVal, double time) |
| 899 | { |
| 900 | if (list == mRepeatRateDropdown) |
| 901 | { |
| 902 | for (int i = 0; i < NUM_STEPSEQ_ROWS; ++i) |
| 903 | mNoteRepeats[i]->SetInterval(mRepeatRate); |
| 904 | } |
| 905 | if (list == mStepIntervalDropdown) |
| 906 | { |
| 907 | UIGrid* oldGrid = new UIGrid(*mGrid); |
| 908 | int oldNumSteps = GetNumSteps((NoteInterval)oldVal, mNumMeasures); |
| 909 | int newNumSteps = GetNumSteps(mStepInterval, mNumMeasures); |
| 910 | for (int i = 0; i < mGrid->GetRows(); ++i) |
| 911 | { |
| 912 | for (int j = 0; j < newNumSteps; ++j) |
| 913 | { |
| 914 | float div = j * ((float)oldNumSteps / newNumSteps); |
| 915 | int col = (int)div; |
| 916 | if (div == col) |
| 917 | mGrid->SetVal(j, i, oldGrid->GetVal(col, i)); |
| 918 | else |
| 919 | mGrid->SetVal(j, i, 0); |
| 920 | } |
| 921 | } |
| 922 | oldGrid->Delete(); |
| 923 | TransportListenerInfo* transportListenerInfo = TheTransport->GetListenerInfo(this); |
| 924 | if (transportListenerInfo != nullptr) |
| 925 | transportListenerInfo->mInterval = mStepInterval; |
| 926 | mFlusher.SetInterval(mStepInterval); |
| 927 | mGrid->SetMajorColSize(TheTransport->CountInStandardMeasure(mStepInterval) / 4); |
| 928 | for (int i = 0; i < NUM_STEPSEQ_ROWS; ++i) |
| 929 | mRows[i]->UpdateTimeListener(); |
| 930 | } |
| 931 | if (list == mVelocityTypeDropdown) |
| 932 | { |
| 933 | switch (mVelocityType) |
| 934 | { |
| 935 | case StepVelocityType::Normal: |
| 936 | mStrength = gStepVelocityLevels[(int)StepVelocityType::Normal]; |
| 937 | break; |
| 938 | case StepVelocityType::Accent: |
| 939 | mStrength = gStepVelocityLevels[(int)StepVelocityType::Accent]; |
| 940 | break; |
| 941 | case StepVelocityType::Ghost: |
| 942 | mStrength = gStepVelocityLevels[(int)StepVelocityType::Ghost]; |
| 943 | break; |
| 944 | default: |
| 945 | break; |
| 946 | } |
| 947 | mGrid->SetStrength(mStrength); |
| 948 | } |
| 949 | } |
| 950 | |
| 951 | void StepSequencer::KeyPressed(int key, bool isRepeat) |
| 952 | { |
nothing calls this directly
no test coverage detected