1 #ifndef __synthBase_h__ 2 #define __synthBase_h__ 14 #include "synthstructures.h" 15 #include "synthlabparams.h" 17 #define _MATH_DEFINES_DEFINED 284 AudioBuffer(uint32_t _numInputChannels, uint32_t _numOutputChannels, uint32_t _blockSize);
288 void init(uint32_t _numInputChannels, uint32_t _numOutputChannels, uint32_t _blockSize);
301 uint32_t getOutputChannelCount() {
return numOutputChannels; }
311 uint32_t numInputChannels = 1;
312 uint32_t numOutputChannels = 1;
340 SynthClock&
operator=(
const SynthClock& params);
343 void reset(
double startValue = 0.0);
352 void setFrequency(
double _frequency_Hz,
double _sampleRate);
373 double sampleRate = 0.0;
374 enum { MOD_COUNTER, PHASE_INC, PHASE_OFFSET, FREQUENCY_HZ, NUM_VARS };
375 double state[NUM_VARS] = { 0.0, 0.0, 0.0, 0.0 };
441 XFader(uint32_t _xfadeTime_Samples);
448 void startCrossfade() {
running =
true; }
449 void stopCrossfade() {
running =
false; }
450 bool isCrossfading() {
return running; }
536 double output = input*(1.0 -
g) +
g*
z1;
570 bool reset(
double _sampleRate,
double startPhase, int32_t xfadeSamples = 16);
578 bool isProcessing() {
return hardSyncFader.isCrossfading(); }
617 bool startModulator(
double startValue,
double endValue,
double modTime_mSec,
double sampleRate);
620 bool setModTime(
double modTime_mSec,
double sampleRate);
662 bool startModulator(
double startNote,
double endNote,
double glideTime_mSec,
double sampleRate);
665 bool setGlideTime(
double glideTime_mSec,
double sampleRate);
709 double bN[3] = { 0.0, 0.0, 0.0 };
775 virtual void setModValue(uint32_t index,
double value) = 0;
801 class IWavetableSource
812 virtual void selectTable(uint32_t midiNoteNumber) = 0;
856 class IWavetableDatabase
867 virtual IWavetableSource*
getTableSource(
const char* uniqueTableName) = 0;
878 virtual bool addTableSource(
const char* uniqueTableName, IWavetableSource* tableSource) = 0;
915 struct PCMSampleOutput
917 double audioOutput[STEREO_CHANNELS] = { 0.0, 0.0 };
948 class IPCMSampleSource
969 virtual PCMSampleOutput
readSample(
double& readIndex,
double inc) = 0;
1020 class IPCMSampleDatabase
1032 virtual IPCMSampleSource*
getSampleSource(
const char* uniqueSampleSetName) = 0;
1043 virtual bool addSampleSource(
const char* uniqueSampleSetName, IPCMSampleSource* sampleSource) = 0;
1086 class IMidiInputData
1139 enum { LPF1, LPF2, LPF3, LPF4, HPF1, HPF2, HPF3, HPF4, BPF2, BPF4, BSF2, BSF4,
1140 APF1, APF2, ANM_LPF1, ANM_LPF2, ANM_LPF3, ANM_LPF4, NUM_FILTER_OUTPUTS };
1157 double filter[NUM_FILTER_OUTPUTS];
1188 virtual bool reset(
double _sampleRate) = 0;
1196 virtual bool update() = 0;
1205 virtual FilterOutput process(
double xn) = 0;
1214 virtual void setFilterParams(
double _fc,
double _Q) = 0;
1249 const char*
dllPath =
nullptr;
1288 struct SynthLabTableSet
1291 SynthLabTableSet(
const char* _waveformName,
double _tableFs,
1292 uint32_t* _tableLengths, uint64_t** _ppHexTableSet,
double _outputComp)
1305 double tableFs = 44100.0;
1333 struct SynthLabBankSet
1335 SynthLabBankSet(
unsigned int _tablePtrsCount, SynthLabTableSet** _tablePtrs, std::string* _tableNames)
1366 struct StaticWavetable
1368 StaticWavetable() {}
1370 StaticWavetable(
const uint64_t* _table, uint32_t _tableLength,
const char* _waveformName,
1371 double _outputComp = 1.0,
double _tableFs = 44100)
1382 StaticWavetable(
const double* _table, uint32_t _tableLength,
const char* _waveformName,
1383 double _outputComp = 1.0,
double _tableFs = 44100)
1400 double tableFs = 44100.0;
1422 struct DynamicWavetable
1424 DynamicWavetable() {}
1426 DynamicWavetable(std::shared_ptr<double> _table, uint32_t _tableLength,
const char* _waveformName,
1427 double _outputComp = 1.0,
double _tableFs = 44100)
1437 std::shared_ptr<double>
table =
nullptr;
1441 double tableFs = 44100.0;
1463 class WavetableDatabase :
public IWavetableDatabase
1466 WavetableDatabase() {}
1470 virtual IWavetableSource*
getTableSource(
const char* uniqueTableName)
override;
1471 virtual bool addTableSource(
const char* uniqueTableName, IWavetableSource* tableSource)
override;
1508 virtual IPCMSampleSource*
getSampleSource(
const char* uniqueSampleSetName)
override;
1509 virtual bool addSampleSource(
const char* uniqueSampleSetName, IPCMSampleSource* sampleSource)
override;
1517 typedef std::map < std::string, IPCMSampleSource* >sampleSourceMap;
1519 std::vector<IPCMSampleSource*> sources;
1539 class SynthProcessInfo :
public AudioBuffer
1542 SynthProcessInfo(){}
1543 SynthProcessInfo(uint32_t _numInputChannels, uint32_t _numOutputChannels, uint32_t _blockSize);
1544 ~SynthProcessInfo() {}
1578 class MidiInputData :
public IMidiInputData
1603 double auxData[kNumMIDIAuxes];
1622 class Modulators :
public IModulator
1630 virtual void setModValue(uint32_t index,
double value);
1683 virtual bool reset(CoreProcData& processInfo) = 0;
1684 virtual bool update(CoreProcData& processInfo) = 0;
1685 virtual bool render(CoreProcData& processInfo) = 0;
1686 virtual bool doNoteOn(CoreProcData& processInfo) = 0;
1687 virtual bool doNoteOff(CoreProcData& processInfo) = 0;
1691 virtual bool shutdown() {
return false; }
1692 virtual void setSustainOverride(
bool sustain) {
return; }
1702 const char* getModuleName() {
return moduleName; }
1704 void setModuleHandle(
void* handle) {
moduleHandle = handle; }
1706 void setModuleIndex(uint32_t index) {
moduleIndex = index; }
1755 SynthModule(std::shared_ptr<MidiInputData> _midiInputData);
1759 virtual bool reset(
double _sampleRate) = 0;
1760 virtual bool update() = 0;
1761 virtual bool render(uint32_t samplesToProcess = 1) = 0;
1762 virtual bool doNoteOn(MIDINoteEvent& noteEvent) = 0;
1763 virtual bool doNoteOff(MIDINoteEvent& noteEvent) = 0;
1766 virtual bool initialize(
const char* _dllDirectory) { dllDirectory = _dllDirectory;
return true; }
1770 virtual bool shutdown() {
return false; }
1777 std::shared_ptr<Modulators> getModulationOutput() {
return modulationOutput; }
1784 unisonDetuneCents = _unisonDetuneCents; unisonStartPhase = _unisonStarPhase;
1789 void clearFMBuffer() {
fmBuffer =
nullptr; }
1793 virtual bool getModuleStrings(std::vector<std::string>& moduleStrings, std::string ignoreStr =
"");
1794 virtual bool getModuleStrings(uint32_t coreIndex, std::vector<std::string>& moduleStrings, std::string ignoreStr);
1795 virtual bool getAllModuleStrings(std::vector<std::string>& moduleStrings, std::string ignoreStr);
1798 virtual bool addModuleCore(std::shared_ptr<ModuleCore> core);
1807 std::shared_ptr<Modulators>
modulationInput = std::make_shared<Modulators>();
1810 std::shared_ptr<Modulators>
modulationOutput = std::make_shared<Modulators>();
1822 std::shared_ptr<AudioBuffer>
fmBuffer =
nullptr;
1826 std::shared_ptr<ModuleCore> selectedCore =
nullptr;
1827 double unisonDetuneCents = 0.0;
1828 double unisonStartPhase = 0.0;
1829 bool standAloneMode =
false;
1833 std::string dllDirectory;
1859 inline double doLinearInterp(
double y1,
double y2,
double fractional_X)
1862 if (fractional_X >= 1.0)
return y2;
1865 return fractional_X*y2 + (1.0 - fractional_X)*y1;
1882 template <
typename T>
1883 class CircularBuffer
1887 ~CircularBuffer() {}
1890 void flushBuffer() { memset(&buffer[0], 0, bufferLength *
sizeof(T)); }
1908 bufferLength = _bufferLengthPowerOfTwo;
1911 wrapMask = bufferLength - 1;
1914 buffer.reset(
new T[bufferLength]);
1924 buffer[writeIndex++] = input;
1927 writeIndex &= wrapMask;
1936 int readIndex = (writeIndex - 1) - delayInSamples;
1939 readIndex &= wrapMask;
1942 return buffer[readIndex];
1949 T y1 =
readBuffer((
int)delayInFractionalSamples);
1952 if (!interpolate)
return y1;
1956 int readIndexNext = (int)delayInFractionalSamples + 1;
1959 readIndexNext &= wrapMask;
1965 double fraction = delayInFractionalSamples - (uint32_t)delayInFractionalSamples;
1975 std::unique_ptr<T[]> buffer =
nullptr;
1976 uint32_t writeIndex = 0;
1977 uint32_t bufferLength = 1024;
1978 uint32_t wrapMask = 1023;
1979 bool interpolate =
true;
2016 void reset(
double _sampleRate,
double minimumPitch = MIDI_NOTE_0_FREQ)
2031 delaySamples = _delaySamples;
2054 double yn = delayBuffer.
readBuffer(delaySamples);
2060 double delaySamples = 0;
2082 double coeff[7] = { 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 };
2101 BQAudioFilter(
void) {}
2102 ~BQAudioFilter(
void) {}
2111 for (uint32_t i = 0; i<numStates; i++)
2122 destination.setCoeffs(
bq);
2139 return xn*
bq.coeff[d0] + yn*
bq.coeff[c0];
2143 enum { a0, a1, a2, b1, b2, c0, d0 };
2144 enum { xz1, xz2, yz1, yz2, numStates };
2145 double state[4] = { 0.0, 0.0, 0.0, 0.0 };
2166 FracDelayAPF(
void) {}
2167 ~FracDelayAPF(
void) {}
2191 double yn = xn*alpha + state[0] - alpha*state[1];
2200 double state[2] = { 0.0, 0.0 };
2221 ResLoopFilter(
void) {}
2222 ~ResLoopFilter(
void) {}
2240 double yn = 0.5*xn + 0.5*state[0];
2246 double state[2] = { 0.0, 0.0 };
2264 class DCRemovalFilter
2267 DCRemovalFilter(
void) {}
2268 ~DCRemovalFilter(
void) {}
2274 for (uint32_t i = 0; i<numStates; i++)
2277 sampleRate = _sampleRate;
2280 double theta_c =
kTwoPi*
fc / sampleRate;
2281 double gamma = cos(theta_c) / (1.0 + sin(theta_c));
2284 coeffs[a0] = (1.0 + gamma) / 2.0;
2285 coeffs[a1] = -(1.0 + gamma) / 2.0;
2308 enum { xz1, xz2, yz1, yz2, numStates };
2309 double state[4] = { 0.0, 0.0, 0.0, 0.0 };
2310 enum { a0, a1, a2, b1, b2 };
2311 double coeffs[5] = { 0.0, 0.0, 0.0, 0.0, 0.0 };
2313 double sampleRate = 1.0;
2341 for (uint32_t i = 0; i<numStates; i++)
2344 sampleRate = _sampleRate;
2350 if (fc == _fc && Q == _Q)
2357 double K = tan(
kPi*fc / sampleRate);
2358 double delta = K*K*Q + K + Q;
2361 coeffs[a0] = K / delta;;
2363 coeffs[a2] = -K / delta;
2364 coeffs[b1] = 2.0*Q*(K*K - 1) / delta;
2365 coeffs[b2] = (K*K*Q - K + Q) / delta;
2376 double yn = coeffs[a0] * xn + coeffs[a1] * state[xz1] + coeffs[a2] * state[xz2] - coeffs[b1] * state[yz1] - coeffs[b2] * state[yz2];
2377 state[xz2] = state[xz1];
2379 state[yz2] = state[yz1];
2385 enum { xz1, xz2, yz1, yz2, numStates };
2386 double state[4] = { 0.0, 0.0, 0.0, 0.0 };
2387 enum { a0, a1, a2, b1, b2 };
2388 double coeffs[5] = { 0.0, 0.0, 0.0, 0.0, 0.0 };
2391 double sampleRate = 1.0;
2418 sampleRate = _sampleRate;
2425 for (uint32_t i = 0; i<numStates; i++)
2432 if (fc == _fc && Q == _Q)
2439 double theta_c = 2.0*
kPi*fc / sampleRate;
2441 double betaNumerator = 1.0 - ((d / 2.0)*(sin(theta_c)));
2442 double betaDenominator = 1.0 + ((d / 2.0)*(sin(theta_c)));
2444 double beta = 0.5*(betaNumerator / betaDenominator);
2445 double gamma = (0.5 + beta)*(cos(theta_c));
2446 double alpha = (0.5 + beta - gamma) / 2.0;
2450 coeffs[a1] = 2.0*alpha;
2452 coeffs[b1] = -2.0*gamma;
2453 coeffs[b2] = 2.0*beta;
2464 double yn = coeffs[a0] * xn + coeffs[a1] * state[xz1] + coeffs[a2] * state[xz2] - coeffs[b1] * state[yz1] - coeffs[b2] * state[yz2];
2465 state[xz2] = state[xz1];
2467 state[yz2] = state[yz1];
2473 enum { xz1, xz2, yz1, yz2, numStates };
2474 double state[4] = { 0.0, 0.0, 0.0, 0.0 };
2475 enum { a0, a1, a2, b1, b2 };
2476 double coeffs[5] = { 0.0, 0.0, 0.0, 0.0, 0.0 };
2479 double sampleRate = 1.0;
2507 for (uint32_t i = 0; i<numStates; i++)
2510 sampleRate = _sampleRate;
2516 if (fc == _fc && Q == _Q)
2522 double theta_c =
kTwoPi*fc / sampleRate;
2526 double betaNumerator = 1.0 - ((d / 2.0)*(sin(theta_c)));
2527 double betaDenominator = 1.0 + ((d / 2.0)*(sin(theta_c)));
2529 double beta = 0.5*(betaNumerator / betaDenominator);
2530 double gamma = (0.5 + beta)*(cos(theta_c));
2531 double alpha = (0.5 + beta + gamma) / 2.0;
2535 coeffs[a1] = -2.0*alpha;
2537 coeffs[b1] = -2.0*gamma;
2538 coeffs[b2] = 2.0*beta;
2549 double yn = coeffs[a0] * xn + coeffs[a1] * state[xz1] + coeffs[a2] * state[xz2] - coeffs[b1] * state[yz1] - coeffs[b2] * state[yz2];
2550 state[xz2] = state[xz1];
2552 state[yz2] = state[yz1];
2558 enum { xz1, xz2, yz1, yz2, numStates };
2559 double state[4] = { 0.0, 0.0, 0.0, 0.0 };
2560 enum { a0, a1, a2, b1, b2 };
2561 double coeffs[5] = { 0.0, 0.0, 0.0, 0.0, 0.0 };
2564 double sampleRate = 1.0;
2591 for(uint32_t i=0; i<numStates; i++)
2594 sampleRate = _sampleRate;
2600 if (fc == _fc && Q == _Q)
2606 double theta_c =
kTwoPi*fc / sampleRate;
2608 coeffs[b2] = exp(-2.0*
kPi*(BW / sampleRate));
2609 coeffs[b1] = ((-4.0*coeffs[b2]) / (1.0 + coeffs[b2]))*cos(theta_c);
2610 coeffs[a0] = 1.0 - pow(coeffs[b2], 0.5);
2611 coeffs[a2] = -coeffs[a0];
2622 double yn = coeffs[a0]*xn + coeffs[a2]*state[xz2] - coeffs[b1]*state[yz1] -coeffs[b2]*state[yz2];
2623 state[xz2] = state[xz1];
2625 state[yz2] = state[yz1];
2626 state[yz1] = yn * loss;
2631 enum { xz1, xz2, yz1, yz2, numStates };
2632 double state[4] = { 0.0, 0.0, 0.0, 0.0 };
2633 enum { a0, a2, b1, b2 };
2634 double coeffs[4] = { 0.0, 0.0, 0.0, 0.0 };
2637 double sampleRate = 1.0;
2654 class LowShelfFilter
2657 LowShelfFilter(
void) {}
2658 ~LowShelfFilter(
void) {}
2664 for (uint32_t i = 0; i<numStates; i++)
2667 sampleRate = _sampleRate;
2673 double theta_c =
kTwoPi*shelfFreq / sampleRate;
2674 double mu = pow(10.0, boostCut_dB / 20.0);
2676 double beta = 4.0 / (1.0 + mu);
2677 double delta = beta*tan(theta_c / 2.0);
2678 double gamma = (1.0 - delta) / (1.0 + delta);
2681 coeffs[a0] = (1.0 - gamma) / 2.0;
2682 coeffs[a1] = (1.0 - gamma) / 2.0;
2684 coeffs[b1] = -gamma;
2687 coeffs[c0] = mu - 1.0;
2699 double yn = coeffs[a0] * xn + coeffs[a1] * state[xz1] + coeffs[a2] * state[xz2] - coeffs[b1] * state[yz1] - coeffs[b2] * state[yz2];
2700 state[xz2] = state[xz1];
2702 state[yz2] = state[yz1];
2705 return xn*coeffs[d0] + yn*coeffs[c0];
2709 enum { xz1, xz2, yz1, yz2, numStates };
2710 double state[4] = { 0.0, 0.0, 0.0, 0.0 };
2711 enum { a0, a1, a2, b1, b2, c0, d0 };
2712 double coeffs[7] = { 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 };
2714 double boostCut_dB = 0.0;
2715 double sampleRate = 1.0;
2733 class HighShelfFilter
2736 HighShelfFilter(
void) {}
2737 ~HighShelfFilter(
void) {}
2743 for (uint32_t i = 0; i<numStates; i++)
2746 sampleRate = _sampleRate;
2752 double theta_c =
kTwoPi*shelfFreq / sampleRate;
2753 double mu = pow(10.0, boostCut_dB / 20.0);
2755 double beta = (1.0 + mu) / 4.0;
2756 double delta = beta*tan(theta_c / 2.0);
2757 double gamma = (1.0 - delta) / (1.0 + delta);
2759 coeffs[a0] = (1.0 + gamma) / 2.0;
2760 coeffs[a1] = -coeffs[a0];
2762 coeffs[b1] = -gamma;
2765 coeffs[c0] = mu - 1.0;
2777 double yn = coeffs[a0] * xn + coeffs[a1] * state[xz1] + coeffs[a2] * state[xz2] - coeffs[b1] * state[yz1] - coeffs[b2] * state[yz2];
2778 state[xz2] = state[xz1];
2780 state[yz2] = state[yz1];
2783 return xn*coeffs[d0] + yn*coeffs[c0];
2787 enum { xz1, xz2, yz1, yz2, numStates };
2788 double state[4] = { 0.0, 0.0, 0.0, 0.0 };
2789 enum { a0, a1, a2, b1, b2, c0, d0 };
2790 double coeffs[7] = { 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 };
2792 double boostCut_dB = 0.0;
2793 double sampleRate = 1.0;
2810 class ParametricFilter
2813 ParametricFilter(
void) {}
2814 ~ParametricFilter(
void) {}
2820 for (uint32_t i = 0; i<numStates; i++)
2823 sampleRate = _sampleRate;
2829 if (fc == _fc && Q == _Q && boostCut_dB == _boostCut_dB)
2833 boostCut_dB = _boostCut_dB;
2836 double theta_c =
kTwoPi*fc / sampleRate;
2837 double mu = pow(10.0, boostCut_dB / 20.0);
2840 double tanArg = theta_c / (2.0 * Q);
2841 if (tanArg >= 0.95*
kPi / 2.0) tanArg = 0.95*
kPi / 2.0;
2844 double zeta = 4.0 / (1.0 + mu);
2845 double betaNumerator = 1.0 - zeta*tan(tanArg);
2846 double betaDenominator = 1.0 + zeta*tan(tanArg);
2848 double beta = 0.5*(betaNumerator / betaDenominator);
2849 double gamma = (0.5 + beta)*(cos(theta_c));
2850 double alpha = (0.5 - beta);
2855 coeffs[a2] = -alpha;
2856 coeffs[b1] = -2.0*gamma;
2857 coeffs[b2] = 2.0*beta;
2859 coeffs[c0] = mu - 1.0;
2871 double yn = coeffs[a0] * xn + coeffs[a1] * state[xz1] + coeffs[a2] * state[xz2] - coeffs[b1] * state[yz1] - coeffs[b2] * state[yz2];
2872 state[xz2] = state[xz1];
2874 state[yz2] = state[yz1];
2877 return xn*coeffs[d0] + yn*coeffs[c0];
2881 enum { xz1, xz2, yz1, yz2, numStates };
2882 double state[4] = { 0.0, 0.0, 0.0, 0.0 };
2883 enum { a0, a1, a2, b1, b2, c0, d0 };
2884 double coeffs[7] = { 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 };
2887 double boostCut_dB = 0.0;
2888 double sampleRate = 1.0;
2910 ~LP1PFilter(
void) {}
2917 sampleRate = _sampleRate;
2923 for (uint32_t i = 0; i<numStates; i++)
2936 double theta_c = 2.0*
kPi*fc / sampleRate;
2937 double gamma = 2.0 - cos(theta_c);
2939 double filter_b1 = pow((gamma*gamma - 1.0), 0.5) - gamma;
2940 double filter_a0 = 1.0 + filter_b1;
2943 coeffs[a0] = filter_a0;
2946 coeffs[b1] = filter_b1;
2959 double yn = coeffs[a0] * xn + coeffs[a1] * state[xz1] + coeffs[a2] * state[xz2] - coeffs[b1] * state[yz1] - coeffs[b2] * state[yz2];
2960 state[xz2] = state[xz1];
2962 state[yz2] = state[yz1];
2968 enum { xz1, xz2, yz1, yz2, numStates };
2969 double state[4] = { 0.0, 0.0, 0.0, 0.0 };
2970 enum { a0, a1, a2, b1, b2 };
2971 double coeffs[5] = { 0.0, 0.0, 0.0, 0.0, 0.0 };
2974 double sampleRate = 1.0;
2980 enum class PluckFilterType {kPluck, kPluckAndBridge, kPickup, kPluckAndPickup, kBridge, kPluckPickupBridge};
3000 class PluckPosFilter
3003 PluckPosFilter(
void) {}
3004 ~PluckPosFilter(
void) {}
3022 void reset(
double _sampleRate,
double minimumPitch = MIDI_NOTE_0_FREQ)
3028 pickupFilter.
reset(_sampleRate);
3058 if (type == PluckFilterType::kBridge)
3061 if (type == PluckFilterType::kPickup)
3069 double pluck = 0.5*(xn - yn);
3070 if (type == PluckFilterType::kPluck)
3074 if (type == PluckFilterType::kPluckAndPickup)
3078 if (type == PluckFilterType::kPluckAndBridge)
3081 if (type == PluckFilterType::kPluckPickupBridge)
void setDelayInSamples(double _delaySamples)
set comb delay time - this will be based on virtual plucking position on string
Definition: synthbase.h:3041
void reset(double _sampleRate)
Definition: synthbase.h:2914
std::string * tableNames
names of tables
Definition: synthbase.h:1129
Object that acts as the PCM sample database, as shared synth-wide resource. You should study this esp...
Definition: synthbase.h:1288
uint32_t tableLength
length
Definition: synthbase.h:1184
virtual IWavetableSource * getTableSource(const char *uniqueTableName)=0
get a table source based on its unique name string
void reset()
reset the counter
Definition: synthbase.h:530
const char * dllPath
path to the plugin, used for finding PCM sample WAV files
Definition: synthbase.h:1036
std::shared_ptr< Modulators > modulationInput
Definition: synthbase.h:1595
virtual bool getModuleCoreStrings(std::vector< std::string > &moduleCoreStrings)
Gets a std::vector of the names of the four cores in this module.
Definition: synthbase.cpp:1522
double processAudioSample(double xn)
run the filter
Definition: synthbase.h:2297
float * getOutputBuffer(uint32_t channel)
Get a naked pointer to an audio OUTPUT buffer by channel.
Definition: synthbase.cpp:162
SynthClock hardSyncClock
clock for reset oscillator
Definition: synthbase.h:372
bool setGlideTime(double glideTime_mSec, double sampleRate)
Change the glide time; this is optional.
Definition: synthbase.cpp:764
void setParameters(double _fc, double _Q)
Definition: synthbase.h:2598
const uint32_t NUM_MODULE_CORES
Definition: synthconstants.h:132
~PCMSampleDatabase()
clear out the table sources
Definition: synthbase.cpp:1032
double phaseInc
phase inc = fo/fs
Definition: synthbase.h:156
uint32_t numActiveChannels
number of active channels; not used in SynthLab but available
Definition: synthbase.h:705
double g
one pole filter feedback coefficient
Definition: synthbase.h:329
std::unique_ptr< GlideModulator > glideModulator
Definition: synthbase.h:1607
virtual void setModValue(uint32_t index, double value)=0
set a modulation value to the array for a certain channel
void initWithClock(SynthClock &clock)
Initialize this clock with another SynthClock.
Definition: synthbase.cpp:211
double processAudioSample(double xn, PluckFilterType type)
run the string of filters
Definition: synthbase.h:3056
bool isActive()
checks to see if the modulator is running, or completed
Definition: synthbase.h:627
virtual bool addModuleCore(std::shared_ptr< ModuleCore > core)
adds a module core to the module's set of four
Definition: synthbase.cpp:1555
void writeBuffer(T input)
Definition: synthbase.h:1921
~WavetableDatabase()
clear out the table sources
Definition: synthbase.cpp:936
void setXFadeTimeSamples(double _xfadeTimeSamples)
Definition: synthbase.h:491
std::shared_ptr< ModuleCore > moduleCores[NUM_MODULE_CORES]
Definition: synthbase.h:1613
double outputComp
output scaling factor (NOT volume or attenuation, waveform specific)
Definition: synthbase.h:1227
void reset(double _sampleRate)
Definition: synthbase.h:2589
std::vector< midiEvent > midiEventQueue
queue
Definition: synthbase.h:1347
double timeSigNumerator
time signature numerator
Definition: synthbase.h:1342
double sampleRate
fs
Definition: synthstructures.h:246
IMidiInputData * midiInputData
MIDI input daa, usually owned by engine.
Definition: synthbase.h:1034
sampleSourceMap sampleDatabase
map that connects PCM sample set names to source objects
Definition: synthbase.h:1305
const double kPi
pi to 80 decimal places
Definition: synthconstants.h:522
double outputComp
output scaling factor
Definition: synthbase.h:1095
void reset(double _sampleRate)
Definition: synthbase.h:2272
virtual bool clearModuleCores()
Clears out the module core pointer list.
Definition: synthbase.cpp:1638
void setExpireSamples(uint32_t _targetValueInSamples)
set target value
Definition: synthbase.h:403
uint32_t endMIDINote
ending MIDI note for the glide
Definition: synthstructures.h:244
BQCoeffs bq
coefficients
Definition: synthbase.h:1938
void reset(double _sampleRate, double minimumPitch=MIDI_NOTE_0_FREQ)
reset the delay, calculate a new length based on sample rate and minimum pitch
Definition: synthbase.h:3022
virtual bool removeTableSource(const char *uniqueTableName)=0
remove a table from the database
void advanceClock(uint32_t ticks=1)
Nudge the clock on the modulator; this is used for block processing where the modulator output output...
Definition: synthbase.cpp:718
uint32_t xfadeTime_Samples
the target crossfade time
Definition: synthbase.h:245
void setParameters(double shelfFreq, double boostCut_dB)
Definition: synthbase.h:2750
virtual bool selectModuleCore(uint32_t index)
Select a core.
Definition: synthbase.cpp:1589
double doPinkingFilter(double white)
run the pinking filter
Definition: synthbase.cpp:858
void copyCoeffs(BQAudioFilter &destination)
Definition: synthbase.h:2121
void setParameters(double shelfFreq, double boostCut_dB)
Definition: synthbase.h:2671
float ** outputBuffer
array of output buffer pointers
Definition: synthbase.h:97
IModulator * modulationInputs
input modulation values
Definition: synthbase.h:1023
virtual bool reset(double _sampleRate)=0
double BPM
current BPM, needed for LFO sync to BPM
Definition: synthbase.h:1043
std::shared_ptr< AudioBuffer > audioBuffers
Definition: synthbase.h:1604
void advanceClock(uint32_t ticks=1)
Nudge the clock on the modulator; this is used for block processing where the modulator output output...
Definition: synthbase.cpp:800
virtual bool haveValidSamples()=0
query for valid samples; needed if WAV parsing fails and we need to delete the entry ...
void addPhaseOffset(double _phaseOffset, bool wrap=true)
For phase modulation, this adds a phase offset and then optionally checks/wraps the counter as needed...
Definition: synthbase.cpp:293
SynthModule(std::shared_ptr< MidiInputData > _midiInputData)
Constructs a SynthModule.
Definition: synthbase.cpp:1356
double modEnd
ramp mod end value
Definition: synthbase.h:422
std::shared_ptr< AudioBuffer > fmBuffer
Definition: synthbase.h:1610
double absoluteBufferTime_Sec
the time in seconds of the sample index at top of buffer
Definition: synthbase.h:1340
virtual bool clearSampleSources() override
clear all entries from the std::map
Definition: synthbase.cpp:1127
void setSamplesInBlock(uint32_t _samplesInBlock)
Set the number of samples in a block for processing.
Definition: synthbase.cpp:176
uint32_t moduleType
type of module, LFO_MODULE, EG_MODULE, etc...
Definition: synthbase.h:1508
float ** getInputBuffers()
Definition: synthbase.h:296
uint32_t samplesToProcess
number of samples in this block
Definition: synthbase.h:1039
bool crossfade(XFadeType xfadeType, double inputA, double inputB, double &output)
Perform crossfade FROM A to B on a pair of input values to oroduce a single output value...
Definition: synthbase.cpp:412
virtual bool removeSampleSource(const char *uniqueSampleSetName) override
remove a PCM sample source from the database
Definition: synthbase.cpp:1102
IModulator * modulationOutputs
output modulation values
Definition: synthbase.h:1024
bool advanceWrapClock(uint32_t renderInterval=1)
Advance the clock some number of tics by adding the phaseInc value and then check to see if modulo co...
Definition: synthbase.cpp:251
void reset(double startValue=0.0)
Reset to initial state.
Definition: synthbase.cpp:226
double timerInc
timer incrementer value
Definition: synthbase.h:418
double freqOffset
FM.
Definition: synthbase.h:158
std::shared_ptr< Modulators > modulationOutput
Definition: synthbase.h:1598
void saveState()
Freeze and save the current state of the clock; for PM and FM.
Definition: synthbase.cpp:345
void reset()
Reset to initial state; just resets counters to 0.
Definition: synthbase.cpp:450
void clear()
Definition: synthbase.h:2215
void resetTimer()
reset the counter
Definition: synthbase.h:400
uint32_t xfadeTime_Counter
counter for timer
Definition: synthbase.h:246
double phaseOffset
PM.
Definition: synthbase.h:157
virtual double getModValue(uint32_t index)
get a value from a slot in the modulation array
Definition: synthbase.cpp:1327
~AudioBuffer()
As one of the few objects that uses naked pointers (for maximum compatibility between plugin framewor...
Definition: synthbase.cpp:39
std::map< std::string, IWavetableSource *> wavetableSourceMap
map that connects wavetable names to source objects
Definition: synthbase.h:1479
bool standAloneMode
flag for stand-alone mode of operation outside of SynthLab
Definition: synthbase.h:1513
void createCircularBufferPowerOfTwo(uint32_t _bufferLengthPowerOfTwo)
Definition: synthbase.h:1694
Implements a simple 2nd order LPF.
Definition: synthbase.h:2200
const char * waveformName
string for the GUI
Definition: synthbase.h:1098
double z1
one pole filter state variable
Definition: synthbase.h:330
virtual uint32_t getSelectedCoreIndex()
get the index of the selected core
Definition: synthbase.cpp:1576
const uint32_t UNDEFINED_MODULE
Definition: synthconstants.h:110
IPCMSampleDatabase * getIPCMSampleDatabase()
Definition: synthbase.h:1514
uint32_t wrapMask
wrapping mask = length - 1
Definition: synthbase.h:1185
void setCoeffs(BQCoeffs &_coeffs)
Definition: synthbase.h:2116
double frequency_Hz
clock frequency
Definition: synthbase.h:159
std::shared_ptr< Modulators > getModulationInput()
Definition: synthbase.h:1776
std::default_random_engine defaultGeneratorEngine
Definition: synthbase.h:487
virtual IWavetableSource * getTableSource(const char *uniqueTableName) override
selects a table source based on the unique table name
Definition: synthbase.cpp:949
std::shared_ptr< MidiInputData > midiInputData
Definition: synthbase.h:1601
bool reset(double _sampleRate, double startPhase, int32_t xfadeSamples=16)
Specialized reset function that:
Definition: synthbase.cpp:559
IPCMSampleDatabase * sampleDatabase
PCM sample database, usually owned by engine.
Definition: synthbase.h:1033
void reset()
Definition: synthbase.h:2106
virtual void setSampleLoopMode(SampleLoopMode _loopMode)=0
Set the looping mode:
Simple version of the AudioFilter object from Designing Audio Effects Plugins in C++ 2nd Ed...
Definition: synthbase.h:1890
Structure to hold the seven coeffieicents used in the AudioFilter object from Designing Audio Effects...
Definition: synthbase.h:1871
Definition: synthengine.cpp:16
double processAudioSample(double xn)
run the filter
Definition: synthbase.h:2697
void clear()
Definition: synthbase.h:3008
virtual bool addTableSource(const char *uniqueTableName, IWavetableSource *tableSource) override
add a table source to the database
Definition: synthbase.cpp:977
Definition: synthstructures.h:235
uint32_t blockSize
the maximum block size
Definition: synthbase.h:100
virtual bool getAllModuleStrings(std::vector< std::string > &moduleStrings, std::string ignoreStr)
Gets a std::vector of all Module Strings concatenated from all cores in succession.
Definition: synthbase.cpp:1441
std::shared_ptr< AudioBuffer > getAudioBuffers()
Definition: synthbase.h:1780
XFader()
simple construction
Definition: synthbase.h:440
double countDownTimer
current timer value; this always counts DOWN regardless of the polarity of the modulation (up or down...
Definition: synthbase.h:464
uint32_t getModuleType()
Definition: synthbase.h:1701
virtual IPCMSampleSource * getSampleSource(const char *uniqueSampleSetName)=0
get a PCM sample source based on its unique name string
virtual bool addSampleSource(const char *uniqueSampleSetName, IPCMSampleSource *sampleSource)=0
adds a PCM sample to the database
uint32_t getInputChannelCount()
Definition: synthbase.h:300
double processAudioSample(double xn)
run the filter
Definition: synthbase.h:2189
ModuleCoreData coreData
core strings (16) and mod knob labels (4)
Definition: synthbase.h:1512
uint64_t ** ppHexTableSet
pointers to sets of hex encoded tables
Definition: synthbase.h:1089
void reset(double _sampleRate)
Definition: synthbase.h:2818
void reset(double _sampleRate)
Definition: synthbase.h:2339
virtual bool startGlideModulation(GlideInfo &glideInfo)
starts the built-in glide modulator
Definition: synthbase.cpp:1539
std::unique_ptr< GlideModulator > glideModulator
built-in glide modulator for oscillators
Definition: synthbase.h:1514
void clearMidiEvents()
Clear the queue.
Definition: synthbase.cpp:902
virtual uint32_t getWaveTableLength()=0
void removePhaseOffset()
Remove existing a phase offset to the reset clock; for supporting phase modulation.
Definition: synthbase.cpp:634
void writeDelay(double xn)
write a value into the top of the delay
Definition: synthbase.h:2040
T readBuffer(double delayInFractionalSamples)
Definition: synthbase.h:1946
uint32_t getTick()
tick count
Definition: synthbase.h:414
uint32_t getMidiEventCount()
Definition: synthbase.cpp:910
double sampleRate
fs
Definition: synthbase.h:1038
void initInputValues()
set default values in modulator array
Definition: synthbase.cpp:1300
bool startModulator(double startValue, double endValue, double modTime_mSec, double sampleRate)
Setup the timers and start the ramp modulator running. The modulator produces an output on the range ...
Definition: synthbase.cpp:652
Implementation of a one-pole LPF.
Definition: synthbase.h:2698
void reset(double _sampleRate)
Definition: synthbase.h:2416
Modulators()
constructs the modulator object
Definition: synthbase.cpp:1281
IModulator * getModulatorPtr()
Definition: synthbase.h:1639
Specialized version of the RampModulator, with nearly identically named functions to peform the porta...
Definition: synthbase.h:442
bool running
state variable
Definition: synthbase.h:247
bool setHardSyncFrequency(double hardSyncFrequency)
Sets the new reset oscillator frequency in Hz.
Definition: synthbase.cpp:575
uint32_t getExpireSamples()
Definition: synthbase.h:407
virtual bool clearTableSources()=0
clear all source pointers
void setUnisonMode(double _unisonDetuneCents, double _unisonStarPhase)
Definition: synthbase.h:1783
void restoreState()
Restore the clock to its last saved state; for PM and FM.
Definition: synthbase.cpp:357
SampleLoopMode
Definition: synthbase.h:710
double modRange
range of modulation output
Definition: synthbase.h:420
uint32_t tableLength
length
Definition: synthbase.h:1225
void setParameters(double _fc)
Definition: synthbase.h:2928
void clear()
Definition: synthbase.h:2713
virtual int32_t getState()
Definition: synthbase.h:1769
double processAudioSample(double xn)
Definition: synthbase.h:2131
bool timerExpired()
check if we hit target
Definition: synthbase.h:410
virtual double selectSample(double oscFrequency)=0
Selects a PCM sample based on the current oscillation frequency (after all modulations have been appl...
unsigned int tablePtrsCount
number of pointers
Definition: synthbase.h:1127
bool timerActive
state of modulator, running (true) or expired (false)
Definition: synthbase.h:462
uint32_t wrapMask
mask = length - 1
Definition: synthbase.h:1226
void addPhaseOffset(double offset)
Add a phase offset to the reset clock; for supporting phase modulation.
Definition: synthbase.cpp:625
void reset()
Definition: synthbase.h:2226
Interface for wavetable databases.
Definition: synthbase.h:643
virtual bool addSampleSource(const char *uniqueSampleSetName, IPCMSampleSource *sampleSource) override
add a PCM sample source to the database
Definition: synthbase.cpp:1075
T readBuffer(int delayInSamples)
Definition: synthbase.h:1931
const char * waveformName
waveform name string
Definition: synthbase.h:1188
uint32_t counter
the timer counter
Definition: synthbase.h:204
double getNextModulationValue(uint32_t advanceClock=1)
Get the current output of the modulator; this is called repeatedly over the ramp modulation time...
Definition: synthbase.cpp:778
void clear()
Definition: synthbase.h:2007
Interface for modulator objects.
Definition: synthbase.h:530
double outputComp
output scaling factor (NOT volume or attenuation, waveform specific)
Definition: synthbase.h:1186
virtual bool clearSampleSources()=0
clear all the sample sources
PluckFilterType
Definition: synthbase.h:2772
void reset(double _sampleRate, double minimumPitch=MIDI_NOTE_0_FREQ)
reset the delay, calculate a new length based on sample rate and minimum pitch
Definition: synthbase.h:2016
XFadeData getCrossfadeData()
Returns the current state of the crossfade or hold.
Definition: synthbase.cpp:478
virtual bool clearTableSources() override
clear all entries from the std::map
Definition: synthbase.cpp:1020
uint32_t getBlockSize()
Definition: synthbase.h:304
void setFrequency(double _frequency_Hz, double _sampleRate)
Set the clock frequency, which calculates the current phase increment value.
Definition: synthbase.cpp:279
double doSlewLimiter(double input)
Definition: synthbase.h:534
void setSlewValue(double _g)
b1 coefficient
Definition: synthbase.h:533
virtual double * getModArrayPtr(uint32_t index)
get a pointer to a slot in the modulation array
Definition: synthbase.cpp:1314
void setXFadeTime(uint32_t _xfadeTime_Samples)
Set the current crossfade time.
Definition: synthbase.cpp:394
void clear()
fast clearing of modulator array
Definition: synthbase.cpp:1290
virtual bool selectDefaultModuleCore()
Select the default core, which is always the first in the list.
Definition: synthbase.cpp:1605
void reset()
Resets object to initialized state.
Definition: synthbase.cpp:382
double coeffs[5]
biquad coefficients
Definition: synthbase.h:2103
uint32_t xfadeTime_Samples
target crossfade time
Definition: synthbase.h:289
virtual int32_t getState()
Definition: synthbase.h:1690
void setParameters(double _fc, double _Q, double _boostCut_dB)
Definition: synthbase.h:2827
void flushDelays()
Definition: synthbase.h:1901
double doLinearInterp(double y1, double y2, double fractional_X)
performs linear interpolation of fractional x distance between two adjacent (x,y) points; returns int...
Definition: synthbase.h:1651
const char * waveformName
waveform name
Definition: synthbase.h:1229
void startHardSync(SynthClock oscClock)
Starts the hard sync operation as a result of being reset, using the main oscillator's SynthClock to ...
Definition: synthbase.cpp:589
std::shared_ptr< double > table
the table (shared)
Definition: synthbase.h:1224
virtual bool addTableSource(const char *uniqueTableName, IWavetableSource *tableSource)=0
adds a table to the database
const double kTwoPi
2pi to 80 decimal places
Definition: synthconstants.h:529
virtual bool initialize(const char *_dllDirectory)
Definition: synthbase.h:1766
uint32_t xfadeTime_Counter
crossfade timer counter
Definition: synthbase.h:290
uint32_t timeSigDenomintor
time signature denominator
Definition: synthbase.h:1343
double processAudioSample(double xn)
run the filter
Definition: synthbase.h:2547
CoreProcData coreProcessData
Definition: synthbase.h:1624
void addFrequencyOffset(double _freqOffset)
For frequency modulation, this adds a frequency offset, and recalculates the phase increment value...
Definition: synthbase.cpp:325
void setFMBuffer(std::shared_ptr< AudioBuffer > pmBuffer)
Definition: synthbase.h:1788
virtual bool removeSampleSource(const char *uniqueSampleSetName)=0
remove a PCM sample set from the database
float ** outputBuffers
set of output bufers, one per channel
Definition: synthbase.h:1028
double countUpTimer
current timer value; this always counts UP regardless of the polarity of the modulation (up or down) ...
Definition: synthbase.h:419
void * moduleParameters
module parameters, cloaked as void* – varies according to module
Definition: synthbase.h:1035
double glideRange
range (distance between MIDI note numbers, as double)
Definition: synthbase.h:465
void removePhaseOffset()
For phase modulation, this removes a phase offset, notice that the function does not attempt to wrap ...
Definition: synthbase.cpp:311
float ** inputBuffers
set of input bufers, one per channel
Definition: synthbase.h:1027
float ** fmBuffers
used for DX synths (phase modulator synths)
Definition: synthbase.h:1029
void removeFrequencyOffset()
For frequency modulation, this removes a frequency offset and recalculates the phase inc...
Definition: synthbase.cpp:336
MIDINoteEvent noteEvent
the MIDI note event for the current audio block
Definition: synthbase.h:1044
IWavetableDatabase * wavetableDatabase
wavetable database, usually owned by engine
Definition: synthbase.h:1032
bool timerActive
state of modulator, running (true) or expired (false)
Definition: synthbase.h:417
double processAudioSample(double xn)
run the filter
Definition: synthbase.h:2775
XFader hardSyncFader
crossfader for smearing discontinuity
Definition: synthbase.h:374
bool startGlideModulation(GlideInfo &glideInfo)
Definition: synthbase.h:1696
double doPinkNoise()
Function generate pink noise by filtering white noise.
Definition: synthbase.cpp:843
const uint32_t kDefaultWaveTableLength
Definition: synthbase.h:1135
virtual bool reset(CoreProcData &processInfo)=0
double audioOutput[STEREO_CHANNELS]
array of audio output samples
Definition: synthbase.h:704
double processAudioSample(double xn)
run the filter
Definition: synthbase.h:2462
const double * dTable
table of 64-bit doubles
Definition: synthbase.h:1183
uint32_t moduleIndex
index of this core
Definition: synthbase.h:1511
double doHardSyncXFade(double inA, double inB)
Perform the crossfade on the two oscillator signals to smear over the discontinuity.
Definition: synthbase.cpp:611
virtual void setStandAloneMode(bool b)
Sets the stand-alone mode flag on all cores.
Definition: synthbase.cpp:1621
void setInterpolate(bool b)
Definition: synthbase.h:1972
double state[4]
state registers
Definition: synthbase.h:1937
SynthLabTableSet ** tablePtrs
set of table-sets
Definition: synthbase.h:1128
SynthClock & operator=(const SynthClock ¶ms)
Overloaded = operator for setting two clocks equal to each other by copying member values from a sour...
Definition: synthbase.cpp:189
IWavetableDatabase * getIWavetableDatabase()
Definition: synthbase.h:1476
void pushMidiEvent(midiEvent event)
Add a MIDI event to the queue.
Definition: synthbase.cpp:892
Interface for PCM sample databases.
Definition: synthbase.h:807
float ** inputBuffer
array of input buffer pointers
Definition: synthbase.h:96
double getNextModulationValue(uint32_t advanceClock=1)
Get the current output of the modulator; this is called repeatedly over the ramp modulation time...
Definition: synthbase.cpp:690
void setExpireMilliSec(double timeMSec, double sampleRate)
set target value
Definition: synthbase.h:404
double modStart
ramp mod start value
Definition: synthbase.h:421
void setAlpha(double _alpha)
Definition: synthbase.h:2178
void setDelayInSamples(double _delaySamples)
set delay time in samples; used to access the delay when reading
Definition: synthbase.h:2029
double state[NUM_VARS]
for state save
Definition: synthbase.h:162
double hardSyncFrequency
reset oscillator rate
Definition: synthbase.h:375
double unisonStartPhase
unison start phase value for this core
Definition: synthbase.h:1041
uint32_t * tableLengths
pointers to lengths of each of the hex encoded tables
Definition: synthbase.h:1088
double processAudioSample(double xn, double loss=1.0)
run the filter
Definition: synthbase.h:2620
Definition: synthbase.h:1791
const uint64_t * uTable
table of 64-bit HEX values
Definition: synthbase.h:1182
XFadeType
Definition: synthconstants.h:81
uint32_t samplesInBlock
the number of samples to process in the block (in case of partial blocks)
Definition: synthbase.h:101
virtual bool removeTableSource(const char *uniqueTableName) override
remove a table source from the database
Definition: synthbase.cpp:1003
double mcounter
modulo counter [0.0, +1.0], this is the value you use
Definition: synthbase.h:155
double unisonDetuneCents
detuning value for this core
Definition: synthbase.h:1040
double state[4]
state variables
Definition: synthbase.h:2101
uint32_t startMIDINote
starting MIDI note for the glide
Definition: synthstructures.h:243
virtual void selectTable(uint32_t midiNoteNumber)=0
Objects that access the database will select a table based on the user's waveform selection...
void reset(double _sampleRate)
Definition: synthbase.h:2662
void advanceClock(uint32_t renderInterval=1)
Advance the clock some number of tics by adding the phaseInc value.
Definition: synthbase.cpp:239
void reset(double _sampleRate)
Definition: synthbase.h:2505
void createCircularBuffer(uint32_t _bufferLength)
Definition: synthbase.h:1894
double doWhiteNoise()
Function generate white noise.
Definition: synthbase.cpp:833
bool holding
state variable for holding
Definition: synthbase.h:293
virtual IPCMSampleSource * getSampleSource(const char *uniqueSampleSetName) override
selects a PCM sample source based on the unique table name
Definition: synthbase.cpp:1046
ModuleCoreData & getModuleData()
provides access to the core data:
Definition: synthbase.h:1717
void setParameters(double _fc, double _Q)
Definition: synthbase.h:2514
double BPM
beats per minute, aka "tempo"
Definition: synthbase.h:1341
DelayLine combDelay
for pluck position
Definition: synthbase.h:2884
double doGaussianWhiteNoise(double mean=0.0, double variance=1.0)
Function generate gaussian white noise.
Definition: synthbase.cpp:823
double processAudioSample(double xn)
run the filter
Definition: synthbase.h:2869
double bN[3]
Definition: synthbase.h:496
virtual bool getModKnobStrings(std::vector< std::string > &modKnobStrings)
Gets a std::vector of Mod Knob label strings for the selected core.
Definition: synthbase.cpp:1470
virtual double readWaveTable(double normalizedPhaseInc)=0
Read a table at a normalized index where 0.0 is the start of the table and 1.0 is the end of it...
uint32_t targetValueInSamples
curent target galue
Definition: synthbase.h:205
void reset(double _sampleRate)
Definition: synthbase.h:2741
virtual double getModValue(uint32_t index)=0
get a modulation value from the array for a certain channel
bool startModulator(double startNote, double endNote, double glideTime_mSec, double sampleRate)
Setup the timers and start the ramp modulator running. The modulator produces an output on the range ...
Definition: synthbase.cpp:742
virtual ~SynthModule()
Removes cores, if any.
Definition: synthbase.cpp:1374
void setHoldTimeSamples(double _holdTimeSamples)
Setting the hold time is slightly more complicated than the crossfade time becuase it may be done at ...
Definition: synthbase.cpp:461
virtual uint32_t getValidSampleCount()=0
query for valid sample count (not used in SynthLab but avialable)
bool wrapClock()
Wrap the modulo counter; note that this will wrap the modulo counter as many times as needed to get i...
Definition: synthbase.cpp:263
double readDelay()
read a delayed value at the location specified in the call to setDelayInSamples() ...
Definition: synthbase.h:2052
void flushBuffers()
clear out the audio; used often
Definition: synthbase.cpp:127
void advanceTimer(uint32_t ticks=1)
advance by 1
Definition: synthbase.h:413
void flushBuffer()
Definition: synthbase.h:1890
virtual double * getModArrayPtr(uint32_t index)=0
Used for the modulation matrix to have instant access to the array.
double processAudioSample(double xn)
run the filter
Definition: synthbase.h:2374
void init(uint32_t _numInputChannels, uint32_t _numOutputChannels, uint32_t _blockSize)
Main initializer that creates the new arrays and sets up the object.
Definition: synthbase.cpp:92
virtual const char * getWaveformName()=0
void reset()
Definition: synthbase.h:2171
ModuleCore()
Constructs a ModuleCore.
Definition: synthbase.h:1679
double processAudioSample(double xn)
run the filter
Definition: synthbase.h:2957
Contains the two sets of strings unique to each core: the module strings (waveforms for oscillators) ...
Definition: synthstructures.h:264
double timerInc
timer incrementer value
Definition: synthbase.h:463
bool isActive()
checks to see if the modulator is running, or completed
Definition: synthbase.h:672
double glideTime_mSec
glide time to cover the range of notes
Definition: synthstructures.h:245
virtual bool getModuleStrings(std::vector< std::string > &moduleStrings, std::string ignoreStr="")
Gets a std::vector of Module Strings.
Definition: synthbase.cpp:1390
void setParameters(double _fc, double _Q)
Definition: synthbase.h:2430
const uint32_t kNumMIDICCs
Definition: synthconstants.h:562
virtual void setModValue(uint32_t index, double value)
set a value into a slot in the modulation array
Definition: synthbase.cpp:1341
void * moduleHandle
used for dynamically loading cores from DLLs
Definition: synthbase.h:1510
const char * moduleName
module name must be set in derived constructor
Definition: synthbase.h:1509
bool setModTime(double modTime_mSec, double sampleRate)
Change the modulation time; this is optional.
Definition: synthbase.cpp:676
Abstract base class that encapsulates functionality of a module core; used with the Module-Core parad...
Definition: synthbase.h:1458
const uint32_t MAX_MODULATION_CHANNELS
Definition: synthconstants.h:39
virtual void deleteSamples()=0
Delete the samples, part of destruction process.
SynthClock crossFadeClock
crossfading timer
Definition: synthbase.h:373
float * getInputBuffer(uint32_t channel)
Get a naked pointer to an audio INPUT buffer by channel.
Definition: synthbase.cpp:148
void setParameters(double _fc, double _Q)
Definition: synthbase.h:2348
virtual PCMSampleOutput readSample(double &readIndex, double inc)=0
Read a PCM sample at a fractional read index location (not normalized)
double sampleRate
fs
Definition: synthbase.h:376
LP1PFilter bridgeIntegrator
for bridge LPF
Definition: synthbase.h:2885
uint32_t holdTime_Counter
hold timer counter
Definition: synthbase.h:292
midiEvent * getMidiEvent(uint32_t index)
gets a MIDI event within the event queue
Definition: synthbase.cpp:923
double fc
hardcoded fc value
Definition: synthbase.h:2104
double processAudioSample(double xn)
run the filter
Definition: synthbase.h:2238
uint32_t holdTime_Samples
target hold time
Definition: synthbase.h:291