commit 5422c48e611b6248c54cebba4353a2970f0d4b72
parent 21745d8febb5adc4011eb137d41460dd2e296a88
Author: fundamental <[email protected]>
Date: Sat, 14 Feb 2015 14:20:52 -0500
PADnote/SUBnote: Refactor
Diffstat:
6 files changed, 114 insertions(+), 125 deletions(-)
diff --git a/src/Synth/PADnote.cpp b/src/Synth/PADnote.cpp
@@ -30,31 +30,28 @@
PADnote::PADnote(PADnoteParameters *parameters,
SynthParams pars)
- :SynthNote(pars), ctl(pars.ctl)
+ :SynthNote(pars), pars(*parameters)
{
- this->pars = parameters;
-
firsttime = true;
setup(pars.frequency, pars.velocity, pars.portamento, pars.note);
}
-
void PADnote::setup(float freq,
- float velocity,
+ float velocity_,
int portamento_,
int midinote,
bool legato)
{
- portamento = portamento_;
- this->velocity = velocity;
- finished_ = false;
+ portamento = portamento_;
+ velocity = velocity_;
+ finished_ = false;
- if(pars->Pfixedfreq == 0)
+ if(!pars.Pfixedfreq)
basefreq = freq;
else {
basefreq = 440.0f;
- int fixedfreqET = pars->PfixedfreqET;
+ int fixedfreqET = pars.PfixedfreqET;
if(fixedfreqET != 0) { //if the frequency varies according the keyboard note
float tmp =
(midinote
@@ -68,21 +65,20 @@ void PADnote::setup(float freq,
}
firsttime = true;
- released = false;
realfreq = basefreq;
if(!legato)
- NoteGlobalPar.Detune = getdetune(pars->PDetuneType, pars->PCoarseDetune,
- pars->PDetune);
+ NoteGlobalPar.Detune = getdetune(pars.PDetuneType, pars.PCoarseDetune,
+ pars.PDetune);
//find out the closest note
float logfreq = logf(basefreq * powf(2.0f, NoteGlobalPar.Detune / 1200.0f));
- float mindist = fabs(logfreq - logf(pars->sample[0].basefreq + 0.0001f));
+ float mindist = fabs(logfreq - logf(pars.sample[0].basefreq + 0.0001f));
nsample = 0;
for(int i = 1; i < PAD_MAX_SAMPLES; ++i) {
- if(pars->sample[i].smp == NULL)
+ if(pars.sample[i].smp == NULL)
break;
- float dist = fabs(logfreq - logf(pars->sample[i].basefreq + 0.0001f));
+ float dist = fabs(logfreq - logf(pars.sample[i].basefreq + 0.0001f));
if(dist < mindist) {
nsample = i;
@@ -90,14 +86,14 @@ void PADnote::setup(float freq,
}
}
- int size = pars->sample[nsample].size;
+ int size = pars.sample[nsample].size;
if(size == 0)
size = 1;
if(!legato) { //not sure
poshi_l = (int)(RND * (size - 1));
- if(pars->PStereo != 0)
+ if(pars.PStereo)
poshi_r = (poshi_l + size / 2) % size;
else
poshi_r = poshi_l;
@@ -105,45 +101,45 @@ void PADnote::setup(float freq,
}
- if(pars->PPanning == 0)
+ if(pars.PPanning == 0)
NoteGlobalPar.Panning = RND;
else
- NoteGlobalPar.Panning = pars->PPanning / 128.0f;
+ NoteGlobalPar.Panning = pars.PPanning / 128.0f;
- NoteGlobalPar.FilterCenterPitch = pars->GlobalFilter->getfreq() //center freq
- + pars->PFilterVelocityScale / 127.0f
+ NoteGlobalPar.FilterCenterPitch = pars.GlobalFilter->getfreq() //center freq
+ + pars.PFilterVelocityScale / 127.0f
* 6.0f //velocity sensing
* (VelF(velocity,
- pars->
+ pars.
PFilterVelocityScaleFunction) - 1);
if(!legato) {
- if(pars->PPunchStrength != 0) {
+ if(pars.PPunchStrength != 0) {
NoteGlobalPar.Punch.Enabled = 1;
NoteGlobalPar.Punch.t = 1.0f; //start from 1.0f and to 0.0f
NoteGlobalPar.Punch.initialvalue =
- ((powf(10, 1.5f * pars->PPunchStrength / 127.0f) - 1.0f)
+ ((powf(10, 1.5f * pars.PPunchStrength / 127.0f) - 1.0f)
* VelF(velocity,
- pars->PPunchVelocitySensing));
+ pars.PPunchVelocitySensing));
float time =
- powf(10, 3.0f * pars->PPunchTime / 127.0f) / 10000.0f; //0.1f .. 100 ms
- float stretch = powf(440.0f / freq, pars->PPunchStretch / 64.0f);
+ powf(10, 3.0f * pars.PPunchTime / 127.0f) / 10000.0f; //0.1f .. 100 ms
+ float stretch = powf(440.0f / freq, pars.PPunchStretch / 64.0f);
NoteGlobalPar.Punch.dt = 1.0f
/ (time * synth->samplerate_f * stretch);
}
else
NoteGlobalPar.Punch.Enabled = 0;
- NoteGlobalPar.FreqEnvelope = memory.alloc<Envelope>(*pars->FreqEnvelope, basefreq);
- NoteGlobalPar.FreqLfo = memory.alloc<LFO>(*pars->FreqLfo, basefreq);
+ NoteGlobalPar.FreqEnvelope = memory.alloc<Envelope>(*pars.FreqEnvelope, basefreq);
+ NoteGlobalPar.FreqLfo = memory.alloc<LFO>(*pars.FreqLfo, basefreq);
- NoteGlobalPar.AmpEnvelope = memory.alloc<Envelope>(*pars->AmpEnvelope, basefreq);
- NoteGlobalPar.AmpLfo = memory.alloc<LFO>(*pars->AmpLfo, basefreq);
+ NoteGlobalPar.AmpEnvelope = memory.alloc<Envelope>(*pars.AmpEnvelope, basefreq);
+ NoteGlobalPar.AmpLfo = memory.alloc<LFO>(*pars.AmpLfo, basefreq);
}
NoteGlobalPar.Volume = 4.0f
- * powf(0.1f, 3.0f * (1.0f - pars->PVolume / 96.0f)) //-60 dB .. 0 dB
- * VelF(velocity, pars->PAmpVelocityScaleFunction); //velocity sensing
+ * powf(0.1f, 3.0f * (1.0f - pars.PVolume / 96.0f)) //-60 dB .. 0 dB
+ * VelF(velocity, pars.PAmpVelocityScaleFunction); //velocity sensing
NoteGlobalPar.AmpEnvelope->envout_dB(); //discard the first envelope output
globaloldamplitude = globalnewamplitude = NoteGlobalPar.Volume
@@ -152,17 +148,17 @@ void PADnote::setup(float freq,
* NoteGlobalPar.AmpLfo->amplfoout();
if(!legato) {
- NoteGlobalPar.GlobalFilterL = Filter::generate(memory, pars->GlobalFilter);
- NoteGlobalPar.GlobalFilterR = Filter::generate(memory, pars->GlobalFilter);
+ NoteGlobalPar.GlobalFilterL = Filter::generate(memory, pars.GlobalFilter);
+ NoteGlobalPar.GlobalFilterR = Filter::generate(memory, pars.GlobalFilter);
- NoteGlobalPar.FilterEnvelope = memory.alloc<Envelope>(*pars->FilterEnvelope, basefreq);
- NoteGlobalPar.FilterLfo = memory.alloc<LFO>(*pars->FilterLfo, basefreq);
+ NoteGlobalPar.FilterEnvelope = memory.alloc<Envelope>(*pars.FilterEnvelope, basefreq);
+ NoteGlobalPar.FilterLfo = memory.alloc<LFO>(*pars.FilterLfo, basefreq);
}
- NoteGlobalPar.FilterQ = pars->GlobalFilter->getq();
- NoteGlobalPar.FilterFreqTracking = pars->GlobalFilter->getfreqtracking(
+ NoteGlobalPar.FilterQ = pars.GlobalFilter->getq();
+ NoteGlobalPar.FilterFreqTracking = pars.GlobalFilter->getfreqtracking(
basefreq);
- if(!pars->sample[nsample].smp) {
+ if(!pars.sample[nsample].smp) {
finished_ = true;
return;
}
@@ -242,7 +238,7 @@ void PADnote::computecurrentparameters()
if(portamento) { //this voice use portamento
portamentofreqrap = ctl.portamento.freqrap;
if(ctl.portamento.used == 0) //the portamento has finished
- portamento = 0; //this note is no longer "portamented"
+ portamento = false; //this note is no longer "portamented"
}
realfreq = basefreq * portamentofreqrap
@@ -255,12 +251,12 @@ int PADnote::Compute_Linear(float *outl,
int freqhi,
float freqlo)
{
- float *smps = pars->sample[nsample].smp;
+ float *smps = pars.sample[nsample].smp;
if(smps == NULL) {
finished_ = true;
return 1;
}
- int size = pars->sample[nsample].size;
+ int size = pars.sample[nsample].size;
for(int i = 0; i < synth->buffersize; ++i) {
poshi_l += freqhi;
poshi_r += freqhi;
@@ -285,12 +281,12 @@ int PADnote::Compute_Cubic(float *outl,
int freqhi,
float freqlo)
{
- float *smps = pars->sample[nsample].smp;
+ float *smps = pars.sample[nsample].smp;
if(smps == NULL) {
finished_ = true;
return 1;
}
- int size = pars->sample[nsample].size;
+ int size = pars.sample[nsample].size;
float xm1, x0, x1, x2, a, b, c;
for(int i = 0; i < synth->buffersize; ++i) {
poshi_l += freqhi;
@@ -333,7 +329,7 @@ int PADnote::Compute_Cubic(float *outl,
int PADnote::noteout(float *outl, float *outr)
{
computecurrentparameters();
- float *smps = pars->sample[nsample].smp;
+ float *smps = pars.sample[nsample].smp;
if(smps == NULL) {
for(int i = 0; i < synth->buffersize; ++i) {
outl[i] = 0.0f;
@@ -341,7 +337,7 @@ int PADnote::noteout(float *outl, float *outr)
}
return 1;
}
- float smpfreq = pars->sample[nsample].basefreq;
+ float smpfreq = pars.sample[nsample].basefreq;
float freqrap = realfreq / smpfreq;
@@ -400,7 +396,7 @@ int PADnote::noteout(float *outl, float *outr)
// Check if the global amplitude is finished.
// If it does, disable the note
- if(NoteGlobalPar.AmpEnvelope->finished() != 0) {
+ if(NoteGlobalPar.AmpEnvelope->finished()) {
for(int i = 0; i < synth->buffersize; ++i) { //fade-out
float tmp = 1.0f - (float)i / synth->buffersize_f;
outl[i] *= tmp;
diff --git a/src/Synth/PADnote.h b/src/Synth/PADnote.h
@@ -44,13 +44,13 @@ class PADnote:public SynthNote
void fadein(float *smps);
void computecurrentparameters();
bool finished_;
- PADnoteParameters *pars;
+ const PADnoteParameters &pars;
int poshi_l, poshi_r;
float poslo;
float basefreq;
- bool firsttime, released;
+ bool firsttime;
int nsample, portamento;
@@ -104,7 +104,6 @@ class PADnote:public SynthNote
float globaloldamplitude, globalnewamplitude, velocity, realfreq;
- Controller &ctl;
};
diff --git a/src/Synth/SUBnote.cpp b/src/Synth/SUBnote.cpp
@@ -33,11 +33,9 @@
#include "../Misc/Util.h"
#include "../Misc/Allocator.h"
-SUBnote::SUBnote(SUBnoteParameters *parameters, SynthParams spars)
- :SynthNote(spars)
+SUBnote::SUBnote(SUBnoteParameters *parameters, SynthParams &spars)
+ :SynthNote(spars), pars(*parameters)
{
- pars = parameters;
- ctl = &spars.ctl;
NoteEnabled = ON;
setup(spars.frequency, spars.velocity, spars.portamento, spars.note);
}
@@ -50,29 +48,27 @@ void SUBnote::setup(float freq,
{
portamento = portamento_;
NoteEnabled = ON;
- volume = powf(0.1f, 3.0f * (1.0f - pars->PVolume / 96.0f)); //-60 dB .. 0 dB
- volume *= VelF(velocity, pars->PAmpVelocityScaleFunction);
- if(pars->PPanning != 0)
- panning = pars->PPanning / 127.0f;
+ volume = powf(0.1f, 3.0f * (1.0f - pars.PVolume / 96.0f)); //-60 dB .. 0 dB
+ volume *= VelF(velocity, pars.PAmpVelocityScaleFunction);
+ if(pars.PPanning != 0)
+ panning = pars.PPanning / 127.0f;
else
panning = RND;
if(!legato) {
- numstages = pars->Pnumstages;
- stereo = pars->Pstereo;
- start = pars->Pstart;
+ numstages = pars.Pnumstages;
+ stereo = pars.Pstereo;
+ start = pars.Pstart;
firsttick = 1;
}
int pos[MAX_SUB_HARMONICS];
- if(pars->Pfixedfreq == 0)
+ if(pars.Pfixedfreq == 0)
basefreq = freq;
else {
basefreq = 440.0f;
- int fixedfreqET = pars->PfixedfreqET;
+ int fixedfreqET = pars.PfixedfreqET;
if(fixedfreqET) { //if the frequency varies according the keyboard note
- float tmp =
- (midinote
- - 69.0f) / 12.0f
+ float tmp = (midinote - 69.0f) / 12.0f
* (powf(2.0f, (fixedfreqET - 1) / 63.0f) - 1.0f);
if(fixedfreqET <= 64)
basefreq *= powf(2.0f, tmp);
@@ -80,18 +76,18 @@ void SUBnote::setup(float freq,
basefreq *= powf(3.0f, tmp);
}
}
- float detune = getdetune(pars->PDetuneType,
- pars->PCoarseDetune,
- pars->PDetune);
+ float detune = getdetune(pars.PDetuneType,
+ pars.PCoarseDetune,
+ pars.PDetune);
basefreq *= powf(2.0f, detune / 1200.0f); //detune
-// basefreq*=ctl->pitchwheel.relfreq;//pitch wheel
+// basefreq*=ctl.pitchwheel.relfreq;//pitch wheel
//global filter
- GlobalFilterCenterPitch = pars->GlobalFilter->getfreq() //center freq
- + (pars->PGlobalFilterVelocityScale / 127.0f
+ GlobalFilterCenterPitch = pars.GlobalFilter->getfreq() //center freq
+ + (pars.PGlobalFilterVelocityScale / 127.0f
* 6.0f) //velocity sensing
* (VelF(velocity,
- pars->PGlobalFilterVelocityScaleFunction)
+ pars.PGlobalFilterVelocityScaleFunction)
- 1);
if(!legato) {
@@ -104,7 +100,7 @@ void SUBnote::setup(float freq,
//select only harmonics that desire to compute
for(int n = 0; n < MAX_SUB_HARMONICS; ++n) {
- if(pars->Phmag[n] == 0)
+ if(pars.Phmag[n] == 0)
continue;
pos[harmonics++] = n;
}
@@ -134,19 +130,19 @@ void SUBnote::setup(float freq,
float reduceamp = 0.0f;
for(int n = 0; n < numharmonics; ++n) {
- float freq = basefreq * pars->POvertoneFreqMult[pos[n]];
+ float freq = basefreq * pars.POvertoneFreqMult[pos[n]];
overtone_freq[n] = freq;
overtone_rolloff[n] = computerolloff(freq);
//the bandwidth is not absolute(Hz); it is relative to frequency
float bw =
- powf(10, (pars->Pbandwidth - 127.0f) / 127.0f * 4) * numstages;
+ powf(10, (pars.Pbandwidth - 127.0f) / 127.0f * 4) * numstages;
//Bandwidth Scale
- bw *= powf(1000 / freq, (pars->Pbwscale - 64.0f) / 64.0f * 3.0f);
+ bw *= powf(1000 / freq, (pars.Pbwscale - 64.0f) / 64.0f * 3.0f);
//Relative BandWidth
- bw *= powf(100, (pars->Phrelbw[pos[n]] - 64.0f) / 64.0f);
+ bw *= powf(100, (pars.Phrelbw[pos[n]] - 64.0f) / 64.0f);
if(bw > 25.0f)
bw = 25.0f;
@@ -154,10 +150,10 @@ void SUBnote::setup(float freq,
//try to keep same amplitude on all freqs and bw. (empirically)
float gain = sqrt(1500.0f / (bw * freq));
- float hmagnew = 1.0f - pars->Phmag[pos[n]] / 127.0f;
+ float hmagnew = 1.0f - pars.Phmag[pos[n]] / 127.0f;
float hgain;
- switch(pars->Phmagtype) {
+ switch(pars.Phmagtype) {
case 1:
hgain = expf(hmagnew * logf(0.01f));
break;
@@ -181,7 +177,7 @@ void SUBnote::setup(float freq,
if(nph == 0)
amp = gain;
initfilter(lfilter[nph + n * numstages], freq, bw, amp, hgain);
- if(stereo != 0)
+ if(stereo)
initfilter(rfilter[nph + n * numstages], freq, bw, amp, hgain);
}
}
@@ -193,20 +189,20 @@ void SUBnote::setup(float freq,
oldpitchwheel = 0;
oldbandwidth = 64;
if(!legato) {
- if(pars->Pfixedfreq == 0)
+ if(pars.Pfixedfreq == 0)
initparameters(basefreq);
else
initparameters(basefreq / 440.0f * freq);
}
else {
- if(pars->Pfixedfreq == 0)
+ if(pars.Pfixedfreq == 0)
freq = basefreq;
else
freq *= basefreq / 440.0f;
- if(pars->PGlobalFilterEnabled) {
- globalfiltercenterq = pars->GlobalFilter->getq();
- GlobalFilterFreqTracking = pars->GlobalFilter->getfreqtracking(
+ if(pars.PGlobalFilterEnabled) {
+ globalfiltercenterq = pars.GlobalFilter->getq();
+ GlobalFilterFreqTracking = pars.GlobalFilter->getfreqtracking(
basefreq);
}
}
@@ -364,22 +360,22 @@ void SUBnote::filter(bpfilter &filter, float *smps)
*/
void SUBnote::initparameters(float freq)
{
- AmpEnvelope = memory.alloc<Envelope>(*pars->AmpEnvelope, freq);
- if(pars->PFreqEnvelopeEnabled)
- FreqEnvelope = memory.alloc<Envelope>(*pars->FreqEnvelope, freq);
+ AmpEnvelope = memory.alloc<Envelope>(*pars.AmpEnvelope, freq);
+ if(pars.PFreqEnvelopeEnabled)
+ FreqEnvelope = memory.alloc<Envelope>(*pars.FreqEnvelope, freq);
else
FreqEnvelope = NULL;
- if(pars->PBandWidthEnvelopeEnabled)
- BandWidthEnvelope = memory.alloc<Envelope>(*pars->BandWidthEnvelope, freq);
+ if(pars.PBandWidthEnvelopeEnabled)
+ BandWidthEnvelope = memory.alloc<Envelope>(*pars.BandWidthEnvelope, freq);
else
BandWidthEnvelope = NULL;
- if(pars->PGlobalFilterEnabled) {
- globalfiltercenterq = pars->GlobalFilter->getq();
- GlobalFilterL = Filter::generate(memory, pars->GlobalFilter);
+ if(pars.PGlobalFilterEnabled) {
+ globalfiltercenterq = pars.GlobalFilter->getq();
+ GlobalFilterL = Filter::generate(memory, pars.GlobalFilter);
if(stereo)
- GlobalFilterR = Filter::generate(memory, pars->GlobalFilter);
- GlobalFilterEnvelope = memory.alloc<Envelope>(*pars->GlobalFilterEnvelope, freq);
- GlobalFilterFreqTracking = pars->GlobalFilter->getfreqtracking(basefreq);
+ GlobalFilterR = Filter::generate(memory, pars.GlobalFilter);
+ GlobalFilterEnvelope = memory.alloc<Envelope>(*pars.GlobalFilterEnvelope, freq);
+ GlobalFilterFreqTracking = pars.GlobalFilter->getfreqtracking(basefreq);
}
computecurrentparameters();
}
@@ -409,31 +405,30 @@ float SUBnote::computerolloff(float freq)
*/
void SUBnote::computecurrentparameters()
{
- if((FreqEnvelope != NULL) || (BandWidthEnvelope != NULL)
- || (oldpitchwheel != ctl->pitchwheel.data)
- || (oldbandwidth != ctl->bandwidth.data)
- || (portamento != 0)) {
+ if(FreqEnvelope || BandWidthEnvelope
+ || (oldpitchwheel != ctl.pitchwheel.data)
+ || (oldbandwidth != ctl.bandwidth.data)
+ || portamento) {
float envfreq = 1.0f;
float envbw = 1.0f;
float gain = 1.0f;
- if(FreqEnvelope != NULL) {
+ if(FreqEnvelope) {
envfreq = FreqEnvelope->envout() / 1200;
envfreq = powf(2.0f, envfreq);
}
- envfreq *= ctl->pitchwheel.relfreq; //pitch wheel
- if(portamento != 0) { //portamento is used
- envfreq *= ctl->portamento.freqrap;
- if(ctl->portamento.used == 0) //the portamento has finished
- portamento = 0; //this note is no longer "portamented"
- ;
+ envfreq *= ctl.pitchwheel.relfreq; //pitch wheel
+ if(portamento) { //portamento is used
+ envfreq *= ctl.portamento.freqrap;
+ if(!ctl.portamento.used) //the portamento has finished
+ portamento = false; //this note is no longer "portamented"
}
- if(BandWidthEnvelope != NULL) {
+ if(BandWidthEnvelope) {
envbw = BandWidthEnvelope->envout();
envbw = powf(2, envbw);
}
- envbw *= ctl->bandwidth.relbw; //bandwidth controller
+ envbw *= ctl.bandwidth.relbw; //bandwidth controller
float tmpgain = 1.0f / sqrt(envbw * envfreq);
@@ -451,7 +446,7 @@ void SUBnote::computecurrentparameters()
lfilter[nph + n * numstages].bw * envbw,
gain);
}
- if(stereo != 0)
+ if(stereo)
for(int n = 0; n < numharmonics; ++n)
for(int nph = 0; nph < numstages; ++nph) {
if(nph == 0)
@@ -460,15 +455,14 @@ void SUBnote::computecurrentparameters()
gain = 1.0f;
computefiltercoefs(
rfilter[nph + n * numstages],
- rfilter[nph + n
- * numstages].freq * envfreq,
+ rfilter[nph + n * numstages].freq * envfreq,
rfilter[nph + n * numstages].bw * envbw,
gain);
}
- oldbandwidth = ctl->bandwidth.data;
- oldpitchwheel = ctl->pitchwheel.data;
+ oldbandwidth = ctl.bandwidth.data;
+ oldpitchwheel = ctl.pitchwheel.data;
}
newamplitude = volume * AmpEnvelope->envout_dB() * 2.0f;
@@ -476,17 +470,17 @@ void SUBnote::computecurrentparameters()
if(GlobalFilterL != NULL) {
float globalfilterpitch = GlobalFilterCenterPitch
+ GlobalFilterEnvelope->envout();
- float filterfreq = globalfilterpitch + ctl->filtercutoff.relfreq
+ float filterfreq = globalfilterpitch + ctl.filtercutoff.relfreq
+ GlobalFilterFreqTracking;
filterfreq = Filter::getrealfreq(filterfreq);
GlobalFilterL->setfreq_and_q(filterfreq,
- globalfiltercenterq * ctl->filterq.relq);
+ globalfiltercenterq * ctl.filterq.relq);
if(GlobalFilterR != NULL)
GlobalFilterR->setfreq_and_q(
filterfreq,
globalfiltercenterq
- * ctl->filterq.relq);
+ * ctl.filterq.relq);
}
}
@@ -519,7 +513,7 @@ int SUBnote::noteout(float *outl, float *outr)
GlobalFilterL->filterout(&outl[0]);
//right channel
- if(stereo != 0) {
+ if(stereo) {
for(int i = 0; i < synth->buffersize; ++i)
tmprnd[i] = RND * 2.0f - 1.0f;
for(int n = 0; n < numharmonics; ++n) {
diff --git a/src/Synth/SUBnote.h b/src/Synth/SUBnote.h
@@ -30,7 +30,7 @@
class SUBnote:public SynthNote
{
public:
- SUBnote(SUBnoteParameters *parameters, SynthParams pars);
+ SUBnote(SUBnoteParameters *parameters, SynthParams &pars);
~SUBnote();
void legatonote(LegatoParams pars);
@@ -49,7 +49,7 @@ class SUBnote:public SynthNote
void initparameters(float freq);
void KillNote();
- SUBnoteParameters *pars;
+ const SUBnoteParameters &pars;
//parameters
bool stereo;
@@ -98,7 +98,6 @@ class SUBnote:public SynthNote
float overtone_rolloff[MAX_SUB_HARMONICS];
float overtone_freq[MAX_SUB_HARMONICS];
- Controller *ctl;
int oldpitchwheel, oldbandwidth;
float globalfiltercenterq;
};
diff --git a/src/Synth/SynthNote.cpp b/src/Synth/SynthNote.cpp
@@ -5,7 +5,7 @@
SynthNote::SynthNote(SynthParams &pars)
:legato(pars.frequency, pars.velocity, pars.portamento,
pars.note, pars.quiet),
- memory(pars.memory)
+ memory(pars.memory), ctl(pars.ctl)
{}
SynthNote::Legato::Legato(float freq, float vel, int port,
diff --git a/src/Synth/SynthNote.h b/src/Synth/SynthNote.h
@@ -67,6 +67,7 @@ class SynthNote
/* For polyphonic aftertouch needed */
void setVelocity(float velocity_);
protected:
+ const Controller &ctl;
// Legato transitions
class Legato
{