commit f3b25056efb53f2d4c56a27c4cec0ed98614ce6a
parent e2b1eb9b1077e6516c0cc4e2283e5c886bed0e58
Author: fundamental <mark.d.mccurry@gmail.com>
Date: Tue, 22 Dec 2009 21:09:40 -0500
Effect: General code cleanup
Diffstat:
18 files changed, 197 insertions(+), 216 deletions(-)
diff --git a/src/Effects/Alienwah.cpp b/src/Effects/Alienwah.cpp
@@ -46,7 +46,7 @@ Alienwah::~Alienwah()
/*
* Apply the effect
*/
-void Alienwah::out(REALTYPE *smpsl, REALTYPE *smpsr)
+void Alienwah::out(const Stereo<Sample> &smp)
{
REALTYPE lfol, lfor; //Left/Right LFOs
complex<REALTYPE> clfol, clfor, out, tmp;
@@ -67,7 +67,7 @@ void Alienwah::out(REALTYPE *smpsl, REALTYPE *smpsr)
tmp = clfol * x + oldclfol * x1;
out = tmp * oldl[oldk];
- out.real() += (1 - fabs(fb)) * smpsr[i] * (1.0 - panning);
+ out.real() += (1 - fabs(fb)) * smp.l()[i] * (1.0 - panning);
oldl[oldk] = out;
REALTYPE l = out.real() * 10.0 * (fb + 0.1);
@@ -76,7 +76,7 @@ void Alienwah::out(REALTYPE *smpsl, REALTYPE *smpsr)
tmp = clfor * x + oldclfor * x1;
out = tmp * oldr[oldk];
- out.real() += (1 - fabs(fb)) * smpsr[i] * (1.0 - panning);
+ out.real() += (1 - fabs(fb)) * smp.r()[i] * (1.0 - panning);
oldr[oldk] = out;
REALTYPE r = out.real() * 10.0 * (fb + 0.1);
@@ -110,13 +110,13 @@ void Alienwah::cleanup()
* Parameter control
*/
-void Alienwah::setdepth(const unsigned char &Pdepth)
+void Alienwah::setdepth(unsigned char Pdepth)
{
this->Pdepth = Pdepth;
depth = (Pdepth / 127.0);
}
-void Alienwah::setfb(const unsigned char &Pfb)
+void Alienwah::setfb(unsigned char Pfb)
{
this->Pfb = Pfb;
fb = fabs((Pfb - 64.0) / 64.1);
@@ -127,7 +127,7 @@ void Alienwah::setfb(const unsigned char &Pfb)
fb = -fb;
}
-void Alienwah::setvolume(const unsigned char &Pvolume)
+void Alienwah::setvolume(unsigned char Pvolume)
{
this->Pvolume = Pvolume;
outvolume = Pvolume / 127.0;
@@ -137,25 +137,25 @@ void Alienwah::setvolume(const unsigned char &Pvolume)
volume = outvolume;
}
-void Alienwah::setpanning(const unsigned char &Ppanning)
+void Alienwah::setpanning(unsigned char Ppanning)
{
this->Ppanning = Ppanning;
panning = Ppanning / 127.0;
}
-void Alienwah::setlrcross(const unsigned char &Plrcross)
+void Alienwah::setlrcross(unsigned char Plrcross)
{
this->Plrcross = Plrcross;
lrcross = Plrcross / 127.0;
}
-void Alienwah::setphase(const unsigned char &Pphase)
+void Alienwah::setphase(unsigned char Pphase)
{
this->Pphase = Pphase;
phase = (Pphase - 64.0) / 64.0 * PI;
}
-void Alienwah::setdelay(const unsigned char &Pdelay)
+void Alienwah::setdelay(unsigned char Pdelay)
{
if(oldl != NULL)
delete [] oldl;
@@ -190,12 +190,12 @@ void Alienwah::setpreset(unsigned char npreset)
for(int n = 0; n < PRESET_SIZE; n++)
changepar(n, presets[npreset][n]);
if(insertion == 0)
- changepar(0, presets[npreset][0] / 2); //lower the volume if this is system effect
+ changepar(0, presets[npreset][0] / 2); //lower the volume if this is system effect
Ppreset = npreset;
}
-void Alienwah::changepar(const int &npar, const unsigned char &value)
+void Alienwah::changepar(int npar, unsigned char value)
{
switch(npar) {
case 0:
@@ -238,7 +238,7 @@ void Alienwah::changepar(const int &npar, const unsigned char &value)
}
}
-unsigned char Alienwah::getpar(const int &npar) const
+unsigned char Alienwah::getpar(int npar) const
{
switch(npar) {
case 0:
diff --git a/src/Effects/Alienwah.h b/src/Effects/Alienwah.h
@@ -46,11 +46,11 @@ class Alienwah:public Effect
REALTYPE *const efxoutl_,
REALTYPE *const efxoutr_);
~Alienwah();
- void out(REALTYPE *const smpsl, REALTYPE *const smpsr);
+ void out(const Stereo<Sample> &smp);
void setpreset(unsigned char npreset);
- void changepar(const int &npar, const unsigned char &value);
- unsigned char getpar(const int &npar) const;
+ void changepar(int npar, unsigned char value);
+ unsigned char getpar(int npar) const;
void cleanup();
private:
@@ -66,13 +66,13 @@ class Alienwah:public Effect
//Control Parameters
- void setvolume(const unsigned char &Pvolume);
- void setpanning(const unsigned char &Ppanning);
- void setdepth(const unsigned char &Pdepth);
- void setfb(const unsigned char &Pfb);
- void setlrcross(const unsigned char &Plrcross);
- void setdelay(const unsigned char &Pdelay);
- void setphase(const unsigned char &Pphase);
+ void setvolume(unsigned char Pvolume);
+ void setpanning(unsigned char Ppanning);
+ void setdepth(unsigned char Pdepth);
+ void setfb(unsigned char Pfb);
+ void setlrcross(unsigned char Plrcross);
+ void setdelay(unsigned char Pdelay);
+ void setphase(unsigned char Pphase);
//Internal Values
REALTYPE panning, fb, depth, lrcross, phase;
diff --git a/src/Effects/Chorus.cpp b/src/Effects/Chorus.cpp
@@ -35,9 +35,6 @@ Chorus::Chorus(const int &insertion_,
{
dlk = 0;
drk = 0;
- //maxdelay=(int)(MAX_CHORUS_DELAY/1000.0*SAMPLE_RATE);
- //delayl=new REALTYPE[maxdelay];
- //delayr=new REALTYPE[maxdelay];
setpreset(Ppreset);
@@ -71,18 +68,7 @@ REALTYPE Chorus::getdelay(REALTYPE xlfo)
return result;
}
-/*
- * Apply the effect
- */
-void Chorus::out(REALTYPE *smpsl, REALTYPE *smpsr)
-{
- const Stereo<AuSample> input(AuSample(SOUND_BUFFER_SIZE, smpsl), AuSample(
- SOUND_BUFFER_SIZE,
- smpsr));
- out(input);
-}
-
-void Chorus::out(const Stereo<AuSample> &input)
+void Chorus::out(const Stereo<Sample> &input)
{
const REALTYPE one = 1.0;
dl1 = dl2;
@@ -162,24 +148,24 @@ void Chorus::cleanup()
/*
* Parameter control
*/
-void Chorus::setdepth(const unsigned char &Pdepth)
+void Chorus::setdepth(unsigned char Pdepth)
{
this->Pdepth = Pdepth;
depth = (pow(8.0, (Pdepth / 127.0) * 2.0) - 1.0) / 1000.0; //seconds
}
-void Chorus::setdelay(const unsigned char &Pdelay)
+void Chorus::setdelay(unsigned char Pdelay)
{
this->Pdelay = Pdelay;
delay = (pow(10.0, (Pdelay / 127.0) * 2.0) - 1.0) / 1000.0; //seconds
}
-void Chorus::setfb(const unsigned char &Pfb)
+void Chorus::setfb(unsigned char Pfb)
{
this->Pfb = Pfb;
fb = (Pfb - 64.0) / 64.1;
}
-void Chorus::setvolume(const unsigned char &Pvolume)
+void Chorus::setvolume(unsigned char Pvolume)
{
this->Pvolume = Pvolume;
outvolume = Pvolume / 127.0;
@@ -189,13 +175,13 @@ void Chorus::setvolume(const unsigned char &Pvolume)
volume = outvolume;
}
-void Chorus::setpanning(const unsigned char &Ppanning)
+void Chorus::setpanning(unsigned char Ppanning)
{
this->Ppanning = Ppanning;
panning = Ppanning / 127.0;
}
-void Chorus::setlrcross(const unsigned char &Plrcross)
+void Chorus::setlrcross(unsigned char Plrcross)
{
this->Plrcross = Plrcross;
lrcross = Plrcross / 127.0;
@@ -236,7 +222,7 @@ void Chorus::setpreset(unsigned char npreset)
}
-void Chorus::changepar(const int &npar, const unsigned char &value)
+void Chorus::changepar(int npar, unsigned char value)
{
switch(npar) {
case 0:
@@ -288,7 +274,7 @@ void Chorus::changepar(const int &npar, const unsigned char &value)
}
}
-unsigned char Chorus::getpar(const int &npar) const
+unsigned char Chorus::getpar(int npar) const
{
switch(npar) {
case 0:
diff --git a/src/Effects/Chorus.h b/src/Effects/Chorus.h
@@ -25,7 +25,7 @@
#include "../globals.h"
#include "Effect.h"
#include "EffectLFO.h"
-#include "../Samples/AuSample.h"
+#include "../Samples/Sample.h"
#include "../Misc/Stereo.h"
#define MAX_CHORUS_DELAY 250.0 //ms
@@ -37,8 +37,7 @@ class Chorus:public Effect
Chorus(const int &insetion_, REALTYPE *efxoutl_, REALTYPE *efxoutr_);
/**Destructor*/
~Chorus();
- void out(REALTYPE *smpsl, REALTYPE *smpsr);
- void out(const Stereo<AuSample> &input);
+ void out(const Stereo<Sample> &input);
void setpreset(unsigned char npreset);
/**
* Sets the value of the chosen variable
@@ -58,7 +57,7 @@ class Chorus:public Effect
* @param npar number of chosen parameter
* @param value the new value
*/
- void changepar(const int &npar, const unsigned char &value);
+ void changepar(int npar, unsigned char value);
/**
* Gets the value of the chosen variable
*
@@ -77,7 +76,7 @@ class Chorus:public Effect
* @param npar number of chosen parameter
* @return the value of the parameter
*/
- unsigned char getpar(const int &npar) const;
+ unsigned char getpar(int npar) const;
void cleanup();
private:
@@ -94,19 +93,18 @@ class Chorus:public Effect
//Parameter Controls
- void setvolume(const unsigned char &Pvolume);
- void setpanning(const unsigned char &Ppanning);
- void setdepth(const unsigned char &Pdepth);
- void setdelay(const unsigned char &Pdelay);
- void setfb(const unsigned char &Pfb);
- void setlrcross(const unsigned char &Plrcross);
+ void setvolume(unsigned char Pvolume);
+ void setpanning(unsigned char Ppanning);
+ void setdepth(unsigned char Pdepth);
+ void setdelay(unsigned char Pdelay);
+ void setfb(unsigned char Pfb);
+ void setlrcross(unsigned char Plrcross);
//Internal Values
REALTYPE depth, delay, fb, lrcross, panning;
REALTYPE dl1, dl2, dr1, dr2, lfol, lfor;
int maxdelay;
- Stereo<AuSample> delaySample;
- //REALTYPE *delayl,*delayr;
+ Stereo<Sample> delaySample;
int dlk, drk, dlhi, dlhi2;
REALTYPE getdelay(REALTYPE xlfo);
REALTYPE dllo, mdel;
diff --git a/src/Effects/Distorsion.cpp b/src/Effects/Distorsion.cpp
@@ -260,7 +260,7 @@ void Distorsion::applyfilters(REALTYPE *efxoutl, REALTYPE *efxoutr)
/*
* Effect output
*/
-void Distorsion::out(REALTYPE *smpsl, REALTYPE *smpsr)
+void Distorsion::out(const Stereo<Sample> &smp)
{
int i;
REALTYPE l, r, lout, rout;
@@ -270,15 +270,15 @@ void Distorsion::out(REALTYPE *smpsl, REALTYPE *smpsr)
inputvol *= -1.0;
if(Pstereo != 0) { //Stereo
- for(i = 0; i < SOUND_BUFFER_SIZE; i++) {
- efxoutl[i] = smpsl[i] * inputvol * panning;
- efxoutr[i] = smpsr[i] * inputvol * (1.0 - panning);
+ for(i = 0; i < smp.l().size(); i++) {
+ efxoutl[i] = smp.l()[i] * inputvol * panning;
+ efxoutr[i] = smp.r()[i] * inputvol * (1.0 - panning);
}
}
else {
for(i = 0; i < SOUND_BUFFER_SIZE; i++)
efxoutl[i] =
- (smpsl[i] * panning + smpsr[i] * (1.0 - panning)) * inputvol;
+ (smp.l()[i] * panning + smp.r()[i] * (1.0 - panning)) * inputvol;
;
}
@@ -315,7 +315,7 @@ void Distorsion::out(REALTYPE *smpsl, REALTYPE *smpsr)
/*
* Parameter control
*/
-void Distorsion::setvolume(const unsigned char &Pvolume)
+void Distorsion::setvolume(unsigned char Pvolume)
{
this->Pvolume = Pvolume;
@@ -330,20 +330,20 @@ void Distorsion::setvolume(const unsigned char &Pvolume)
cleanup();
}
-void Distorsion::setpanning(const unsigned char &Ppanning)
+void Distorsion::setpanning(unsigned char Ppanning)
{
this->Ppanning = Ppanning;
panning = (Ppanning + 0.5) / 127.0;
}
-void Distorsion::setlrcross(const unsigned char &Plrcross)
+void Distorsion::setlrcross(unsigned char Plrcross)
{
this->Plrcross = Plrcross;
lrcross = Plrcross / 127.0 * 1.0;
}
-void Distorsion::setlpf(const unsigned char &Plpf)
+void Distorsion::setlpf(unsigned char Plpf)
{
this->Plpf = Plpf;
REALTYPE fr = exp(pow(Plpf / 127.0, 0.5) * log(25000.0)) + 40;
@@ -351,7 +351,7 @@ void Distorsion::setlpf(const unsigned char &Plpf)
lpfr->setfreq(fr);
}
-void Distorsion::sethpf(const unsigned char &Phpf)
+void Distorsion::sethpf(unsigned char Phpf)
{
this->Phpf = Phpf;
REALTYPE fr = exp(pow(Phpf / 127.0, 0.5) * log(25000.0)) + 20.0;
@@ -391,7 +391,7 @@ void Distorsion::setpreset(unsigned char npreset)
}
-void Distorsion::changepar(const int &npar, const unsigned char &value)
+void Distorsion::changepar(int npar, unsigned char value)
{
switch(npar) {
case 0:
@@ -439,7 +439,7 @@ void Distorsion::changepar(const int &npar, const unsigned char &value)
}
}
-unsigned char Distorsion::getpar(const int &npar) const
+unsigned char Distorsion::getpar(int npar) const
{
switch(npar) {
case 0:
diff --git a/src/Effects/Distorsion.h b/src/Effects/Distorsion.h
@@ -38,32 +38,32 @@ class Distorsion:public Effect
public:
Distorsion(const int &insertion, REALTYPE *efxoutl_, REALTYPE *efxoutr_);
~Distorsion();
- void out(REALTYPE *smpsl, REALTYPE *smpr);
+ void out(const Stereo<Sample> &smp);
void setpreset(unsigned char npreset);
- void changepar(const int &npar, const unsigned char &value);
- unsigned char getpar(const int &npar) const;
+ void changepar(int npar, unsigned char value);
+ unsigned char getpar(int npar) const;
void cleanup();
void applyfilters(REALTYPE *efxoutl, REALTYPE *efxoutr);
private:
//Parametrii
- unsigned char Pvolume; //Volumul or E/R
- unsigned char Ppanning; //Panning
- unsigned char Plrcross; // L/R Mixing
- unsigned char Pdrive; //the input amplification
- unsigned char Plevel; //the output amplification
- unsigned char Ptype; //Distorsion type
- unsigned char Pnegate; //if the input is negated
- unsigned char Plpf; //lowpass filter
- unsigned char Phpf; //highpass filter
- unsigned char Pstereo; //0=mono,1=stereo
+ unsigned char Pvolume; //Volume or E/R
+ unsigned char Ppanning; //Panning
+ unsigned char Plrcross; // L/R Mixing
+ unsigned char Pdrive; //the input amplification
+ unsigned char Plevel; //the output amplification
+ unsigned char Ptype; //Distorsion type
+ unsigned char Pnegate; //if the input is negated
+ unsigned char Plpf; //lowpass filter
+ unsigned char Phpf; //highpass filter
+ unsigned char Pstereo; //0=mono,1=stereo
unsigned char Pprefiltering; //if you want to do the filtering before the distorsion
- void setvolume(const unsigned char &Pvolume);
- void setpanning(const unsigned char &Ppanning);
- void setlrcross(const unsigned char &Plrcross);
- void setlpf(const unsigned char &Plpf);
- void sethpf(const unsigned char &Phpf);
+ void setvolume(unsigned char Pvolume);
+ void setpanning(unsigned char Ppanning);
+ void setlrcross(unsigned char Plrcross);
+ void setlpf(unsigned char Plpf);
+ void sethpf(unsigned char Phpf);
//Real Parameters
REALTYPE panning, lrcross;
diff --git a/src/Effects/DynamicFilter.cpp b/src/Effects/DynamicFilter.cpp
@@ -46,7 +46,7 @@ DynamicFilter::~DynamicFilter()
/*
* Apply the effect
*/
-void DynamicFilter::out(REALTYPE *smpsl, REALTYPE *smpsr)
+void DynamicFilter::out(const Stereo<Sample> &smp)
{
int i;
if(filterpars->changed) {
@@ -62,10 +62,10 @@ void DynamicFilter::out(REALTYPE *smpsl, REALTYPE *smpsr)
REALTYPE q = filterpars->getq();
for(i = 0; i < SOUND_BUFFER_SIZE; i++) {
- efxoutl[i] = smpsl[i];
- efxoutr[i] = smpsr[i];
+ efxoutl[i] = smp.l()[i];
+ efxoutr[i] = smp.r()[i];
- REALTYPE x = (fabs(smpsl[i]) + fabs(smpsr[i])) * 0.5;
+ REALTYPE x = (fabs(smp.l()[i]) + fabs(smp.l()[i])) * 0.5;
ms1 = ms1 * (1.0 - ampsmooth) + x * ampsmooth + 1e-10;
}
@@ -110,14 +110,14 @@ void DynamicFilter::cleanup()
* Parameter control
*/
-void DynamicFilter::setdepth(const unsigned char &Pdepth)
+void DynamicFilter::setdepth(unsigned char Pdepth)
{
this->Pdepth = Pdepth;
depth = pow((Pdepth / 127.0), 2.0);
}
-void DynamicFilter::setvolume(const unsigned char &Pvolume)
+void DynamicFilter::setvolume(unsigned char Pvolume)
{
this->Pvolume = Pvolume;
outvolume = Pvolume / 127.0;
@@ -127,14 +127,14 @@ void DynamicFilter::setvolume(const unsigned char &Pvolume)
volume = outvolume;
}
-void DynamicFilter::setpanning(const unsigned char &Ppanning)
+void DynamicFilter::setpanning(unsigned char Ppanning)
{
this->Ppanning = Ppanning;
panning = Ppanning / 127.0;
}
-void DynamicFilter::setampsns(const unsigned char &Pampsns)
+void DynamicFilter::setampsns(unsigned char Pampsns)
{
ampsns = pow(Pampsns / 127.0, 2.5) * 10.0;
if(Pampsnsinv != 0)
@@ -270,7 +270,7 @@ void DynamicFilter::setpreset(unsigned char npreset)
}
-void DynamicFilter::changepar(const int &npar, const unsigned char &value)
+void DynamicFilter::changepar(int npar, unsigned char value)
{
switch(npar) {
case 0:
@@ -312,7 +312,7 @@ void DynamicFilter::changepar(const int &npar, const unsigned char &value)
}
}
-unsigned char DynamicFilter::getpar(const int &npar) const
+unsigned char DynamicFilter::getpar(int npar) const
{
switch(npar) {
case 0:
diff --git a/src/Effects/DynamicFilter.h b/src/Effects/DynamicFilter.h
@@ -33,11 +33,11 @@ class DynamicFilter:public Effect
public:
DynamicFilter(int insetion_, REALTYPE *efxoutl_, REALTYPE *efxoutr_);
~DynamicFilter();
- void out(REALTYPE *smpsl, REALTYPE *smpsr);
+ void out(const Stereo<Sample> &smp);
void setpreset(unsigned char npreset);
- void changepar(const int &npar, const unsigned char &value);
- unsigned char getpar(const int &npar) const;
+ void changepar(int npar, unsigned char value);
+ unsigned char getpar(int npar) const;
void cleanup();
// void setdryonly();
@@ -53,10 +53,10 @@ class DynamicFilter:public Effect
unsigned char Pampsmooth; //how smooth the input amplitude changes the filter
//Parameter Control
- void setvolume(const unsigned char &Pvolume);
- void setpanning(const unsigned char &Ppanning);
- void setdepth(const unsigned char &Pdepth);
- void setampsns(const unsigned char &Pampsns);
+ void setvolume(unsigned char Pvolume);
+ void setpanning(unsigned char Ppanning);
+ void setdepth(unsigned char Pdepth);
+ void setampsns(unsigned char Pampsns);
void reinitfilter();
diff --git a/src/Effects/EQ.cpp b/src/Effects/EQ.cpp
@@ -45,9 +45,6 @@ EQ::EQ(const int &insertion_, REALTYPE *efxoutl_, REALTYPE *efxoutr_)
EQ::~EQ()
{}
-/*
- * Cleanup the effect
- */
void EQ::cleanup()
{
for(int i = 0; i < MAX_EQ_BANDS; i++) {
@@ -56,17 +53,12 @@ void EQ::cleanup()
}
}
-
-
-/*
- * Effect output
- */
-void EQ::out(REALTYPE *smpsl, REALTYPE *smpsr)
+void EQ::out(const Stereo<Sample> &smp)
{
int i;
for(i = 0; i < SOUND_BUFFER_SIZE; i++) {
- efxoutl[i] = smpsl[i] * volume;
- efxoutr[i] = smpsr[i] * volume;
+ efxoutl[i] = smp.l()[i] * volume;
+ efxoutr[i] = smp.r()[i] * volume;
}
for(i = 0; i < MAX_EQ_BANDS; i++) {
@@ -81,7 +73,7 @@ void EQ::out(REALTYPE *smpsl, REALTYPE *smpsr)
/*
* Parameter control
*/
-void EQ::setvolume(const unsigned char &Pvolume)
+void EQ::setvolume(unsigned char Pvolume)
{
this->Pvolume = Pvolume;
@@ -113,7 +105,7 @@ void EQ::setpreset(unsigned char npreset)
}
-void EQ::changepar(const int &npar, const unsigned char &value)
+void EQ::changepar(int npar, unsigned char value)
{
switch(npar) {
case 0:
@@ -167,7 +159,7 @@ void EQ::changepar(const int &npar, const unsigned char &value)
}
}
-unsigned char EQ::getpar(const int &npar) const
+unsigned char EQ::getpar(int npar) const
{
switch(npar) {
case 0:
diff --git a/src/Effects/EQ.h b/src/Effects/EQ.h
@@ -33,17 +33,17 @@ class EQ:public Effect
public:
EQ(const int &insertion_, REALTYPE *efxoutl_, REALTYPE *efxoutr_);
~EQ();
- void out(REALTYPE *smpsl, REALTYPE *smpr);
+ void out(const Stereo<Sample> &smp);
void setpreset(unsigned char npreset);
- void changepar(const int &npar, const unsigned char &value);
- unsigned char getpar(const int &npar) const;
+ void changepar(int npar, unsigned char value);
+ unsigned char getpar(int npar) const;
void cleanup();
REALTYPE getfreqresponse(REALTYPE freq);
private:
//Parameters
unsigned char Pvolume; /**<Volume*/
- void setvolume(const unsigned char &Pvolume);
+ void setvolume(unsigned char Pvolume);
struct {
//parameters
diff --git a/src/Effects/Echo.cpp b/src/Effects/Echo.cpp
@@ -63,8 +63,8 @@ void Echo::initdelays()
if(dr < 1)
dr = 1;
- delaySample.l() = AuSample(dl);
- delaySample.r() = AuSample(dr);
+ delaySample.l() = Sample(dl);
+ delaySample.r() = Sample(dr);
old = Stereo<REALTYPE>(0.0);
}
@@ -74,15 +74,14 @@ void Echo::initdelays()
*/
void Echo::out(REALTYPE *const smpsl, REALTYPE *const smpsr)
{
- Stereo<AuSample> input(AuSample(SOUND_BUFFER_SIZE, smpsl), AuSample(
+ Stereo<Sample> input(Sample(SOUND_BUFFER_SIZE, smpsl), Sample(
SOUND_BUFFER_SIZE,
smpsr));
out(input);
}
-void Echo::out(const Stereo<AuSample> &input)
+void Echo::out(const Stereo<Sample> &input)
{
-//void Echo::out(const Stereo<AuSample> & input){ //ideal
REALTYPE l, r, ldl, rdl; /**\todo move l+r->? ldl+rdl->?*/
for(int i = 0; i < input.l().size(); i++) {
@@ -117,7 +116,7 @@ void Echo::out(const Stereo<AuSample> &input)
/*
* Parameter control
*/
-void Echo::setvolume(const unsigned char &Pvolume)
+void Echo::setvolume(unsigned char Pvolume)
{
this->Pvolume = Pvolume;
@@ -132,13 +131,13 @@ void Echo::setvolume(const unsigned char &Pvolume)
cleanup();
}
-void Echo::setpanning(const unsigned char &Ppanning)
+void Echo::setpanning(unsigned char Ppanning)
{
this->Ppanning = Ppanning;
panning = (Ppanning + 0.5) / 127.0;
}
-void Echo::setdelay(const unsigned char &Pdelay)
+void Echo::setdelay(unsigned char Pdelay)
{
delay.setmVal(Pdelay);
//this->Pdelay=Pdelay;
@@ -146,7 +145,7 @@ void Echo::setdelay(const unsigned char &Pdelay)
initdelays();
}
-void Echo::setlrdelay(const unsigned char &Plrdelay)
+void Echo::setlrdelay(unsigned char Plrdelay)
{
REALTYPE tmp;
this->Plrdelay = Plrdelay;
@@ -158,19 +157,19 @@ void Echo::setlrdelay(const unsigned char &Plrdelay)
initdelays();
}
-void Echo::setlrcross(const unsigned char &Plrcross)
+void Echo::setlrcross(unsigned char Plrcross)
{
this->Plrcross = Plrcross;
lrcross = Plrcross / 127.0 * 1.0;
}
-void Echo::setfb(const unsigned char &Pfb)
+void Echo::setfb(unsigned char Pfb)
{
this->Pfb = Pfb;
fb = Pfb / 128.0;
}
-void Echo::sethidamp(const unsigned char &Phidamp)
+void Echo::sethidamp(unsigned char Phidamp)
{
this->Phidamp = Phidamp;
hidamp = 1.0 - Phidamp / 127.0;
@@ -213,7 +212,7 @@ void Echo::setpreset(unsigned char npreset)
}
-void Echo::changepar(const int &npar, const unsigned char &value)
+void Echo::changepar(int npar, unsigned char value)
{
switch(npar) {
case 0:
@@ -240,7 +239,7 @@ void Echo::changepar(const int &npar, const unsigned char &value)
}
}
-unsigned char Echo::getpar(const int &npar) const
+unsigned char Echo::getpar(int npar) const
{
switch(npar) {
case 0:
diff --git a/src/Effects/Echo.h b/src/Effects/Echo.h
@@ -25,7 +25,7 @@
#include "../globals.h"
#include "Effect.h"
-#include "../Samples/AuSample.h"
+#include "../Samples/Sample.h"
#include "../Misc/Stereo.h"
#include "../Controls/DelayCtl.h"
@@ -59,7 +59,7 @@ class Echo:public Effect
* or not (It should be)
*/
void out(REALTYPE *const smpsl, REALTYPE *const smpr);
- void out(const Stereo<AuSample> &input);
+ void out(const Stereo<Sample> &input);
/**
* Sets the state of Echo to the specified preset
@@ -81,7 +81,7 @@ class Echo:public Effect
* @param npar number of chosen parameter
* @param value the new value
*/
- void changepar(const int &npar, const unsigned char &value);
+ void changepar(int npar, unsigned char value);
/**
* Gets the specified parameter
@@ -97,7 +97,7 @@ class Echo:public Effect
* @param npar number of chosen parameter
* @return value of parameter
*/
- unsigned char getpar(const int &npar) const;
+ unsigned char getpar(int npar) const;
int getnumparams();
@@ -108,28 +108,28 @@ class Echo:public Effect
void setdryonly();
private:
//Parameters
- char Pvolume; /**<#1 Volume or Dry/Wetness*/
+ char Pvolume; /**<#1 Volume or Dry/Wetness*/
char Ppanning; /**<#2 Panning*/
- DelayCtl delay; /**<#3 Delay of the Echo*/
+ DelayCtl delay; /**<#3 Delay of the Echo*/
char Plrdelay; /**<#4 L/R delay difference*/
char Plrcross; /**<#5 L/R Mixing*/
- char Pfb; /**<#6Feedback*/
- char Phidamp; /**<#7Dampening of the Echo*/
+ char Pfb; /**<#6Feedback*/
+ char Phidamp; /**<#7Dampening of the Echo*/
- void setvolume(const unsigned char &Pvolume);
- void setpanning(const unsigned char &Ppanning);
- void setdelay(const unsigned char &Pdelay);
- void setlrdelay(const unsigned char &Plrdelay);
- void setlrcross(const unsigned char &Plrcross);
- void setfb(const unsigned char &Pfb);
- void sethidamp(const unsigned char &Phidamp);
+ void setvolume(unsigned char Pvolume);
+ void setpanning(unsigned char Ppanning);
+ void setdelay(unsigned char Pdelay);
+ void setlrdelay(unsigned char Plrdelay);
+ void setlrcross(unsigned char Plrcross);
+ void setfb(unsigned char Pfb);
+ void sethidamp(unsigned char Phidamp);
//Real Parameters
REALTYPE panning, lrcross, fb, hidamp; //needs better names
int dl, dr, lrdelay; //needs better names
void initdelays();
- Stereo<AuSample> delaySample;
+ Stereo<Sample> delaySample;
Stereo<REALTYPE> old;
int kl, kr;
diff --git a/src/Effects/Effect.cpp b/src/Effects/Effect.cpp
@@ -22,10 +22,16 @@
#include "Effect.h"
-
Effect::Effect(bool insertion_, REALTYPE *const efxoutl_,
REALTYPE *const efxoutr_, FilterParams *filterpars_,
const unsigned char &Ppreset_)
:Ppreset(Ppreset_), efxoutl(efxoutl_), efxoutr(efxoutr_),
- filterpars(filterpars_), insertion(insertion_) {}
+ filterpars(filterpars_), insertion(insertion_)
+{}
+
+void Effect::out(REALTYPE *const smpsl, REALTYPE *const smpsr)
+{
+ out(Stereo<Sample>(Sample(SOUND_BUFFER_SIZE, smpsl),
+ Sample(SOUND_BUFFER_SIZE, smpsr)));
+}
diff --git a/src/Effects/Effect.h b/src/Effects/Effect.h
@@ -26,6 +26,8 @@
#include "../Misc/Util.h"
#include "../globals.h"
#include "../Params/FilterParams.h"
+#include "../Misc/Stereo.h"
+#include "../Samples/Sample.h"
/**this class is inherited by the all effects(Reverb, Echo, ..)*/
@@ -56,12 +58,12 @@ class Effect
/**Change parameter npar to value
* @param npar chosen parameter
* @param value chosen new value*/
- virtual void changepar(const int &npar, const unsigned char &value) = 0;
+ virtual void changepar(int npar, unsigned char value) = 0;
/**Get the value of parameter npar
* @param npar chosen parameter
* @return the value of the parameter in an unsigned char or 0 if it
* does not exist*/
- virtual unsigned char getpar(const int &npar) const = 0;
+ virtual unsigned char getpar(int npar) const = 0;
/**Output result of effect based on the given buffers
*
* This method should result in the effect generating its results
@@ -71,12 +73,13 @@ class Effect
* @param smpsl Input buffer for the Left channel
* @param smpsr Input buffer for the Right channel
*/
- virtual void out(REALTYPE *const smpsl, REALTYPE *const smpsr) = 0;
+ void out(REALTYPE *const smpsl, REALTYPE *const smpsr);
+ virtual void out(const Stereo<Sample> &smp) = 0;
/**Reset the state of the effect*/
virtual void cleanup() {}
/**This is only used for EQ (for user interface)*/
virtual REALTYPE getfreqresponse(REALTYPE freq) {
- return 0;
+ return freq;
}
unsigned char Ppreset; /**<Currently used preset*/
@@ -96,7 +99,7 @@ class Effect
protected:
const bool insertion;/**<If Effect is an insertion effect, insertion=1
- *otherwise, it should be insertion=0*/
+ *otherwise, it should be insertion=0*/
};
#endif
diff --git a/src/Effects/Phaser.cpp b/src/Effects/Phaser.cpp
@@ -38,7 +38,7 @@ Phaser::~Phaser()
/*
* Effect output
*/
-void Phaser::out(REALTYPE *smpsl, REALTYPE *smpsr)
+void Phaser::out(const Stereo<Sample> &smp)
{
int i, j;
REALTYPE lfol, lfor, lgain, rgain, tmp;
@@ -69,8 +69,8 @@ void Phaser::out(REALTYPE *smpsl, REALTYPE *smpsr)
REALTYPE x1 = 1.0 - x;
REALTYPE gl = lgain * x + oldgain.left() * x1;
REALTYPE gr = rgain * x + oldgain.right() * x1;
- REALTYPE inl = smpsl[i] * panning + fbl;
- REALTYPE inr = smpsr[i] * (1.0 - panning) + fbr;
+ REALTYPE inl = smp.l()[i] * panning + fbl;
+ REALTYPE inr = smp.r()[i] * (1.0 - panning) + fbr;
//Left channel
for(j = 0; j < Pstages * 2; j++) { //Phasing routine
@@ -121,20 +121,20 @@ void Phaser::cleanup()
/*
* Parameter control
*/
-void Phaser::setdepth(const unsigned char &Pdepth)
+void Phaser::setdepth(unsigned char Pdepth)
{
this->Pdepth = Pdepth;
depth = (Pdepth / 127.0);
}
-void Phaser::setfb(const unsigned char &Pfb)
+void Phaser::setfb(unsigned char Pfb)
{
this->Pfb = Pfb;
fb = (Pfb - 64.0) / 64.1;
}
-void Phaser::setvolume(const unsigned char &Pvolume)
+void Phaser::setvolume(unsigned char Pvolume)
{
this->Pvolume = Pvolume;
outvolume = Pvolume / 127.0;
@@ -144,29 +144,29 @@ void Phaser::setvolume(const unsigned char &Pvolume)
volume = outvolume;
}
-void Phaser::setpanning(const unsigned char &Ppanning)
+void Phaser::setpanning(unsigned char Ppanning)
{
this->Ppanning = Ppanning;
panning = Ppanning / 127.0;
}
-void Phaser::setlrcross(const unsigned char &Plrcross)
+void Phaser::setlrcross(unsigned char Plrcross)
{
this->Plrcross = Plrcross;
lrcross = Plrcross / 127.0;
}
-void Phaser::setstages(const unsigned char &Pstages)
+void Phaser::setstages(unsigned char Pstages)
{
if(Pstages >= MAX_PHASER_STAGES)
this->Pstages = MAX_PHASER_STAGES - 1;
else
this->Pstages = Pstages;
- old = Stereo<AuSample>(Pstages * 2);
+ old = Stereo<Sample>(Pstages * 2);
cleanup();
}
-void Phaser::setphase(const unsigned char &Pphase)
+void Phaser::setphase(unsigned char Pphase)
{
this->Pphase = Pphase;
phase = (Pphase / 127.0);
@@ -199,7 +199,7 @@ void Phaser::setpreset(unsigned char npreset)
}
-void Phaser::changepar(const int &npar, const unsigned char &value)
+void Phaser::changepar(int npar, unsigned char value)
{
switch(npar) {
case 0:
@@ -248,7 +248,7 @@ void Phaser::changepar(const int &npar, const unsigned char &value)
}
}
-unsigned char Phaser::getpar(const int &npar) const
+unsigned char Phaser::getpar(int npar) const
{
switch(npar) {
case 0:
diff --git a/src/Effects/Phaser.h b/src/Effects/Phaser.h
@@ -24,7 +24,7 @@
#define PHASER_H
#include "../globals.h"
#include "../Misc/Stereo.h"
-#include "../Samples/AuSample.h"
+#include "../Samples/Sample.h"
#include "Effect.h"
#include "EffectLFO.h"
@@ -35,10 +35,10 @@ class Phaser:public Effect
public:
Phaser(const int &insetion_, REALTYPE *efxoutl_, REALTYPE *efxoutr_);
~Phaser();
- void out(REALTYPE *smpsl, REALTYPE *smpsr);
+ void out(const Stereo<Sample> &smp);
void setpreset(unsigned char npreset);
- void changepar(const int &npar, const unsigned char &value);
- unsigned char getpar(const int &npar) const;
+ void changepar(int npar, unsigned char value);
+ unsigned char getpar(int npar) const;
void cleanup();
void setdryonly();
@@ -49,26 +49,23 @@ class Phaser:public Effect
unsigned char Ppanning;
unsigned char Pdepth; /**<the depth of the Phaser*/
unsigned char Pfb; /**<feedback*/
- unsigned char Plrcross; /**<feedback*/
+ unsigned char Plrcross; /**<crossover*/
unsigned char Pstages;
unsigned char Poutsub; /**<if I wish to substract the output instead of the adding it*/
unsigned char Pphase;
- //Control Parametrii
- void setvolume(const unsigned char &Pvolume);
- void setpanning(const unsigned char &Ppanning);
- void setdepth(const unsigned char &Pdepth);
- void setfb(const unsigned char &Pfb);
- void setlrcross(const unsigned char &Plrcross);
- void setstages(const unsigned char &Pstages);
- void setphase(const unsigned char &Pphase);
+ //Control Parameters
+ void setvolume(unsigned char Pvolume);
+ void setpanning(unsigned char Ppanning);
+ void setdepth(unsigned char Pdepth);
+ void setfb(unsigned char Pfb);
+ void setlrcross(unsigned char Plrcross);
+ void setstages(unsigned char Pstages);
+ void setphase(unsigned char Pphase);
//Internal Values
- //int insertion; //inherited from Effect
REALTYPE panning, fb, depth, lrcross, fbl, fbr, phase;
- //REALTYPE *oldl,*oldr;
- Stereo<AuSample> old;
- //REALTYPE oldlgain,oldrgain;
+ Stereo<Sample> old;
Stereo<REALTYPE> oldgain;
};
diff --git a/src/Effects/Reverb.cpp b/src/Effects/Reverb.cpp
@@ -165,14 +165,14 @@ void Reverb::processmono(int ch, REALTYPE *output)
/*
* Effect output
*/
-void Reverb::out(REALTYPE *smps_l, REALTYPE *smps_r)
+void Reverb::out(const Stereo<Sample> &smp)
{
int i;
if((Pvolume == 0) && (insertion != 0))
return;
for(i = 0; i < SOUND_BUFFER_SIZE; i++)
- inputbuf[i] = (smps_l[i] + smps_r[i]) / 2.0;
+ inputbuf[i] = (smp.l()[i] + smp.r()[i]) / 2.0;
;
if(idelay != NULL) {
@@ -215,7 +215,7 @@ void Reverb::out(REALTYPE *smps_l, REALTYPE *smps_r)
/*
* Parameter control
*/
-void Reverb::setvolume(const unsigned char &Pvolume)
+void Reverb::setvolume(unsigned char Pvolume)
{
this->Pvolume = Pvolume;
if(insertion == 0) {
@@ -229,13 +229,13 @@ void Reverb::setvolume(const unsigned char &Pvolume)
}
}
-void Reverb::setpan(const unsigned char &Ppan)
+void Reverb::setpan(unsigned char Ppan)
{
this->Ppan = Ppan;
pan = (REALTYPE)Ppan / 127.0;
}
-void Reverb::settime(const unsigned char &Ptime)
+void Reverb::settime(unsigned char Ptime)
{
int i;
REALTYPE t;
@@ -271,7 +271,7 @@ void Reverb::setlohidamp(unsigned char Plohidamp)
}
}
-void Reverb::setidelay(const unsigned char &Pidelay)
+void Reverb::setidelay(unsigned char Pidelay)
{
REALTYPE delay;
this->Pidelay = Pidelay;
@@ -290,13 +290,13 @@ void Reverb::setidelay(const unsigned char &Pidelay)
}
}
-void Reverb::setidelayfb(const unsigned char &Pidelayfb)
+void Reverb::setidelayfb(unsigned char Pidelayfb)
{
this->Pidelayfb = Pidelayfb;
idelayfb = Pidelayfb / 128.0;
}
-void Reverb::sethpf(const unsigned char &Phpf)
+void Reverb::sethpf(unsigned char Phpf)
{
this->Phpf = Phpf;
if(Phpf == 0) { //No HighPass
@@ -313,7 +313,7 @@ void Reverb::sethpf(const unsigned char &Phpf)
}
}
-void Reverb::setlpf(const unsigned char &Plpf)
+void Reverb::setlpf(unsigned char Plpf)
{
this->Plpf = Plpf;
if(Plpf == 127) { //No LowPass
@@ -405,7 +405,7 @@ void Reverb::settype(unsigned char Ptype)
}
}
-void Reverb::setroomsize(const unsigned char &Proomsize)
+void Reverb::setroomsize(unsigned char Proomsize)
{
this->Proomsize = Proomsize;
if(Proomsize == 0)
@@ -418,7 +418,7 @@ void Reverb::setroomsize(const unsigned char &Proomsize)
settype(Ptype);
}
-void Reverb::setbandwidth(const unsigned char &Pbandwidth) {
+void Reverb::setbandwidth(unsigned char Pbandwidth) {
this->Pbandwidth = Pbandwidth;
REALTYPE v = Pbandwidth / 127.0;
if(bandwidth)
@@ -468,7 +468,7 @@ void Reverb::setpreset(unsigned char npreset)
}
-void Reverb::changepar(const int &npar, const unsigned char &value)
+void Reverb::changepar(int npar, unsigned char value)
{
switch(npar) {
case 0:
@@ -511,7 +511,7 @@ void Reverb::changepar(const int &npar, const unsigned char &value)
}
}
-unsigned char Reverb::getpar(const int &npar) const
+unsigned char Reverb::getpar(int npar) const
{
switch(npar) {
case 0:
diff --git a/src/Effects/Reverb.h b/src/Effects/Reverb.h
@@ -40,12 +40,12 @@ class Reverb:public Effect
public:
Reverb(const int &insertion_, REALTYPE *efxoutl_, REALTYPE *efxoutr_);
~Reverb();
- void out(REALTYPE *smps_l, REALTYPE *smps_r);
+ void out(const Stereo<Sample> &smp);
void cleanup();
void setpreset(unsigned char npreset);
- void changepar(const int &npar, const unsigned char &value);
- unsigned char getpar(const int &npar) const;
+ void changepar(int npar, unsigned char value);
+ unsigned char getpar(int npar) const;
private:
//Parametrii
@@ -90,17 +90,17 @@ class Reverb:public Effect
unsigned char Pbandwidth;
//parameter control
- void setvolume(const unsigned char &Pvolume);
- void setpan(const unsigned char &Ppan);
- void settime(const unsigned char &Ptime);
+ void setvolume(unsigned char Pvolume);
+ void setpan(unsigned char Ppan);
+ void settime(unsigned char Ptime);
void setlohidamp(unsigned char Plohidamp);
- void setidelay(const unsigned char &Pidelay);
- void setidelayfb(const unsigned char &Pidelayfb);
- void sethpf(const unsigned char &Phpf);
- void setlpf(const unsigned char &Plpf);
+ void setidelay(unsigned char Pidelay);
+ void setidelayfb(unsigned char Pidelayfb);
+ void sethpf(unsigned char Phpf);
+ void setlpf(unsigned char Plpf);
void settype(unsigned char Ptype);
- void setroomsize(const unsigned char &Proomsize);
- void setbandwidth(const unsigned char &Pbandwidth);
+ void setroomsize(unsigned char Proomsize);
+ void setbandwidth(unsigned char Pbandwidth);
REALTYPE pan, erbalance;
//Parameters