| 160 | } |
| 161 | |
| 162 | void DotSequencer::OnStep(double time, float velocity, int flags) |
| 163 | { |
| 164 | if (mEnabled) |
| 165 | { |
| 166 | mStepIdx = TheTransport->GetSyncedStep(time, this, mTransportListenerInfo, mDotGrid->GetCols()); |
| 167 | mDotGrid->SetHighlightCol(time, mStepIdx); |
| 168 | |
| 169 | for (int row = 0; row < mDotGrid->GetRows(); ++row) |
| 170 | { |
| 171 | const DotGrid::DotData& data = mDotGrid->GetDataAt(mStepIdx, row); |
| 172 | if (data.mOn) |
| 173 | { |
| 174 | int pitch = RowToPitch(row); |
| 175 | if (pitch >= 0 && pitch < 128) |
| 176 | { |
| 177 | bool played = false; |
| 178 | for (int i = 0; i < (int)mPlayingDots.size(); ++i) |
| 179 | { |
| 180 | if (!played && mPlayingDots[i].mPitch == -1) |
| 181 | { |
| 182 | mPlayingDots[i].mPitch = pitch; |
| 183 | mPlayingDots[i].mRow = row; |
| 184 | mPlayingDots[i].mCol = mStepIdx; |
| 185 | mPlayingDots[i].mPlayedTime = time; |
| 186 | played = true; |
| 187 | } |
| 188 | else if (mPlayingDots[i].mPitch == pitch) |
| 189 | { |
| 190 | mNoteOutput.PlayNote(time, pitch, 0); //note off any colliding pitches |
| 191 | mPlayingDots[i].mPitch = -1; |
| 192 | } |
| 193 | } |
| 194 | |
| 195 | mNoteOutput.PlayNote(time, pitch, std::max(int(data.mVelocity * 127), 1)); |
| 196 | mDotGrid->OnPlayed(time, mStepIdx, row); |
| 197 | } |
| 198 | } |
| 199 | } |
| 200 | } |
| 201 | } |
| 202 | |
| 203 | void DotSequencer::OnTransportAdvanced(float amount) |
| 204 | { |
nothing calls this directly
no test coverage detected