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

Method Step

Source/NoteStepSequencer.cpp:851–958  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

849}
850
851void NoteStepSequencer::Step(double time, float velocity, int pulseFlags)
852{
853 if (!mEnabled)
854 return;
855
856 int direction = 1;
857 if (pulseFlags & kPulseFlag_Backward)
858 direction = -1;
859 if (pulseFlags & kPulseFlag_Repeat)
860 direction = 0;
861
862 mArpIndex += direction;
863 if (direction > 0 && mArpIndex >= mLength)
864 mArpIndex -= (mLength - mLoopResetPoint);
865 if (direction < 0 && mArpIndex < mLoopResetPoint)
866 mArpIndex += (mLength - mLoopResetPoint);
867
868 if (pulseFlags & kPulseFlag_Reset)
869 mArpIndex = 0;
870 else if (pulseFlags & kPulseFlag_Random)
871 mArpIndex = gRandom() % mLength;
872
873 if (!mHasExternalPulseSource || (pulseFlags & kPulseFlag_SyncToTransport))
874 {
875 mArpIndex = TheTransport->GetSyncedStep(time, this, mTransportListenerInfo, mLength);
876 }
877
878 if (pulseFlags & kPulseFlag_Align)
879 {
880 int stepsPerMeasure = TheTransport->GetStepsPerMeasure(this);
881 int numMeasures = ceil(float(mLength) / stepsPerMeasure);
882 int measure = TheTransport->GetMeasure(time) % numMeasures;
883 int step = ((TheTransport->GetQuantized(time, mTransportListenerInfo) % stepsPerMeasure) + measure * stepsPerMeasure) % mLength;
884 mArpIndex = step;
885 }
886
887 int offPitch = -1;
888 int offStep = -1;
889 if (mLastPitch >= 0 && !mAlreadyDidNoteOff)
890 {
891 offPitch = mLastPitch;
892 offStep = mLastStepIndex;
893 }
894
895 if (mQueuedPush2Tone != -1)
896 {
897 if (mQueuedPush2Tone == -2)
898 {
899 mVels[mArpIndex] = 0;
900 }
901 else
902 {
903 mTones[mArpIndex] = mQueuedPush2Tone;
904 mVels[mArpIndex] = mQueuedPush2Vel;
905 mNoteLengths[mArpIndex] = mQueuedPush2Length;
906 }
907 mQueuedPush2Tone = -1;
908 mGridSyncQueued = true;

Callers

nothing calls this directly

Calls 7

GetSyncedStepMethod · 0.80
GetStepsPerMeasureMethod · 0.80
GetMeasureMethod · 0.80
GetQuantizedMethod · 0.80
sizeMethod · 0.80
GetDurationMethod · 0.80
SetHighlightColMethod · 0.45

Tested by

no test coverage detected