SynthLab SDK
sequencer.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include "synthbase.h"
4 #include "synthfunctions.h"
5 
6 
7 // -----------------------------
8 // --- SynthLab SDK File --- //
9 // ----------------------------
17 // -----------------------------------------------------------------------------
18 namespace SynthLab
19 {
33  template <typename T>
34  class JumpTable
35  {
36  public:
37  JumpTable() {}
38  ~JumpTable() {}
39 
44  void flushBuffer() { memset(&buffer[0], 0, bufferLength * sizeof(T)); }
45 
50  void reset() { readIndex = 0; }
51 
56  void createCircularBuffer(unsigned int _bufferLength)
57  {
58  // --- find nearest power of 2 for buffer, and create
59  createCircularBufferPowerOfTwo((unsigned int)(pow(2, ceil(log(_bufferLength) / log(2)))));
60  }
61 
65  void createCircularBufferPowerOfTwo(unsigned int _bufferLengthPowerOfTwo)
66  {
67  // --- reset to top
68  readIndex = 0;
69 
70  // --- find nearest power of 2 for buffer, save it as bufferLength
71  bufferLength = _bufferLengthPowerOfTwo;
72 
73  // --- save (bufferLength - 1) for use as wrapping mask
74  wrapMask = bufferLength - 1;
75 
76  // --- create new buffer
77  buffer.reset(new T[bufferLength]);
78 
79  // --- flush buffer
80  flushBuffer();
81  }
82 
85  void writeBuffer(uint32_t index, T input)
86  {
87  // --- write and increment index counter
88  buffer[index] = input;
89  }
90 
94  {
95  T output = buffer[readIndex++];
96 
97  // --- autowrap index
98  readIndex &= wrapMask;
99 
100  // --- read it
101  return output;
102  }
103 
106  T readBuffer(int index)
107  {
108  // --- read it
109  return buffer[index];
110  }
111 
112 
113  private:
114  std::unique_ptr<T[]> buffer = nullptr;
115  unsigned int readIndex = 0;
116  unsigned int bufferLength = 1024;
117  unsigned int wrapMask = 1023;
118  };
119 
132  struct LaneStep
133  {
134  LaneStep() {}
135  LaneStep& operator=(const LaneStep& aLane) // need this override for collections to work
136  {
137  if (this == &aLane)
138  return *this;
139 
140  stepValue = aLane.stepValue;
145 
148 
150  stepMode = aLane.stepMode;
151  isNULLStep = aLane.isNULLStep;
154 
155  return *this;
156  }
157 
163  {
166  }
167 
172  void updateStepDurationSamples(uint32_t _stepDurationSamples)
173  {
174  stepDurationSamples = _stepDurationSamples;
175  }
176 
181  void updateStepXFadeSamples(uint32_t _xfadeDurationSamples)
182  {
183  xfadeDurationSamples = _xfadeDurationSamples;
184  }
185 
186  // --- see korg wavestate docs -----------------------
187  // these are all equivalent values and need to be
188  // updated together
190  double stepDurationMilliSec = 0.0;
191  NoteDuration stepDurationNote = NoteDuration::kQuarter;
192  // ---------------------------------------------------
193 
194  // --- XFADE Time
195  // cannot exceed 2X duration of shortest step
197  double xfadeDurationMilliSec = 0.0;
198  NoteDuration xfadeDurationNote = NoteDuration::kQuarter;
199  // ---------------------------------------------------
200 
201  // --- probability %
202  double probability_Pct = 100.0;
203 
204  int32_t getNextStepIndex() { return nextStepIndex; }
205  void setNextStepIndex(int32_t _nextStepIndex) { nextStepIndex = _nextStepIndex; }
206 
208  void setPreviousStepIndex(int32_t _previousStepIndex) { previousStepIndex = _previousStepIndex; }
209 
210  double getStepValue() { return stepValue; }
211  void setStepValue(double _stepValue) { stepValue = _stepValue; }
212 
215  {
216  double wn = noiseGen.doWhiteNoise();
217  wn = unipolar(wn);
218  double probPct = wn * 100.0;
219 
220  if(probability_Pct < 100.0)
221  int t = 0;
222 
223  if (probPct <= probability_Pct)
224  setNULLStep(false);
225  else
226  setNULLStep(true);
227  }
228 
229  bool getIsNULLStep() { return isNULLStep; }
230  void setNULLStep(bool _isNULLStep) { isNULLStep = _isNULLStep; /*stepValue = 0.0;*/ }
231 
232  protected:
233  uint32_t stepDurationSamples = 0;
234  uint32_t xfadeDurationSamples = 0;
235  int32_t nextStepIndex = -1;
236  int32_t previousStepIndex = -1;
237  double stepValue = 0.0;
238  uint32_t stepMode = 0;
239  bool isNULLStep = false;
240  NoiseGenerator noiseGen;
241  };
242 
260  class Lane
261  {
262  public:
263  Lane(){
264  resetJumpTable();
265  }
266  ~Lane() {}
267 
268  void resetJumpTable()
269  {
270  for (uint32_t i = 0; i < MAX_SEQ_STEPS; i++)
271  jumpTable[i] = i;
272  }
273 
274  // --- https://stackoverflow.com/questions/21877904/getting-random-unique-integers-in-c
275  //
276 
280  inline void shuffleJumpTable()
281  {
282  std::vector<int> v = { jumpTable[0], jumpTable[1], jumpTable[2], jumpTable[3], jumpTable[4], jumpTable[5], jumpTable[6], jumpTable[7] };
283  std::random_device rd;
284  std::mt19937 g(rd());
285  std::shuffle(v.begin(), v.end(), g);
286  for (uint32_t i = 0; i < MAX_SEQ_STEPS; i++)
287  {
288  jumpTable[i] = v[i];
289  }
290  }
291 
295  inline void updateLaneLoopPoints()
296  {
297  for (uint32_t i = 0; i < MAX_SEQ_STEPS; i++)
298  {
299  if (i == startPoint)
301  else
303 
304  if (i == endPoint)
306  else
308  }
309  }
310 
314  void initStepTiming(uint32_t stepIndex)
315  {
316  laneStep[stepIndex].initStepTiming();
317  }
318 
322  void initCurrentStep(uint32_t jumpIndex)
323  {
324  jumpTableIndex = jumpIndex;
329  }
330 
334  void initNextStep(uint32_t jumpIndex, uint32_t loopDirectionIndex, bool applyProbability = false)
335  {
336  bool forwardBackward = loopDirectionIndex == enumToInt(LoopDirection::kForwardBackward);
337  bool looped = false;
338  jumpTableIndex = jumpIndex;
339  nextStepIndex = getNextStepIndex(jumpTableIndex, forwardBackward, looped);
340  // boundIntValue(nextStepIndex, 0, 7);
341 
343  nextStep = laneStep[nextStepIndex];
344 
345  if(applyProbability)
346  nextStep.updateStepProbability();
347 
348  if (nextStep.getIsNULLStep())
350  else
351  nextStepValue = nextStep.getStepValue();
352  }
353 
358  {
361 
362  if (!currentStep.getIsNULLStep())
364  }
365 
371  bool loadNextStep(uint32_t loopDirectionIndex, bool applyProbability = false)
372  {
373  bool forwardBackward = loopDirectionIndex == enumToInt(LoopDirection::kForwardBackward);
374  bool looped = false;
375  uint32_t next = getNextStepIndex(jumpTableIndex, forwardBackward, looped);
376 
377  if (looped && randomizeSteps)
378  {
381  }
382 
383  nextStepIndex = next;
385  nextStep = laneStep[nextStepIndex];
386 
387  if(applyProbability)
388  nextStep.updateStepProbability();
389 
390  if (nextStep.getIsNULLStep())
392  else
393  nextStepValue = nextStep.getStepValue();
394 
395  return looped;
396  }
397 
409  uint32_t getNextStepIndex(uint32_t& jumpTableIndex, bool forwardBackward, bool& hitLoopPoint)
410  {
411  uint32_t nextStepIndex = 0;
412  uint32_t nextIndex = calcNextIndex(jumpTableIndex);
413  uint32_t previousIndex = calcPreviousIndex(jumpTableIndex);
414 
415  // --- if forward
416  if (forwardDirection)
417  {
418  if (currentStep.getNextStepIndex() < 0)
419  {
420  nextStepIndex = jumpTable[nextIndex];
421  jumpTableIndex = nextIndex;
422  }
423  else // hit a loop point
424  {
425  hitLoopPoint = true;
426  if (forwardBackward)
427  {
428  jumpTableIndex = previousIndex;
430  forwardDirection = false;
431  }
432  else
433  {
436  }
437  }
438  }
439  else // going backwards
440  {
442  {
443  nextStepIndex = jumpTable[previousIndex];
444  jumpTableIndex = previousIndex;
445  }
446  else // it a loop point
447  {
448  hitLoopPoint = true;
449  if (forwardBackward)
450  {
451  jumpTableIndex = nextIndex;
452  nextStepIndex = jumpTable[nextIndex];
453  forwardDirection = true;
454  }
455  else
456  {
459  }
460  }
461  }
462  return nextStepIndex;
463  }
464 
465 
471  {
474  }
475 
481  {
484  }
485 
486 
491  {
492  if(!currentStep.getIsNULLStep())
494 
495  if (!nextStep.getIsNULLStep())
496  nextStepValue = nextStep.getStepValue();
497  }
498 
502  void setRandomizeSteps(bool _randomizeSteps)
503  {
504  if (randomizeSteps != _randomizeSteps)
505  {
506  randomizeSteps = _randomizeSteps;
507  if (!randomizeSteps)
508  resetJumpTable();
509  }
510  }
511 
512  public:
513  // --- LOOP points
514  uint32_t startPoint = 0;
515  uint32_t endPoint = MAX_SEQ_STEPS;
516  bool forwardDirection = true;
517 
518  // --- steps for the lane
521  LaneStep nextStep;
522  uint32_t currentLEDStep = 0;
523  uint32_t currentLEDStepDuration = 0;
524  int32_t getCurrentStepIndex() { return currentStepIndex; }
525  int32_t getNextStepIndex() { return nextStepIndex; }
526  double getCurrentStepValue() { return currentStepValue; }
527  double getNextStepValue() { return nextStepValue; }
528 
529  int32_t getJumpTableValue(uint32_t index)
530  {
531  if (index > MAX_SEQ_STEPS - 1)
532  return 0;
533 
534  return jumpTable[index];
535  }
536 
537  protected:
538  inline uint32_t calcNextIndex(uint32_t baseIndex)
539  {
541  uint32_t next = baseIndex + 1;
542  next &= WRAP_MASK;
543  return next;
544  }
545 
546  inline uint32_t calcPreviousIndex(uint32_t baseIndex)
547  {
549  uint32_t next = baseIndex - 1;
550  next &= WRAP_MASK;
551  return next;
552  }
553 
554  // --- table of steps
556 
557  // --- realtime operation
558  int32_t currentStepIndex = 0;
559  int32_t nextStepIndex = 0;
560  uint32_t jumpTableIndex = 0;
561 
562  double currentStepValue = 0.0;
563  double nextStepValue = 0.0;
564  bool randomizeSteps = false;
565  };
566 
568  {
569  WaveSequencerStatusMeters& operator=(const WaveSequencerStatusMeters& wssm) // need this override for collections to work
570  {
571  if (this == &wssm)
572  return *this;
573 
574  memcpy(timingLaneMeter, wssm.timingLaneMeter, MAX_SEQ_STEPS * sizeof(uint32_t));
575  memcpy(waveLaneMeter, wssm.waveLaneMeter, MAX_SEQ_STEPS * sizeof(uint32_t));
576  memcpy(pitchLaneMeter, wssm.pitchLaneMeter, MAX_SEQ_STEPS * sizeof(uint32_t));
577  memcpy(stepSeqLaneMeter, wssm.stepSeqLaneMeter, MAX_SEQ_STEPS * sizeof(uint32_t));
578  return *this;
579  }
580 
581  uint32_t timingLaneMeter[MAX_SEQ_STEPS] = { 0, 0, 0, 0, 0, 0, 0, 0 };
582  uint32_t waveLaneMeter[MAX_SEQ_STEPS] = { 0, 0, 0, 0, 0, 0, 0, 0 };
583  uint32_t pitchLaneMeter[MAX_SEQ_STEPS] = { 0, 0, 0, 0, 0, 0, 0, 0 };
584  uint32_t stepSeqLaneMeter[MAX_SEQ_STEPS] = { 0, 0, 0, 0, 0, 0, 0, 0 };
585  };
586 
587  enum class soloType { SOLO_OFF, SOLO_0, SOLO_1, SOLO_2, SOLO_3, SOLO_4, SOLO_5, SOLO_6, SOLO_7 };
588 
606  {
609  bool haltSequencer = false;
610 
612  double BPM = 120;
613  double timeStretch = 1.0;
614  bool interpolateStepSeqMod = false;
615  bool randomizeStepOrder = false;
616  bool randomizePitchOrder = false;
617  bool randomizeWaveOrder = false;
618  bool randomizeSSModOrder = false;
619 
621  uint32_t timingLoopStart = 1; // NOTE: 1 is the minimum value here, 1-indexed to match GUI for user
622  uint32_t timingLoopEnd = MAX_SEQ_STEPS;// -1;
623  uint32_t timingLoopDirIndex = enumToInt(LoopDirection::kForward);
624 
626  double stepDurationMilliSec[MAX_SEQ_STEPS] = { 0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0 };
627  uint32_t stepDurationNoteIndex[MAX_SEQ_STEPS] = { enumToInt(NoteDuration::kQuarter),enumToInt(NoteDuration::kQuarter),enumToInt(NoteDuration::kQuarter),enumToInt(NoteDuration::kQuarter),enumToInt(NoteDuration::kQuarter),enumToInt(NoteDuration::kQuarter),enumToInt(NoteDuration::kQuarter),enumToInt(NoteDuration::kQuarter) };
628  uint32_t stepType[MAX_SEQ_STEPS] = { 0,0,0,0,0,0,0,0 }; // 0 = NOTE, 1 = REST
629  // uint32_t timingLaneMeter[MAX_SEQ_STEPS] = { 0, 0, 0, 0, 0, 0, 0, 0 };
630  // ---------------------------------------------------
631 
633  double xfadeDurationMilliSec[MAX_SEQ_STEPS] = { 0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0 };
634  uint32_t xfadeDurationNoteIndex[MAX_SEQ_STEPS] = { enumToInt(NoteDuration::kQuarter),enumToInt(NoteDuration::kQuarter),enumToInt(NoteDuration::kQuarter),enumToInt(NoteDuration::kQuarter),enumToInt(NoteDuration::kQuarter),enumToInt(NoteDuration::kQuarter),enumToInt(NoteDuration::kQuarter),enumToInt(NoteDuration::kQuarter) };
635  // ---------------------------------------------------
636 
638  uint32_t modLoopStart[NUM_MOD_LANES] = { 1, 1, 1 }; // NOTE: 1 is the minimum value here, 1-indexed to match GUI for user
639  uint32_t modLoopEnd[NUM_MOD_LANES] = { MAX_SEQ_STEPS, MAX_SEQ_STEPS, MAX_SEQ_STEPS };
640  uint32_t modLoopDirIndex[NUM_MOD_LANES] = { enumToInt(LoopDirection::kForward), enumToInt(LoopDirection::kForward), enumToInt(LoopDirection::kForward) };
641 
643  double waveLaneAmp_dB[MAX_SEQ_STEPS] = { 0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0 };
644  double waveLaneValue[MAX_SEQ_STEPS] = { 0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0 };
645  double waveLaneProbability_pct[MAX_SEQ_STEPS] = { 100.0,100.0,100.0,100.0,100.0,100.0,100.0,100.0 }; // WRAP_MASK = MAX-1
646 
648  double pitchLaneValue[MAX_SEQ_STEPS] = { 0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0 };
649  double pitchLaneProbability_pct[MAX_SEQ_STEPS] = { 100.0,100.0,100.0,100.0,100.0,100.0,100.0,100.0 }; // WRAP_MASK = MAX-1
650 
652  double stepSeqValue[MAX_SEQ_STEPS] = { -1.0,1.0,-0.3,-0.1, 1.0, 0.6, 0.3, 0.0 };
653  double stepSeqProbability_pct[MAX_SEQ_STEPS] = { 100.0,100.0,100.0,100.0,100.0,100.0,100.0,100.0 }; // WRAP_MASK = MAX-1
654  };
655 
746  class WaveSequencer : public SynthModule
747  {
748  public:
750  WaveSequencer(std::shared_ptr<MidiInputData> _midiInputData,
751  std::shared_ptr<WaveSequencerParameters> _parameters,
752  uint32_t blockSize = 64); /* C-TOR */
753 
755  virtual ~WaveSequencer() {} /* D-TOR */
756 
758  virtual bool reset(double _sampleRate) override;
759  virtual bool update() override;
760  virtual bool render(uint32_t samplesToProcess = 1) override;
761  virtual bool doNoteOn(MIDINoteEvent& noteEvent) override;
762  virtual bool doNoteOff(MIDINoteEvent& noteEvent) override;
763 
765  void clearStatusArray();
766  uint32_t setCurrentTimingXFadeSamples();
767  void setXFadeHoldParams(uint32_t xfadeInTimeSamples);
768  void updateLaneLoopPoints();
769 
770  protected:
772  std::shared_ptr<WaveSequencerParameters> parameters = nullptr;
773 
774  // --- for LEDs
775  uint32_t sampleCounter = 0;
776 
777  // --- lanes
782 
783  // --- crossfader
785  bool initialStep = false;
786 
787  // --- for probabilities
789 
790  // --- basic variables
791  double sampleRate = 0.0;
792  double samplesPerMSec = 0.0;
793  };
794 
795 } // namespace
796 
Lane()
Definition: sequencer.h:263
void shuffleJumpTable()
for randomizing the sequence in the table
Definition: sequencer.h:280
int32_t getJumpTableValue(uint32_t index)
Definition: sequencer.h:529
#define enumToInt(ENUM)
macro helper to cast a typed enum to an int
Definition: synthfunctions.h:251
void createCircularBufferPowerOfTwo(unsigned int _bufferLengthPowerOfTwo)
Create a buffer based on a target maximum in SAMPLESwhere the size is pre-calculated as a power of tw...
Definition: sequencer.h:65
uint32_t setCurrentTimingXFadeSamples()
Set the current cross fade time in samples.
Definition: sequencer.cpp:224
uint32_t timingLoopStart
Definition: sequencer.h:621
Lane stepSeqLane
step sequemcer lane
Definition: sequencer.h:781
void initNextStep(uint32_t jumpIndex, uint32_t loopDirectionIndex, bool applyProbability=false)
Initialize timing of the NEXT step; needed only at startup.
Definition: sequencer.h:334
int32_t nextStepIndex
current next step
Definition: sequencer.h:235
~JumpTable()
empty constructor
Definition: sequencer.h:38
uint32_t currentLEDStep
next in sequence
Definition: sequencer.h:522
double getStepValue()
getter current value
Definition: sequencer.h:210
void initCurrentStep(uint32_t jumpIndex)
Initialize timing of the FIRST lane step; needed only at startup.
Definition: sequencer.h:322
int32_t nextStepIndex
always know next step index
Definition: sequencer.h:559
Lane pitchLane
pitch lane
Definition: sequencer.h:780
uint32_t stepDurationSamplesRunning
running count of step samples
Definition: sequencer.h:189
Lane waveLane
waveform lane
Definition: sequencer.h:779
int32_t getPreviousStepIndex()
get the pprevious index
Definition: sequencer.h:207
T readBufferCircular()
read output of delay line
Definition: sequencer.h:93
NoiseGenerator noiseGen
for probability
Definition: sequencer.h:788
void setCurrentStepFromNextStep()
Next step becomes the current step.
Definition: sequencer.h:357
double stepValue
value of step
Definition: sequencer.h:237
double samplesPerMSec
for step counting
Definition: sequencer.h:792
int32_t jumpTable[MAX_SEQ_STEPS]
table of lane step index values
Definition: sequencer.h:555
uint32_t modLoopStart[NUM_MOD_LANES]
Definition: sequencer.h:638
void updateLEDMeterWithNextStep()
Update the LED meter index with next stap index.
Definition: sequencer.h:480
double sampleRate
sample rate
Definition: sequencer.h:791
void updateStepProbability()
Definition: sequencer.h:214
double currentStepValue
always know current step value
Definition: sequencer.h:562
double waveLaneAmp_dB[MAX_SEQ_STEPS]
Definition: sequencer.h:643
virtual ~WaveSequencer()
Definition: sequencer.h:755
Simple object that generates white, gaussian white or pink noise.
Definition: synthbase.h:495
const uint32_t WRAP_MASK
Definition: synthconstants.h:86
Holds all the information needed for one step of one lane in the wave sequencer.
Definition: sequencer.h:132
uint32_t stepMode
for individual modes of operation; e.g. timing has note and rest modes
Definition: sequencer.h:238
Definition: addosccore.cpp:4
const uint32_t MAX_SEQ_STEPS
Definition: synthconstants.h:84
void updateLEDMeterWithCurrentStep()
Update the LED meter index with current stap index.
Definition: sequencer.h:470
void clearStatusArray()
clear out LED (flashing light) status array
Definition: sequencer.cpp:209
virtual bool doNoteOn(MIDINoteEvent &noteEvent) override
Note on handler that must:
Definition: sequencer.cpp:440
uint32_t calcPreviousIndex(uint32_t baseIndex)
Definition: sequencer.h:546
uint32_t calcNextIndex(uint32_t baseIndex)
Definition: sequencer.h:538
NoteDuration
emumearation of musical durations, shortest to longest
Definition: synthfunctions.h:1765
void updateLaneLoopPoints()
Lane loop points may have changed; this updates the start/end points.
Definition: sequencer.cpp:253
virtual bool doNoteOff(MIDINoteEvent &noteEvent) override
Note off handler; nothing to do here.
Definition: sequencer.cpp:542
~Lane()
empty destructor
Definition: sequencer.h:266
double stepDurationMilliSec
current duration in mSec
Definition: sequencer.h:190
void updateStepDurationSamples(uint32_t _stepDurationSamples)
change the step duration time in samples
Definition: sequencer.h:172
uint32_t jumpTableIndex
current index in jump table
Definition: sequencer.h:560
T readBuffer(int index)
read an arbitrary location that is index samples old
Definition: sequencer.h:106
Crossfades two values (from A to B) and then holds B for some amount of time.
Definition: synthbase.h:283
virtual bool update() override
Updates the selected core; sets GLOBAL engine variable unisonDetuneCents that may have changed since ...
Definition: sequencer.cpp:110
void updateLaneLoopPoints()
for update to next set of points (forward or backwards)
Definition: sequencer.h:295
int32_t getNextStepIndex()
get the next index
Definition: sequencer.h:204
double xfadeDurationMilliSec
current crossfade in mSec
Definition: sequencer.h:197
double unipolar(double value)
calculates the unipolar [0.0, +1.0] value FROM a bipolar [-1.0, +1.0] value
Definition: synthfunctions.h:1075
Definition: sequencer.h:567
int32_t previousStepIndex
current previous step
Definition: sequencer.h:236
int32_t currentStepIndex
always know current step index
Definition: sequencer.h:558
void updateStepXFadeSamples(uint32_t _xfadeDurationSamples)
change the step cross-fade time in samples
Definition: sequencer.h:181
uint32_t xfadeDurationSamplesRunning
running count of crossfade samples
Definition: sequencer.h:196
void flushBuffer()
flush jump table by resetting all values to 0.0
Definition: sequencer.h:44
double xfadeDurationMilliSec[MAX_SEQ_STEPS]
Definition: sequencer.h:633
Abstract base class that encapsulates functionality of a module; used with the Module-Core paradigm...
Definition: synthbase.h:1600
NoteDuration xfadeDurationNote
current crossfade duration as note rhythm
Definition: sequencer.h:198
void reset()
reset the read-index to head of buffer
Definition: sequencer.h:50
void writeBuffer(uint32_t index, T input)
write a value into the buffer; this overwrites the previous oldest value in the buffer ...
Definition: sequencer.h:85
double stepSeqValue[MAX_SEQ_STEPS]
Definition: sequencer.h:652
void setXFadeHoldParams(uint32_t xfadeInTimeSamples)
Set the current hold time in samples.
Definition: sequencer.cpp:237
void initStepTiming()
initialize the step and crossfade durations
Definition: sequencer.h:162
WaveSequencer(std::shared_ptr< MidiInputData > _midiInputData, std::shared_ptr< WaveSequencerParameters > _parameters, uint32_t blockSize=64)
Constructs Wave Sequencer Object.
Definition: sequencer.cpp:27
uint32_t stepDurationSamples
this is what we use for the crossfader operaiton
Definition: sequencer.h:233
JumpTable()
empty constructor
Definition: sequencer.h:37
Definition: sequencer.h:260
bool isNULLStep
allow for NULL (non-playing) steps
Definition: sequencer.h:239
XHoldFader xHoldFader
for crossfading waveforms and values
Definition: sequencer.h:784
WaveSequencerStatusMeters statusMeters
set of meters for outbound monitoring of lane status
Definition: sequencer.h:608
void setPreviousStepIndex(int32_t _previousStepIndex)
set the pprevious index
Definition: sequencer.h:208
LaneStep currentStep
current
Definition: sequencer.h:520
GUI Parameters for wave sequencer object.
Definition: sequencer.h:605
uint32_t getNextStepIndex(uint32_t &jumpTableIndex, bool forwardBackward, bool &hitLoopPoint)
Find index of next step.
Definition: sequencer.h:409
uint32_t currentLEDStepDuration
on-time of current LED
Definition: sequencer.h:523
WaveSequencer module.
Definition: sequencer.h:746
double stepDurationMilliSec[MAX_SEQ_STEPS]
Definition: sequencer.h:626
double BPM
Definition: sequencer.h:612
bool forwardDirection
forward flag
Definition: sequencer.h:516
NoteDuration stepDurationNote
current step duration as note rhythm
Definition: sequencer.h:191
void setStepValue(double _stepValue)
setter current value
Definition: sequencer.h:211
Lane timingLane
timing lane
Definition: sequencer.h:778
void updateStepValues()
Update values of current step and next step as long as they are non-null.
Definition: sequencer.h:490
uint32_t endPoint
end loop point
Definition: sequencer.h:515
LaneStep laneStep[MAX_SEQ_STEPS]
array of lane steps for this lane
Definition: sequencer.h:519
double doWhiteNoise()
Function generate white noise.
Definition: synthbase.cpp:842
double pitchLaneValue[MAX_SEQ_STEPS]
Definition: sequencer.h:648
void setNextStepIndex(int32_t _nextStepIndex)
set the next index
Definition: sequencer.h:205
uint32_t sampleCounter
for LED timing
Definition: sequencer.h:775
double probability_Pct
probability of this step playing
Definition: sequencer.h:202
uint32_t startPoint
start loop point
Definition: sequencer.h:514
uint32_t xfadeDurationSamples
this is what we use for the crossfader operaiton
Definition: sequencer.h:234
hard-coded arrays of FIR filter coefficients for the sample rate conversion objects (Interpolator and...
double nextStepValue
always know next step value
Definition: sequencer.h:563
void createCircularBuffer(unsigned int _bufferLength)
Create a buffer based on a target maximum in SAMPLES do NOT call from realtime audio thread; do this ...
Definition: sequencer.h:56
A customized circular buffer for the wave sequencer object. This is identical to the CircularBuffer o...
Definition: sequencer.h:34
std::shared_ptr< WaveSequencerParameters > parameters
Definition: sequencer.h:772
bool loadNextStep(uint32_t loopDirectionIndex, bool applyProbability=false)
Load next step;.
Definition: sequencer.h:371
void setRandomizeSteps(bool _randomizeSteps)
Enable re-shuffling of jump table.
Definition: sequencer.h:502
virtual bool reset(double _sampleRate) override
Resets object to initialized state.
Definition: sequencer.cpp:88
bool randomizeSteps
flag to randomize steps
Definition: sequencer.h:564
Information about a MIDI note event (note on or note off).
Definition: synthstructures.h:212
See also Designing Software Synthesizers in C++ 2nd Ed. by Will Pirkle.
void initStepTiming(uint32_t stepIndex)
Initialize timing of a lane step.
Definition: sequencer.h:314
virtual bool render(uint32_t samplesToProcess=1) override
Crank through one iteration of the sequencer over one block of data.
Definition: sequencer.cpp:283