SynthLab SDK
audiodelay.h
Go to the documentation of this file.
1 
2 #ifndef __audiodelay_h__
3 #define __audiodelay_h__
4 
5 // --- includes
6 #include "synthbase.h"
7 #include "synthfunctions.h"
8 
9 // -----------------------------
10 // --- SynthLab SDK File --- //
11 // ----------------------------
19 // -----------------------------------------------------------------------------
20 namespace SynthLab
21 {
101  class AudioDelay : public SynthModule
102  {
103  public:
105  AudioDelay(std::shared_ptr<MidiInputData> _midiInputData,
106  std::shared_ptr<AudioDelayParameters> _parameters,
107  uint32_t blockSize = 64);
108  virtual ~AudioDelay() {}
109 
111  virtual bool reset(double _sampleRate) override;
112  virtual bool update() override;
113  virtual bool render(uint32_t samplesToProcess = 1) override;
114  virtual bool doNoteOn(MIDINoteEvent& noteEvent) override;
115  virtual bool doNoteOff(MIDINoteEvent& noteEvent) override;
116 
118  std::shared_ptr<AudioDelayParameters> getParameters() { return parameters; }
119 
120  protected:
122  std::shared_ptr<AudioDelayParameters> parameters = nullptr;
123 
125  void createDelayBuffers(double _sampleRate, double _bufferLength_mSec);
126 
127  protected:
128  double sampleRate = 0.0;
129  double samplesPerMSec = 0.0;
130  double delayInSamples_L = 0.0;
131  double delayInSamples_R = 0.0;
132  double bufferLength_mSec = 0.0;
133  unsigned int bufferLength = 0;
134  double wetMix = 0.707;
135  double dryMix = 0.707;
136 
137  // --- delay buffer of doubles
140  };
141 
142 } // namespace
143 
144 #endif
void createDelayBuffers(double _sampleRate, double _bufferLength_mSec)
Create new circular buffers on init, or anytime the sample rate changes.
Definition: audiodelay.cpp:177
double dryMix
dry output default = -3dB
Definition: audiodelay.h:135
CircularBuffer< double > delayBuffer_R
RIGHT delay buffer of doubles.
Definition: audiodelay.h:139
double sampleRate
current sample rate
Definition: audiodelay.h:128
virtual bool reset(double _sampleRate) override
Resets object to initialized state.
Definition: audiodelay.cpp:49
virtual bool doNoteOn(MIDINoteEvent &noteEvent) override
Perform note-on operations for the component.
Definition: audiodelay.cpp:155
CircularBuffer< double > delayBuffer_L
LEFT delay buffer of doubles.
Definition: audiodelay.h:138
std::shared_ptr< AudioDelayParameters > parameters
Definition: audiodelay.h:122
double samplesPerMSec
samples per millisecond, for easy access calculation
Definition: audiodelay.h:129
std::shared_ptr< AudioDelayParameters > getParameters()
Definition: audiodelay.h:118
Definition: addosccore.cpp:4
virtual bool update() override
Updates the selected core.
Definition: audiodelay.cpp:74
virtual bool doNoteOff(MIDINoteEvent &noteEvent) override
Perform note-off operations for the component.
Definition: audiodelay.cpp:166
double delayInSamples_R
double includes fractional part
Definition: audiodelay.h:131
Abstract base class that encapsulates functionality of a module; used with the Module-Core paradigm...
Definition: synthbase.h:1600
Audio Ping-Pong Delay module.
Definition: audiodelay.h:101
double bufferLength_mSec
buffer length in mSec
Definition: audiodelay.h:132
AudioDelay(std::shared_ptr< MidiInputData > _midiInputData, std::shared_ptr< AudioDelayParameters > _parameters, uint32_t blockSize=64)
Constructs a stereo audio delay processor.
Definition: audiodelay.cpp:26
virtual bool render(uint32_t samplesToProcess=1) override
Processes audio through the stereo delay.
Definition: audiodelay.cpp:99
hard-coded arrays of FIR filter coefficients for the sample rate conversion objects (Interpolator and...
double delayInSamples_L
double includes fractional part
Definition: audiodelay.h:130
unsigned int bufferLength
buffer length in samples
Definition: audiodelay.h:133
double wetMix
wet output default = -3dB
Definition: audiodelay.h:134
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.