MCPcopy Create free account
hub / github.com/BespokeSynth/BespokeSynth / OnStep

Method OnStep

Source/DotSequencer.cpp:162–201  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

160}
161
162void 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
203void DotSequencer::OnTransportAdvanced(float amount)
204{

Callers

nothing calls this directly

Calls 7

GetSyncedStepMethod · 0.80
sizeMethod · 0.80
OnPlayedMethod · 0.80
GetColsMethod · 0.45
SetHighlightColMethod · 0.45
GetRowsMethod · 0.45
PlayNoteMethod · 0.45

Tested by

no test coverage detected