commit 628c82275fa57908ed2c998a5831e9f97490f231
parent 8773b26df67fa08086e6c68fc144338d4e37f837
Author: Christopher A. Oliver <[email protected]>
Date: Fri, 20 Nov 2015 03:38:49 -0500
Compute carrier waveform range.
This will help pre-biasing for mod section.
Diffstat:
2 files changed, 15 insertions(+), 0 deletions(-)
diff --git a/src/Synth/ADnote.cpp b/src/Synth/ADnote.cpp
@@ -286,6 +286,18 @@ ADnote::ADnote(ADnoteParameters *pars_, SynthParams &spars)
getvoicebasefreq(nvoice),
pars.VoicePar[nvoice].Presonance);
+ //Find range of generated wave
+ float min = NoteVoicePar[nvoice].OscilSmp[0];
+ float max = min;
+ float *smpls = &(NoteVoicePar[nvoice].OscilSmp[1]);
+ for (int i = synth.oscilsize-1; i--; smpls++)
+ if (*smpls > max)
+ max = *smpls;
+ else if (*smpls < min)
+ min = *smpls;
+ NoteVoicePar[nvoice].OscilSmpMin = min;
+ NoteVoicePar[nvoice].OscilSmpMax = max;
+
//I store the first elments to the last position for speedups
for(int i = 0; i < OSCIL_SMP_EXTRA_SAMPLES; ++i)
NoteVoicePar[nvoice].OscilSmp[synth.oscilsize
diff --git a/src/Synth/ADnote.h b/src/Synth/ADnote.h
@@ -187,6 +187,9 @@ class ADnote:public SynthNote
/* Waveform of the Voice */
float *OscilSmp;
+ /* Range of waveform */
+ float OscilSmpMin, OscilSmpMax;
+
/************************************
* FREQUENCY PARAMETERS *
************************************/