commit 92389622dfa3961cba697062ff6ba3d1ba9d9f7d
parent 8dd01462a4e7ef6f3c79c086301053c183e5da0b
Author: fundamental <fundamental>
Date: Fri, 29 May 2009 02:00:13 +0000
Added: Controls, Samples, Stereo, and Doxygen comments
Diffstat:
62 files changed, 1038 insertions(+), 394 deletions(-)
diff --git a/ChangeLog b/ChangeLog
@@ -840,7 +840,7 @@
hovers over them
- Created tooltips for the effects knobs
- Standardized the code, so it could compile with pedantic without
- errors [it looks like some errors may have ben missed]
+ errors [it looks like some errors may have been missed]
22 Feb 2009 (Mark McCurry)
- Fix improper deallocation in PresetsStore
@@ -861,3 +861,9 @@
- Almost all changes contained in Effects until further
discussion on the style, so consistancy can be reached
+28 May 2009 (Mark McCurry)
+ - Added some more Doxygen comments
+ - Added Audio Samples classes
+ - Added Stereo template
+ - Added Control class
+ - Added DelayCtl class
diff --git a/doc/Doxyfile b/doc/Doxyfile
@@ -25,7 +25,7 @@ ABBREVIATE_BRIEF = "The $name class" \
ALWAYS_DETAILED_SEC = NO
INLINE_INHERITED_MEMB = YES
FULL_PATH_NAMES = YES
-STRIP_FROM_PATH = */zynaddsubfx/src/
+STRIP_FROM_PATH = /home/mark/zynaddsubfx/src/
STRIP_FROM_INC_PATH =
SHORT_NAMES = NO
JAVADOC_AUTOBRIEF = NO
@@ -280,7 +280,7 @@ PERL_PATH = /usr/bin/perl
CLASS_DIAGRAMS = NO
MSCGEN_PATH =
HIDE_UNDOC_RELATIONS = YES
-HAVE_DOT = NO
+HAVE_DOT = YES
DOT_FONTNAME = FreeSans
DOT_FONTPATH =
CLASS_GRAPH = YES
@@ -290,7 +290,7 @@ UML_LOOK = YES
TEMPLATE_RELATIONS = NO
INCLUDE_GRAPH = YES
INCLUDED_BY_GRAPH = YES
-CALL_GRAPH = NO
+CALL_GRAPH = YES
CALLER_GRAPH = NO
GRAPHICAL_HIERARCHY = YES
DIRECTORY_GRAPH = YES
diff --git a/src/Controls/Control.C b/src/Controls/Control.C
@@ -0,0 +1,19 @@
+#include "Control.h"
+
+Control::Control(char ndefaultval)
+ :defaultval(ndefaultval),lockqueue(-1),locked(false)
+{}
+
+void Control::lock()
+{
+ locked=true;
+ lockqueue=-1;
+}
+
+void Control::ulock()
+{
+ if(locked&&lockqueue>=0)
+ setmVal(lockqueue);
+ locked=false;
+}
+
diff --git a/src/Controls/Control.h b/src/Controls/Control.h
@@ -0,0 +1,38 @@
+#include <string>
+
+#ifndef CONTROL_H
+#define CONTROL_H
+/**A control for a parameter within the program*/
+class Control
+{
+ public:
+ Control(char ndefaultval);/**\todo create proper initialization list*/
+ ~Control(){};
+ /**Return the string, which represents the internal value
+ * @return a string representation of the current value*/
+ virtual std::string getString()const=0;
+ /**Set the Control to the given value
+ * @param nval A number 0-127*/
+ virtual void setmVal(char nval)=0;
+ /**Return the midi value (aka the char)
+ * @return the current value*/
+ virtual char getmVal()const=0;
+ /** Will lock the Control until it is ulocked
+ *
+ * Locking a Control will Stop it from having
+ * its internal data altered*/
+ void lock();
+ /** Will unlock the Control
+ *
+ * This will also update the Control
+ * if something attempted to update it while it was locked*/
+ void ulock();
+ private:
+ char defaultval;/**<Default value of the Control*/
+ char lockqueue; /**<The value is that is stored, while the Control is locked
+ * and something attempts to update it*/
+ bool locked;//upgrade this to a integer lock level if problems occur
+};
+
+#endif
+
diff --git a/src/Controls/DelayCtl.C b/src/Controls/DelayCtl.C
@@ -0,0 +1,29 @@
+#include "DelayCtl.h"
+#include <sstream>
+
+DelayCtl::DelayCtl()
+ :Control(64),value(64/127.0*1.5){} /**\todo finishme*/
+
+std::string DelayCtl::getString() const
+{
+ std::ostringstream buf;
+ buf<<value;
+ return (buf.str() + " Seconds");
+}
+
+void DelayCtl::setmVal(char nval)
+{
+ /**\todo add locking code*/
+ //value=1+(int)(nval/127.0*SAMPLE_RATE*1.5);//0 .. 1.5 sec
+ value=(nval/127.0*1.5);//0 .. 1.5 sec
+}
+
+char DelayCtl::getmVal() const
+{
+ return((char)(value/1.5*127.0));
+}
+
+float DelayCtl::getiVal() const
+{
+ return(value);
+}
diff --git a/src/Controls/DelayCtl.h b/src/Controls/DelayCtl.h
@@ -0,0 +1,22 @@
+#include "Control.h"
+
+#ifndef DELAYCTL_H
+#define DELAYCTL_H
+/**A Control for Delays
+ *
+ * Will vary from 0 seconds to 1.5 seconds*/
+class DelayCtl:public Control
+{
+ public:
+ DelayCtl();
+ ~DelayCtl(){};
+ std::string getString() const;
+ void setmVal(char nval);
+ char getmVal() const;
+ float getiVal() const;
+ private:
+ float value;
+};
+
+#endif
+
diff --git a/src/Controls/Makefile b/src/Controls/Makefile
@@ -0,0 +1,14 @@
+include ../Makefile.inc
+
+objects=Control.o DelayCtl.o
+
+
+all: $(objects)
+
+-include ../Make.deps
+
+.PHONY : clean
+clean:
+ rm -f $(objects)
+ rm -f makeinclude.deps
+
diff --git a/src/DSP/AnalogFilter.h b/src/DSP/AnalogFilter.h
@@ -25,6 +25,8 @@
#include "../globals.h"
#include "Filter_.h"
+
+/**Implementation of Several analog filters (lowpass, highpass...)*/
class AnalogFilter:public Filter_{
public:
AnalogFilter(unsigned char Ftype,REALTYPE Ffreq, REALTYPE Fq,unsigned char Fstages);
@@ -62,7 +64,7 @@ class AnalogFilter:public Filter_{
REALTYPE oldc[3],oldd[3];//old coefficients(used only if some filter paremeters changes very fast, and it needs interpolation)
REALTYPE xd[3],yd[3];//used if the filter is applied more times
- int needsinterpolation,firsttime;
+ int needsinterpolation,firsttime;/**\todo see if bool works for these*/
int abovenq;//this is 1 if the frequency is above the nyquist
int oldabovenq;//if the last time was above nyquist (used to see if it needs interpolation)
};
diff --git a/src/DSP/FFTwrapper.C b/src/DSP/FFTwrapper.C
@@ -94,6 +94,3 @@ void FFTwrapper::freqs2smps(FFTFREQS freqs,REALTYPE *smps){
};
-
-
-
diff --git a/src/DSP/FFTwrapper.h b/src/DSP/FFTwrapper.h
@@ -44,10 +44,17 @@ Hope all goes right." */
#define rfftw_plan fftw_plan
#endif
+/**A wrapper for the FFTW library (Fast Fourier Transforms)*/
class FFTwrapper{
public:
+ /**Constructor
+ * @param fftsize The size of samples to be fed to fftw*/
FFTwrapper(int fftsize_);
+ /**Destructor*/
~FFTwrapper();
+ /**Convert Samples to Frequencies using Fourier Transform
+ * @param smps Pointer to Samples to be converted; has length fftsize_
+ * @param freqs Structure FFTFREQS which stores the frequencies*/
void smps2freqs(REALTYPE *smps,FFTFREQS freqs);
void freqs2smps(FFTFREQS freqs,REALTYPE *smps);
private:
diff --git a/src/Effects/Alienwah.C b/src/Effects/Alienwah.C
@@ -53,8 +53,7 @@ void Alienwah::out(REALTYPE *smpsl,REALTYPE *smpsr){
clfol=complex<REALTYPE>(cos(lfol+phase)*fb,sin(lfol+phase)*fb); //rework
clfor=complex<REALTYPE>(cos(lfor+phase)*fb,sin(lfor+phase)*fb); //rework
- for (int i=0;i<SOUND_BUFFER_SIZE;i++){/**\todo reduce significantly with
- * valarray*/
+ for (int i=0;i<SOUND_BUFFER_SIZE;i++){
REALTYPE x=((REALTYPE) i)/SOUND_BUFFER_SIZE;
REALTYPE x1=1.0-x;
//left
@@ -91,7 +90,7 @@ void Alienwah::out(REALTYPE *smpsl,REALTYPE *smpsr){
* Cleanup the effect
*/
void Alienwah::cleanup(){
- for (int i=0;i<Pdelay;i++) { /**\todo reduce with valarray*/
+ for (int i=0;i<Pdelay;i++) {
oldl[i]=complex<REALTYPE>(0.0,0.0);
oldr[i]=complex<REALTYPE>(0.0,0.0);
};
diff --git a/src/Effects/Echo.C b/src/Effects/Echo.C
@@ -21,32 +21,36 @@
*/
#include <cmath>
+#include <iostream>
#include "Echo.h"
Echo::Echo(const int & insertion_,REALTYPE *const efxoutl_,REALTYPE *const efxoutr_)
: Effect(insertion_,efxoutl_,efxoutr_,NULL,0),
- Pvolume(50),Ppanning(64),Pdelay(60),
+ Pvolume(50),Ppanning(64),//Pdelay(60),
Plrdelay(100),Plrcross(100),Pfb(40),Phidamp(60),
- lrdelay(0),ldelay(NULL),rdelay(NULL)
+ lrdelay(0),delaySample(AuSample(1),AuSample(1)),old(0.0,0.0)
{
setpreset(Ppreset);
cleanup();
}
Echo::~Echo(){
- delete[] ldelay;
- delete[] rdelay;
+ //delete[] ldelay;
+ //delete[] rdelay;
}
/*
* Cleanup the effect
*/
void Echo::cleanup(){
- int i;
- for (i=0;i<dl;i++) ldelay[i]=0.0;
- for (i=0;i<dr;i++) rdelay[i]=0.0;
- oldl=0.0;
- oldr=0.0;
+ //int i;
+ delaySample.left().clear();
+ delaySample.right().clear();
+ //for (i=0;i<dl;i++) ldelay[i]=0.0;
+ //for (i=0;i<dr;i++) rdelay[i]=0.0;
+ old=Stereo<REALTYPE>(0.0,0.0);
+ //oldl=0.0;
+ //oldr=0.0;
}
@@ -54,14 +58,17 @@ void Echo::cleanup(){
* Initialize the delays
*/
void Echo::initdelays(){
+ /**\todo make this adjust insted of destroy old delays*/
kl=0;kr=0;
- dl=delay-lrdelay;if (dl<1) dl=1;
- dr=delay+lrdelay;if (dr<1) dr=1;
+ dl=(int)(1+delay.getiVal()*SAMPLE_RATE-lrdelay);if (dl<1) dl=1;
+ dr=(int)(1+delay.getiVal()*SAMPLE_RATE+lrdelay);if (dr<1) dr=1;
- if (ldelay!=NULL) delete [] ldelay;
- if (rdelay!=NULL) delete [] rdelay;
- ldelay=new REALTYPE[dl];
- rdelay=new REALTYPE[dr];
+ delaySample.left()=AuSample(dl);
+ delaySample.right()=AuSample(dr);
+ //if (ldelay!=NULL) delete [] ldelay;
+ //if (rdelay!=NULL) delete [] rdelay;
+ //ldelay=new REALTYPE[dl];
+ //rdelay=new REALTYPE[dr];
cleanup();
}
@@ -70,26 +77,29 @@ void Echo::initdelays(){
* Effect output
*/
void Echo::out(REALTYPE *const smpsl,REALTYPE *const smpsr){
- int i;
- REALTYPE l,r,ldl,rdl;
+//void Echo::out(const Stereo<AuSample> & input){ //ideal
+ REALTYPE l,r,ldl,rdl;/**\todo move l+r->? ldl+rdl->?*/
+ Stereo<AuSample> input(AuSample(smpsl,SOUND_BUFFER_SIZE),AuSample(smpsr,SOUND_BUFFER_SIZE));
- for (i=0;i<SOUND_BUFFER_SIZE;i++){
- ldl=ldelay[kl];
- rdl=rdelay[kr];
+ for (int i=0;i<input.left().size();i++){
+ ldl=delaySample.left()[kl];
+ rdl=delaySample.right()[kr];
l=ldl*(1.0-lrcross)+rdl*lrcross;
r=rdl*(1.0-lrcross)+ldl*lrcross;
ldl=l;rdl=r;
efxoutl[i]=ldl*2.0;
efxoutr[i]=rdl*2.0;
- ldl=smpsl[i]*panning-ldl*fb;
- rdl=smpsr[i]*(1.0-panning)-rdl*fb;
+
+
+ ldl=input.left()[i]*panning-ldl*fb;
+ rdl=input.right()[i]*(1.0-panning)-rdl*fb;
//LowPass Filter
- ldelay[kl]=ldl=ldl*hidamp+oldl*(1.0-hidamp);
- rdelay[kr]=rdl=rdl*hidamp+oldr*(1.0-hidamp);
- oldl=ldl;
- oldr=rdl;
+ delaySample.left()[kl]=ldl=ldl*hidamp+old.left()*(1.0-hidamp);
+ delaySample.right()[kr]=rdl=rdl*hidamp+old.right()*(1.0-hidamp);
+ old.left()=ldl;
+ old.right()=rdl;
if (++kl>=dl) kl=0;
if (++kr>=dr) kr=0;
@@ -120,8 +130,9 @@ void Echo::setpanning(const unsigned char & Ppanning){
}
void Echo::setdelay(const unsigned char & Pdelay){
- this->Pdelay=Pdelay;
- delay=1+(int)(Pdelay/127.0*SAMPLE_RATE*1.5);//0 .. 1.5 sec
+ delay.setmVal(Pdelay);
+ //this->Pdelay=Pdelay;
+ //delay=1+(int)(Pdelay/127.0*SAMPLE_RATE*1.5);//0 .. 1.5 sec
initdelays();
}
@@ -176,13 +187,12 @@ void Echo::setpreset(unsigned char npreset){
if (npreset>=NUM_PRESETS) npreset=NUM_PRESETS-1;
for (int n=0;n<PRESET_SIZE;n++) changepar(n,presets[npreset][n]);
- if (insertion!=0) setvolume(presets[npreset][0]/2);//lower the volume if this is insertion effect
+ if (insertion) setvolume(presets[npreset][0]/2);//lower the volume if this is insertion effect
Ppreset=npreset;
}
void Echo::changepar(const int & npar,const unsigned char & value){
- /**\todo get rid of this leaky abstraction*/
switch (npar){
case 0: setvolume(value);
break;
@@ -202,13 +212,12 @@ void Echo::changepar(const int & npar,const unsigned char & value){
}
unsigned char Echo::getpar(const int & npar)const{
- /**\todo get rid of this leaky abstraction*/
switch (npar){
case 0: return(Pvolume);
break;
case 1: return(Ppanning);
break;
- case 2: return(Pdelay);
+ case 2: return(delay.getmVal());
break;
case 3: return(Plrdelay);
break;
diff --git a/src/Effects/Echo.h b/src/Effects/Echo.h
@@ -25,6 +25,9 @@
#include "../globals.h"
#include "Effect.h"
+#include "../Samples/AuSample.h"
+#include "../Misc/Stereo.h"
+#include "../Controls/DelayCtl.h"
/**Echo Effect*/
class Echo:public Effect{
@@ -50,7 +53,7 @@ class Echo:public Effect{
* @param smpsl Sample from Left channel
* @param smpsr Sample from Right channel
* \todo try to figure out if smpsl should be const *const
- * or not
+ * or not (It should be)
*/
void out(REALTYPE *const smpsl,REALTYPE *const smpr);
@@ -89,27 +92,25 @@ class Echo:public Effect{
* -# Dampening
* @param npar number of chosen parameter
* @return value of parameter
- *
- * \todo make this method use constant variables by reference
- *Currently doing so results in strange behavior
*/
unsigned char getpar(const int & npar)const;
+ int getnumparams();
+
/**Zeros out the state of the Echo*/
void cleanup();
/**\todo This function needs to be implemented or the prototype should be removed*/
void setdryonly();
private:
- /**\todo remove all of these once they have been depreciated*/
//Parameters
- unsigned char Pvolume;/**<#1 Volume or Dry/Wetness*/
- unsigned char Ppanning;/**<#2 Panning*/
- unsigned char Pdelay;/**<#3 Delay of the Echo*/
- unsigned char Plrdelay;/**<#4 L/R delay difference*/
- unsigned char Plrcross;/**<#5 L/R Mixing*/
- unsigned char Pfb;/**<#6Feedback*/
- unsigned char Phidamp;/**<#7Dampening of the Echo*/
+ char Pvolume;/**<#1 Volume or Dry/Wetness*/
+ char Ppanning;/**<#2 Panning*/
+ 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*/
void setvolume(const unsigned char & Pvolume);
void setpanning(const unsigned char & Ppanning);
@@ -120,12 +121,16 @@ class Echo:public Effect{
void sethidamp(const unsigned char & Phidamp);
//Real Parameters
- REALTYPE panning,lrcross,fb,hidamp;
- int dl,dr,delay,lrdelay;
+ REALTYPE panning,lrcross,fb,hidamp; //needs better names
+ int dl,dr,lrdelay; //needs better names
void initdelays();
- REALTYPE *ldelay,*rdelay;
- REALTYPE oldl,oldr;//pt. lpf
+ //REALTYPE *ldelay,*rdelay;
+ Stereo<AuSample> delaySample;
+
+ //REALTYPE oldl,oldr;//pt. lpf
+ Stereo<REALTYPE> old;
+
int kl,kr;
};
diff --git a/src/Effects/Effect.C b/src/Effects/Effect.C
@@ -23,7 +23,7 @@
#include "Effect.h"
-Effect::Effect(const int & insertion_,REALTYPE *const efxoutl_,
+Effect::Effect(bool insertion_,REALTYPE *const efxoutl_,
REALTYPE *const efxoutr_,FilterParams *filterpars_,
const unsigned char & Ppreset_)
:Ppreset(Ppreset_),efxoutl(efxoutl_),efxoutr(efxoutr_),
diff --git a/src/Effects/Effect.h b/src/Effects/Effect.h
@@ -23,7 +23,6 @@
#ifndef EFFECT_H
#define EFFECT_H
-#include <valarray>
#include "../Misc/Util.h"
#include "../globals.h"
#include "../Params/FilterParams.h"
@@ -41,7 +40,7 @@ class Effect{
* @param filterpars_ pointer to FilterParams array
* @param Ppreset_ chosen preset
* @return Initialized Effect object*/
- Effect(const int & insertion_,REALTYPE *const efxoutl_,
+ Effect(bool insertion_,REALTYPE *const efxoutl_,
REALTYPE *const efxoutr_,FilterParams *filterpars_,
const unsigned char & Ppreset_);
/**Deconstructor
@@ -93,12 +92,9 @@ class Effect{
FilterParams *filterpars;/**<Parameters for filters used by Effect*/
protected:
- const int insertion;/**<If Effect is an insertion effect, insertion=1
+ const bool insertion;/**<If Effect is an insertion effect, insertion=1
*otherwise, it should be insertion=0*/
};
#endif
-
-
-
diff --git a/src/Effects/EffectLFO.h b/src/Effects/EffectLFO.h
@@ -24,7 +24,8 @@
#define EFFECT_LFO_H
#include "../globals.h"
-/**LFO for some of the Effect objects*/
+/**LFO for some of the Effect objects
+ * \todo see if this should inherit LFO*/
class EffectLFO{
public:
EffectLFO();
@@ -43,7 +44,7 @@ class EffectLFO{
REALTYPE ampl1,ampl2,ampr1,ampr2;//necessary for "randomness"
REALTYPE lfointensity;
REALTYPE lfornd;
- char lfotype; /**\todo GET RID OF CHAR (use a subclass if types are needed)*/
+ char lfotype; /**\todo GET RID OF CHAR (replace with short or enum)*/
};
diff --git a/src/Effects/EffectMgr.h b/src/Effects/EffectMgr.h
@@ -61,19 +61,16 @@ class EffectMgr:public Presets{
* @param nefx_ the number of the effect*/
void changeeffect(int nefx_);
/**Get the number of the effect
- * @return the number
- * \todo try to fix abstraction failure*/
+ * @return the number*/
int geteffect();
/**
* Change the preset to the given one
* @param npreset number of the chosen preset
- * \todo figure out why this is binary
*/
void changepreset(unsigned char npreset);
/**
* Change the preset to the given one without locking the thread
* @param npreset number of the chosen preset
- * \todo figure out why this is binary
*/
void changepreset_nolock(unsigned char npreset);
/**
@@ -85,8 +82,7 @@ class EffectMgr:public Presets{
/**<sets the effect par without thread lock*/
void seteffectpar_nolock(int npar,unsigned char value);
unsigned char geteffectpar(int npar);
- int insertion;/**<1 if the effect is connected as insertion effect
- * \todo figure out why this is not a bool*/
+ const bool insertion;/**<1 if the effect is connected as insertion effect*/
REALTYPE *efxoutl,*efxoutr;
/**used by UI
diff --git a/src/Input/ALSAMidiIn.h b/src/Input/ALSAMidiIn.h
@@ -27,17 +27,22 @@
#include "MidiIn.h"
+/**Midi input for ALSA (this creates an ALSA virtual port)*/
class ALSAMidiIn:public MidiIn{
public:
- ALSAMidiIn();
- ~ALSAMidiIn();
- void getmidicmd(MidiCmdType &cmdtype,unsigned char &cmdchan,int *cmdparams);
- int getalsaid();
+ /**Constructor*/
+ ALSAMidiIn();
+ /**Destructor*/
+ ~ALSAMidiIn();
+
+ void getmidicmd(MidiCmdType &cmdtype,unsigned char &cmdchan,int *cmdparams);
+ /**Get the ALSA id
+ * @return ALSA id*/
+ int getalsaid();
private:
- snd_seq_t *midi_handle;
+ snd_seq_t *midi_handle;
};
-
#endif
diff --git a/src/Input/MidiIn.C b/src/Input/MidiIn.C
@@ -24,12 +24,13 @@
#include "MidiIn.h"
int MidiIn::getcontroller(unsigned char b){
+ /**\todo there might be a better way to do this*/
int ctl=C_NULL;
switch (b){
- case 1:ctl=C_modwheel;//Modulation Wheel
- break;
- case 7:ctl=C_volume;//Volume
- break;
+ case 1:ctl=C_modwheel;//Modulation Wheel
+ break;
+ case 7:ctl=C_volume;//Volume
+ break;
case 10:ctl=C_panning;//Panning
break;
case 11:ctl=C_expression;//Expression
diff --git a/src/Input/MidiIn.h b/src/Input/MidiIn.h
@@ -28,15 +28,22 @@
enum MidiCmdType{MidiNull,MidiNoteOFF,MidiNoteON,MidiController};
#define MP_MAX_BYTES 4000 //in case of loooong SYS_EXes
+/**This class is inherited by all the Midi input classes*/
class MidiIn{
public:
- virtual void getmidicmd(MidiCmdType &cmdtype,unsigned char &cmdchan,int *cmdparams){};
- virtual ~MidiIn(){};
- int getcontroller(unsigned char b);
+ /**Get the command,channel and parameters of the MIDI
+ *
+ * \todo make pure virtual
+ * @param cmdtype the referece to the variable that will store the type
+ * @param cmdchan the channel for the event
+ * @param parameters for the event*/
+ virtual void getmidicmd(MidiCmdType &cmdtype,unsigned char &cmdchan,int *cmdparams){};
+ virtual ~MidiIn(){};//**< \todo figure out if this declaation the intended one*/
+ int getcontroller(unsigned char b);
protected:
- int inputok;//1 if I can read midi bytes from input ports
+ int inputok;/**<1 if I can read midi bytes from input ports*/
+ /**\todo figure out if inputtok can be a bool*/
};
-
#endif
diff --git a/src/Input/NULLMidiIn.C b/src/Input/NULLMidiIn.C
@@ -21,9 +21,6 @@
*/
#include "NULLMidiIn.h"
-#include <stdlib.h>
-#include <stdio.h>
-#include <unistd.h>
NULLMidiIn::NULLMidiIn(){
};
@@ -31,13 +28,11 @@ NULLMidiIn::NULLMidiIn(){
NULLMidiIn::~NULLMidiIn(){
};
-
/*
* Get the midi command,channel and parameters
* It returns MidiNull because it is a dummy driver
*/
void NULLMidiIn::getmidicmd(MidiCmdType &cmdtype,unsigned char &cmdchan,unsigned char *cmdparams){
- cmdtype=MidiNull;
+ cmdtype=MidiNull;
};
-
diff --git a/src/Input/NULLMidiIn.h b/src/Input/NULLMidiIn.h
@@ -26,15 +26,22 @@
#include "MidiIn.h"
+/**a dummy Midi port*/
class NULLMidiIn:public MidiIn{
public:
- NULLMidiIn();
- ~NULLMidiIn();
- void getmidicmd(MidiCmdType &cmdtype,unsigned char &cmdchan,unsigned char *cmdparams);
+ /**Dummy Constructor
+ * \todo see if the default constructor would work here*/
+ NULLMidiIn();
+ /**Dummy Destructor
+ * \todo see if the default destructor would work here*/
+ ~NULLMidiIn();
+ /**Get the midi command,channel and parameters
+ * It returns MidiNull because it is a dummy driver
+ */
+ void getmidicmd(MidiCmdType &cmdtype,unsigned char &cmdchan,unsigned char *cmdparams);
private:
};
-
#endif
diff --git a/src/Makefile b/src/Makefile
@@ -1,7 +1,7 @@
include Makefile.inc
ifneq ($(MAKECMDGOALS),debug)
- CXXFLAGS= -O6 -Wall
+ CXXFLAGS= -O6 -Wall -g
else
CXXFLAGS= -O0 -Wall -Wpointer-arith
endif
@@ -77,7 +77,7 @@ endif
objects=main.o
-SUBDIRS=DSP Effects Input Misc Output Params Synth Seq
+SUBDIRS=Controls DSP Effects Input Misc Output Params Samples Synth Seq
.PHONY: subdirs $(SUBDIRS)
diff --git a/src/Misc/Bank.h b/src/Misc/Bank.h
@@ -29,71 +29,78 @@
#define BANK_SIZE 160
-/*
+/**
* The max. number of banks that are used
*/
#define MAX_NUM_BANKS 400
-
+/**The instrument Bank
+ * \todo add in strings to replace char* */
class Bank{
public:
- Bank();
- ~Bank();
- char *getname(unsigned int ninstrument);
- char *getnamenumbered(unsigned int ninstrument);
- void setname(unsigned int ninstrument,const char *newname,int newslot);//if newslot==-1 then this is ignored, else it will be put on that slot
- bool isPADsynth_used(unsigned int ninstrument);
-
- //returns 0 if the slot is not empty or 1 if the slot is empty
- int emptyslot(unsigned int ninstrument);
-
- void clearslot(unsigned int ninstrument);
- void savetoslot(unsigned int ninstrument,Part *part);
- void loadfromslot(unsigned int ninstrument,Part *part);
-
- void swapslot(unsigned int n1,unsigned int n2);
-
- int loadbank(const char *bankdirname);
- int newbank(const char *newbankdirname);
-
- char *bankfiletitle; //this is shown on the UI of the bank (the title of the window)
- int locked();
-
- void rescanforbanks();
-
- struct bankstruct{
- char *dir;
- char *name;
- };
-
- bankstruct banks[MAX_NUM_BANKS];
-
+ /**Constructor*/
+ Bank();
+ ~Bank();
+ char *getname(unsigned int ninstrument);
+ char *getnamenumbered(unsigned int ninstrument);
+ void setname(unsigned int ninstrument,const char *newname,int newslot);//if newslot==-1 then this is ignored, else it will be put on that slot
+ bool isPADsynth_used(unsigned int ninstrument);
+
+ /**returns 0 if the slot is not empty or 1 if the slot is empty
+ * \todo start using bool before facepalm*/
+ int emptyslot(unsigned int ninstrument);
+
+ /**Empties out the selected slot*/
+ void clearslot(unsigned int ninstrument);
+ /**Saves the given Part to slot*/
+ void savetoslot(unsigned int ninstrument,Part *part);
+ /**Loads the given slot into a Part*/
+ void loadfromslot(unsigned int ninstrument,Part *part);
+
+ /**Swaps Slots*/
+ void swapslot(unsigned int n1,unsigned int n2);
+
+ int loadbank(const char *bankdirname);
+ int newbank(const char *newbankdirname);
+
+ char *bankfiletitle; //this is shown on the UI of the bank (the title of the window)
+ int locked();
+
+ void rescanforbanks();
+
+ struct bankstruct{
+ char *dir;
+ char *name;
+ };
+
+ bankstruct banks[MAX_NUM_BANKS];
+
private:
- //it adds a filename to the bank
- //if pos is -1 it try to find a position
- //returns -1 if the bank is full, or 0 if the instrument was added
- int addtobank(int pos,const char* filename,const char* name);
-
+ //it adds a filename to the bank
+ //if pos is -1 it try to find a position
+ //returns -1 if the bank is full, or 0 if the instrument was added
+ int addtobank(int pos,const char* filename,const char* name);
+
void deletefrombank(int pos);
- void clearbank();
-
- char defaultinsname[PART_MAX_NAME_LEN];
- char tmpinsname[BANK_SIZE][PART_MAX_NAME_LEN+20];//this keeps the numbered names
-
- struct ins_t{
- bool used;
- char name[PART_MAX_NAME_LEN+1];
- char *filename;
- struct{
- bool PADsynth_used;
- } info;
- }ins[BANK_SIZE];
-
- char *dirname;
-
- void scanrootdir(char *rootdir);//scans a root dir for banks
+ void clearbank();
+
+ char defaultinsname[PART_MAX_NAME_LEN];
+ char tmpinsname[BANK_SIZE][PART_MAX_NAME_LEN+20];//this keeps the numbered names
+
+ struct ins_t{
+ bool used;
+ char name[PART_MAX_NAME_LEN+1];
+ char *filename;
+ struct{
+ bool PADsynth_used;
+ } info;
+ }ins[BANK_SIZE];
+
+ char *dirname;
+
+ void scanrootdir(char *rootdir);//scans a root dir for banks
};
#endif
diff --git a/src/Misc/Config.h b/src/Misc/Config.h
@@ -26,9 +26,12 @@
#define MAX_STRING_SIZE 4000
#define MAX_BANK_ROOT_DIRS 100
+/**Configuration file functions*/
class Config{
public:
+ /** Constructor*/
Config();
+ /** Destructor*/
~Config();
struct {
char *LinuxOSSWaveOutDev,*LinuxOSSSeqInDev;
diff --git a/src/Misc/Dump.h b/src/Misc/Dump.h
@@ -24,20 +24,39 @@
#include <stdio.h>
+/**Object used to dump the notes into a text file
+ * \todo see if this object should have knowledge about the file
+ * that it will write to
+ * \todo upgrade from stdio to iostream*/
class Dump{
public:
- Dump();
- ~Dump();
- void startnow();
- void inctick();
-
- void dumpnote(char chan,char note, char vel);
- void dumpcontroller(char chan,unsigned int type,int par);
+ /**Constructor*/
+ Dump();
+ /**Destructor
+ * Closes the dumpfile*/
+ ~Dump();
+ /**Open dumpfile and prepare it for dumps
+ * \todo see if this fits better in the constructor*/
+ void startnow();
+ /**Tick the timestamp*/
+ void inctick();
+ /**Dump Note to dumpfile
+ * @param chan The channel of the note
+ * @param note The note
+ * @param vel The velocity of the note*/
+ void dumpnote(char chan,char note, char vel);
+ /** Dump the Controller
+ * @param chan The channel of the Controller
+ * @param type The type
+ * @param par The value of the controller
+ * \todo figure out what type is exactly meaning*/
+ void dumpcontroller(char chan,unsigned int type,int par);
private:
- FILE *file;
- int tick;
- int k;
- int keyspressed;
+ FILE *file;
+ int tick;
+ int k;//This appears to be a constant used to flush the file
+ //periodically when JACK is used
+ int keyspressed;
};
#endif
diff --git a/src/Misc/LASHClient.h b/src/Misc/LASHClient.h
@@ -7,20 +7,29 @@
/** This class wraps up some functions for initialising and polling
- the LASH daemon. */
+ * the LASH daemon.
+ * \todo fix indentation nonconformism
+ * \todo see why there is no destructor*/
class LASHClient {
public:
-
+ /**Enum to represent the LASH events that are currently handled*/
enum Event {
Save,
Restore,
Quit,
NoEvent
};
-
+
+ /** Constructor
+ * @param argc number of arguments
+ * @param argv the text arguments*/
LASHClient(int* argc, char*** argv);
+ /**set the ALSA id
+ * @param id new ALSA id*/
void setalsaid(int id);
+ /**Set the JACK name
+ * @param name the new name*/
void setjackname(const char* name);
Event checkevents(std::string& filename);
void confirmevent(Event event);
diff --git a/src/Misc/Master.h b/src/Misc/Master.h
@@ -36,32 +36,36 @@
#include "XMLwrapper.h"
extern Dump dump;
+/** It sends Midi Messages to Parts, receives samples from parts,
+ * process them with system/insertion effects and mix them */
class Master{
- public:
+ public:
+ /** Constructor*/
Master();
+ /** Destructor*/
~Master();
- //saves all settings to a XML file
- //returns 0 for ok or <0 if there is an error
+ /**Saves all settings to a XML file
+ * @return 0 for ok or <0 if there is an error*/
int saveXML(char *filename);
- //this adds the parameters to the XML data
+ /**This adds the parameters to the XML data*/
void add2XML(XMLwrapper *xml);
void defaults();
- //loads all settings from a XML file
- //returns 0 for ok or -1 if there is an error
+ /**loads all settings from a XML file
+ * @return 0 for ok or -1 if there is an error*/
int loadXML(char *filename);
void applyparameters();
void getfromXML(XMLwrapper *xml);
- //get all data to a newly allocated array (used for VST)
- //returns the datasize
+ /**get all data to a newly allocated array (used for VST)
+ * @return the datasize*/
int getalldata(char **data);
- //put all data from the *data array to zynaddsubfx parameters (used for VST)
+ /**put all data from the *data array to zynaddsubfx parameters (used for VST)*/
void putalldata(char *data,int size);
@@ -76,15 +80,15 @@ class Master{
void ShutUp();
int shutup;
- //Audio Output
+ /**Audio Output*/
void AudioOut(REALTYPE *outl,REALTYPE *outr);
- //Audio Output (for callback mode). This allows the program to be controled by an external program
+ /**Audio Output (for callback mode). This allows the program to be controled by an external program*/
void GetAudioOutSamples(int nsamples,int samplerate,REALTYPE *outl,REALTYPE *outr);
void partonoff(int npart,int what);
- //parts
+ /**parts \todo see if this can be made to be dynamic*/
Part *part[NUM_MIDI_PARTS];
//parameters
@@ -152,7 +156,7 @@ class Master{
REALTYPE ksoundbuffersamplelow;//this is used for resampling (eg. if Jack samplerate!= SAMPLE_RATE)
REALTYPE oldsamplel,oldsampler;//this is used for resampling
- //Theese are called by the NoteOn, NoteOff,SetController (which are from external sources like MIDI, Virtual Keyboard)
+ //These are called by the NoteOn, NoteOff,SetController (which are from external sources like MIDI, Virtual Keyboard)
//and are called by internal parts of the program (like sequencer)
void noteon(unsigned char chan,unsigned char note,unsigned char velocity);
void noteoff(unsigned char chan,unsigned char note);
diff --git a/src/Misc/Microtonal.h b/src/Misc/Microtonal.h
@@ -31,81 +31,91 @@
#include <stdio.h>
+
+/**Tuning settings and microtonal capabilities*/
class Microtonal{
public:
- Microtonal();
- ~Microtonal();
- void defaults();
- REALTYPE getnotefreq(int note,int keyshift);
-
-
- //Parameters
- //if the keys are inversed (the pitch is lower to keys from the right direction)
- unsigned char Pinvertupdown;
-
- //the central key of the inversion
- unsigned char Pinvertupdowncenter;
+ /**Constructor*/
+ Microtonal();
+ /**Destructor*/
+ ~Microtonal();
+ void defaults();
+ /**Calculates the frequency for a given note
+ */
+ REALTYPE getnotefreq(int note,int keyshift);
- //0 for 12 key temperate scale, 1 for microtonal
- unsigned char Penabled;
-
- //the note of "A" key
- unsigned char PAnote;
-
- //the frequency of the "A" note
- REALTYPE PAfreq;
- //if the scale is "tuned" to a note, you can tune to other note
- unsigned char Pscaleshift;
-
- //first and last key (to retune)
- unsigned char Pfirstkey;
- unsigned char Plastkey;
-
- //The middle note where scale degree 0 is mapped to
- unsigned char Pmiddlenote;
-
- //Map size
- unsigned char Pmapsize;
-
- //Mapping ON/OFF
- unsigned char Pmappingenabled;
- //Mapping (keys)
- short int Pmapping[128];
-
- unsigned char Pglobalfinedetune;
-
- // Functions
- unsigned char getoctavesize();
- void tuningtoline(int n,char *line,int maxn);
- int loadscl(const char *filename);//load the tunnings from a .scl file
- int loadkbm(const char *filename);//load the mapping from .kbm file
- int texttotunings(const char *text);
- void texttomapping(const char *text);
- unsigned char *Pname;
- unsigned char *Pcomment;
-
- void add2XML(XMLwrapper *xml);
- void getfromXML(XMLwrapper *xml);
- int saveXML(char *filename);
- int loadXML(char *filename);
+ //Parameters
+ /**if the keys are inversed (the pitch is lower to keys from the right direction) \todo figure out why this is not a bool*/
+ unsigned char Pinvertupdown;
+
+ /**the central key of the inversion*/
+ unsigned char Pinvertupdowncenter;
+
+ /**0 for 12 key temperate scale, 1 for microtonal
+ * \todo find one good reason why this is not a bool*/
+ unsigned char Penabled;
+
+ /**the note of "A" key*/
+ unsigned char PAnote;
+
+ /**the frequency of the "A" note*/
+ REALTYPE PAfreq;
+
+ /**if the scale is "tuned" to a note, you can tune to other note*/
+ unsigned char Pscaleshift;
+
+ //first and last key (to retune)
+ unsigned char Pfirstkey;
+ unsigned char Plastkey;
+
+ //The middle note where scale degree 0 is mapped to
+ unsigned char Pmiddlenote;
+
+ //Map size
+ unsigned char Pmapsize;
+
+ //Mapping ON/OFF
+ unsigned char Pmappingenabled;
+ //Mapping (keys)
+ short int Pmapping[128];
+
+ unsigned char Pglobalfinedetune;
+
+ // Functions
+ /** Return the current octave size
+ * \todo why is this not an int?*/
+ unsigned char getoctavesize();
+ void tuningtoline(int n,char *line,int maxn);
+ int loadscl(const char *filename);//load the tunnings from a .scl file
+ int loadkbm(const char *filename);//load the mapping from .kbm file
+ int texttotunings(const char *text);
+ void texttomapping(const char *text);
+ unsigned char *Pname;
+ unsigned char *Pcomment;
+
+ void add2XML(XMLwrapper *xml);
+ void getfromXML(XMLwrapper *xml);
+ int saveXML(char *filename);
+ int loadXML(char *filename);
private:
- int linetotunings(unsigned int nline,const char *line);
- int loadline(FILE *file,char *line);//loads a line from the text file, while ignoring the lines beggining with "!"
- unsigned char octavesize;
- struct {
- unsigned char type;//1 for cents or 2 for division
-
- // the real tuning (eg. +1.05946 for one halftone)
- // or 2.0 for one octave
- REALTYPE tuning;
-
- //the real tunning is x1/x2
- unsigned int x1,x2;
-
- } octave[MAX_OCTAVE_SIZE],tmpoctave[MAX_OCTAVE_SIZE];
-
-};
-
+ int linetotunings(unsigned int nline,const char *line);
+ int loadline(FILE *file,char *line);//loads a line from the text file, while ignoring the lines beggining with "!"
+ unsigned char octavesize;
+ struct {
+ unsigned char type;//1 for cents or 2 for division
+
+ // the real tuning (eg. +1.05946 for one halftone)
+ // or 2.0 for one octave
+ REALTYPE tuning;
+
+ //the real tunning is x1/x2
+ unsigned int x1,x2;
+
+ } octave[MAX_OCTAVE_SIZE],tmpoctave[MAX_OCTAVE_SIZE];
+
+};
+
#endif
+
diff --git a/src/Misc/Part.h b/src/Misc/Part.h
@@ -40,13 +40,19 @@
#include <list> // For the monomemnotes list.
+/** Part implementation*/
class Part{
public:
+ /**Constructor
+ * @param microtonal_ Pointer to the microtonal object
+ * @param fft_ Pointer to the FFTwrapper
+ * @param mutex_ Pointer to the master pthread_mutex_t*/
Part(Microtonal *microtonal_,FFTwrapper *fft_,pthread_mutex_t *mutex_);
+ /**Destructor*/
~Part();
- /* Midi commands implemented */
+ // Midi commands implemented
void NoteOn(unsigned char note,unsigned char velocity,int masterkeyshift);
void NoteOff(unsigned char note);
void AllNotesOff();//panic
@@ -97,9 +103,9 @@ class Part{
void setkeylimit(unsigned char Pkeylimit);
void setkititemstatus(int kititem,int Penabled_);
- unsigned char Penabled;//if the part is enabled
- unsigned char Pvolume;//part volume
- unsigned char Pminkey;//the minimum key that the part receives noteon messages
+ unsigned char Penabled;/**<if the part is enabled*/
+ unsigned char Pvolume;/**<part volume*/
+ unsigned char Pminkey;/**<the minimum key that the part receives noteon messages*/
unsigned char Pmaxkey;//the maximum key that the part receives noteon messages
void setPvolume(char Pvolume);
unsigned char Pkeyshift;//Part keyshift
diff --git a/src/Misc/Stereo.C b/src/Misc/Stereo.C
@@ -0,0 +1,12 @@
+
+template <class T>
+Stereo<T>::Stereo(const T &left, const T &right)
+ :leftChannel(left),rightChannel(right)
+{}
+
+template <class T>
+void Stereo<T>::operator=(const Stereo<T> & nstr)
+{
+ leftChannel=nstr.leftChannel;
+ rightChannel=nstr.rightChannel;
+}
diff --git a/src/Misc/Stereo.h b/src/Misc/Stereo.h
@@ -0,0 +1,40 @@
+/*
+ ZynAddSubFX - a software synthesizer
+
+ Stereo.h - Object for storing a pair of objects
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of version 2 of the GNU General Public License
+ as published by the Free Software Foundation.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License (version 2 or later) for more details.
+
+ You should have received a copy of the GNU General Public License (version 2)
+ along with this program; if not, write to the Free Software Foundation,
+ Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+*/
+#ifndef STEREO_H
+#define STEREO_H
+
+template <class T>
+class Stereo{
+ public:
+ Stereo(const T &left,const T &right);
+ ~Stereo(){};
+
+ void operator=(const Stereo<T> &smp);
+ T &left(){return leftChannel;};
+ T &right(){return rightChannel;};
+ const T &left()const{return leftChannel;};
+ const T &right()const{return rightChannel;};
+ private:
+ T leftChannel;
+ T rightChannel;
+
+};
+#endif
+
+#include "Stereo.C"
diff --git a/src/Misc/Util.h b/src/Misc/Util.h
@@ -37,7 +37,7 @@ bool fileexists(char *filename);
#define N_DETUNE_TYPES 4 //the number of detune types
extern REALTYPE getdetune(unsigned char type,unsigned short int coarsedetune,unsigned short int finedetune);
-extern REALTYPE *denormalkillbuf;//the buffer to add noise in order to avoid denormalisation
+extern REALTYPE *denormalkillbuf;/**<the buffer to add noise in order to avoid denormalisation*/
extern Config config;
diff --git a/src/Output/Recorder.h b/src/Output/Recorder.h
@@ -26,28 +26,30 @@
#include "../globals.h"
#include "WAVaudiooutput.h"
+/**Records sound to a file*/
class Recorder{
public:
- Recorder();
- ~Recorder();
- int preparefile(char *filename_,int overwrite);//returns 1 if the file exists
- void start();
- void stop();
- void pause();
- int recording();
- void triggernow();
- void recordbuffer(REALTYPE *outl,REALTYPE *outr);
-
- /* Status:
- 0 - not ready(no file selected),
- 1 - ready
- 2 - recording */
- int status;
+
+ Recorder();
+ ~Recorder();
+ int preparefile(char *filename_,int overwrite);//returns 1 if the file exists
+ void start();
+ void stop();
+ void pause();
+ int recording();
+ void triggernow();
+ void recordbuffer(REALTYPE *outl,REALTYPE *outr);
+
+ /** Status:
+ * 0 - not ready(no file selected),
+ * 1 - ready
+ * 2 - recording */
+ int status;
private:
- WAVaudiooutput wav;
- short int *recordbuf_16bit;
- int notetrigger;
+ WAVaudiooutput wav;
+ short int *recordbuf_16bit;
+ int notetrigger;
};
#endif
diff --git a/src/Params/ADnoteParameters.h b/src/Params/ADnoteParameters.h
@@ -112,16 +112,16 @@
/***********************************************************/
struct ADnoteVoiceParam{
- /* If the voice is enabled */
+ /** If the voice is enabled */
unsigned char Enabled;
- /* Type of the voice (0=Sound,1=Noise)*/
+ /** Type of the voice (0=Sound,1=Noise)*/
unsigned char Type;
- /* Voice Delay */
+ /** Voice Delay */
unsigned char PDelay;
- /* If the resonance is enabled for this voice */
+ /** If the resonance is enabled for this voice */
unsigned char Presonance;
// What external oscil should I use, -1 for internal OscilSmp&FMSmp
@@ -134,14 +134,14 @@
// filter bypass
unsigned char Pfilterbypass;
- /* Voice oscillator */
+ /** Voice oscillator */
OscilGen *OscilSmp;
/**********************************
* FREQUENCY PARAMETERS *
**********************************/
- /* If the base frequency is fixed to 440 Hz*/
+ /** If the base frequency is fixed to 440 Hz*/
unsigned char Pfixedfreq;
/* Equal temperate (this is used only if the Pfixedfreq is enabled)
@@ -149,13 +149,13 @@
if this parameter is 64, 1 MIDI halftone -> 1 frequency halftone */
unsigned char PfixedfreqET;
- /* Fine detune */
+ /** Fine detune */
unsigned short int PDetune;
- /* Coarse detune + octave */
+ /** Coarse detune + octave */
unsigned short int PCoarseDetune;
- /* Detune type */
+ /** Detune type */
unsigned char PDetuneType;
/* Frequency Envelope */
diff --git a/src/Params/Controller.h b/src/Params/Controller.h
@@ -27,6 +27,7 @@
#include "../globals.h"
#include "../Misc/XMLwrapper.h"
+/**(Midi) Controllers implementation*/
class Controller{
public:
Controller();
@@ -123,26 +124,30 @@ class Controller{
unsigned char receive;
} sustain;
- struct{//Portamento
+ struct{/**<Portamento*/
//parameters
int data;
unsigned char portamento;
- //pitchthresh is the threshold of enabling protamento
- //pitchthreshtype -> enable the portamento only below(0)/above(1) the threshold
- unsigned char receive,time,pitchthresh,pitchthreshtype;
-
- //'up portanemto' means when the frequency is rising (eg: the portamento is from 200Hz to 300 Hz)
- //'down portanemto' means when the frequency is lowering (eg: the portamento is from 300Hz to 200 Hz)
- unsigned char updowntimestretch;//this value represent how the portamento time is reduced
- //0 - for down portamento, 1..63 - the up portamento's time is smaller than the down portamento
- //64 - the portamento time is always the same
- //64-126 - the down portamento's time is smaller than the up portamento
- //127 - for upper portamento
-
- REALTYPE freqrap;//this value is used to compute the actual portamento
- int noteusing;//this is used by the Part:: for knowing which note uses the portamento
- int used;//if a the portamento is used by a note
+ unsigned char receive,time;
+ /**pitchthresh is the threshold of enabling protamento \todo see if this should be an int*/
+ unsigned char pitchthresh;
+ /**pitchthreshtype -> enable the portamento only below(0)/above(1) the threshold*/
+ unsigned char pitchthreshtype;
+
+ /**this value represent how the portamento time is reduced
+ * 0 - for down portamento, 1..63 - the up portamento's time is smaller than the down portamento
+ * 64 - the portamento time is always the same
+ * 64-126 - the down portamento's time is smaller than the up portamento
+ * 127 - for upper portamento
+ * 'up portanemto' means when the frequency is rising (eg: the portamento is from 200Hz to 300 Hz)
+ * 'down portanemto' means when the frequency is lowering (eg: the portamento is from 300Hz to 200 Hz)
+ */
+ unsigned char updowntimestretch;
+
+ REALTYPE freqrap;/**<this value is used to compute the actual portamento*/
+ int noteusing;/**this is used by the Part for knowing which note uses the portamento*/
+ int used;/**<if a the portamento is used by a note \todo see if this can be a bool*/
//internal data
REALTYPE x,dx;//x is from 0.0 (start portamento) to 1.0 (finished portamento), dx is x increment
REALTYPE origfreqrap;// this is used for computing oldfreq value from x
@@ -161,7 +166,7 @@ class Controller{
} resonancebandwidth;
- /* RPN and NPRPN */
+ /** RPN and NPRPN */
struct{//nrpn
int parhi,parlo;
int valhi,vallo;
@@ -171,9 +176,5 @@ class Controller{
private:
};
-
-
-
-
#endif
diff --git a/src/Params/EnvelopeParams.C b/src/Params/EnvelopeParams.C
@@ -223,5 +223,3 @@ void EnvelopeParams::store2defaults(){
DR_val=PR_val;
};
-
-
diff --git a/src/Params/EnvelopeParams.h b/src/Params/EnvelopeParams.h
@@ -47,7 +47,7 @@ class EnvelopeParams:public Presets{
REALTYPE getdt(char i);
- /* Parametrii MIDI */
+ /* MIDI Parameters */
unsigned char Pfreemode;//1 daca este in modul free sau 0 daca este in mod ADSR,ASR,...
unsigned char Penvpoints;
unsigned char Penvsustain;//127 pentru dezactivat
@@ -81,6 +81,5 @@ class EnvelopeParams:public Presets{
};
-
#endif
diff --git a/src/Params/LFOParams.h b/src/Params/LFOParams.h
@@ -33,18 +33,19 @@ class LFOParams:public Presets{
void add2XML(XMLwrapper *xml);
void defaults();
+ /**Loads the LFO from the xml*/
void getfromXML(XMLwrapper *xml);
- /* Parametrii MIDI */
- REALTYPE Pfreq; // frequency
- unsigned char Pintensity; // intensity
- unsigned char Pstartphase;// start phase (0=random)
- unsigned char PLFOtype; // LFO type (sin,triangle,square,ramp,...)
- unsigned char Prandomness;// randomness (0=off)
- unsigned char Pfreqrand; // frequency randomness (0=off)
- unsigned char Pdelay; // delay (0=off)
- unsigned char Pcontinous; // 1 if LFO is continous
- unsigned char Pstretch; // how the LFO is "stretched" according the note frequency (64=no stretch)
+ /* MIDI Parameters*/
+ REALTYPE Pfreq; /**<frequency*/
+ unsigned char Pintensity; /**<intensity*/
+ unsigned char Pstartphase;/**<start phase (0=random)*/
+ unsigned char PLFOtype; /**<LFO type (sin,triangle,square,ramp,...)*/
+ unsigned char Prandomness;/**<randomness (0=off)*/
+ unsigned char Pfreqrand; /**<frequency randomness (0=off)*/
+ unsigned char Pdelay; /**<delay (0=off)*/
+ unsigned char Pcontinous; /**<1 if LFO is continous*/
+ unsigned char Pstretch; /**<how the LFO is "stretched" according the note frequency (64=no stretch)*/
int fel;//what kind is the LFO (0 - frequency, 1 - amplitude, 2 - filter)
static int time;//is used by Pcontinous parameter
@@ -60,5 +61,4 @@ class LFOParams:public Presets{
};
-
#endif
diff --git a/src/Params/Presets.h b/src/Params/Presets.h
@@ -27,12 +27,13 @@
#include "PresetsStore.h"
+/**Presets and Clipboard management*/
class Presets{
public:
Presets();
virtual ~Presets();
- void copy(const char *name);//if name==NULL, the clipboard is used
+ void copy(const char *name);/**<if name==NULL, the clipboard is used*/
void paste(int npreset);//npreset==0 for clipboard
bool checkclipboardtype();
void deletepreset(int npreset);
diff --git a/src/Samples/AuSample.C b/src/Samples/AuSample.C
@@ -0,0 +1,8 @@
+#include "AuSample.h"
+
+AuSample::AuSample(const int &length)
+ : Sample(length){}
+
+AuSample::AuSample(float *input,const int &length)
+ : Sample(input,length){}
+
diff --git a/src/Samples/AuSample.h b/src/Samples/AuSample.h
@@ -0,0 +1,34 @@
+/*
+ ZynAddSubFX - a software synthesizer
+
+ AuSample.h - Object for storing information on audio samples (for one channel)
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of version 2 of the GNU General Public License
+ as published by the Free Software Foundation.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License (version 2 or later) for more details.
+
+ You should have received a copy of the GNU General Public License (version 2)
+ along with this program; if not, write to the Free Software Foundation,
+ Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+*/
+#ifndef AUSAMPLE_H
+#define AUSAMPLE_H
+
+#include "Sample.h"
+#include "FqSample.h"
+
+class AuSample : public Sample
+{
+ public:
+ AuSample(const int &length);
+ AuSample(float *input,const int &length);
+ FqSample getFqSample();/**\todo implement this*/
+
+};
+#endif
+
diff --git a/src/Samples/FqSample.C b/src/Samples/FqSample.C
@@ -0,0 +1,13 @@
+#include "FqSample.h"
+
+FqSample::FqSample(const int &length)
+ :Sample(length)
+{}
+
+FqSample::FqSample(float *input,const int &length)
+ : Sample(input,length)
+{}
+
+FqSample::~FqSample()
+{}
+
diff --git a/src/Samples/FqSample.h b/src/Samples/FqSample.h
@@ -0,0 +1,35 @@
+/*
+ ZynAddSubFX - a software synthesizer
+
+ Sample.h - Object for storing information on samples
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of version 2 of the GNU General Public License
+ as published by the Free Software Foundation.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License (version 2 or later) for more details.
+
+ You should have received a copy of the GNU General Public License (version 2)
+ along with this program; if not, write to the Free Software Foundation,
+ Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+*/
+#ifndef MONOSAMPLE_H
+#define MONOSAMPLE_H
+
+#include "FqSample.h"
+#include "Sample.h"
+
+class FqSample : public Sample
+{
+ public:
+ FqSample(const int &length);
+ FqSample(float *input,const int &length);
+ ~FqSample();
+ //FqSample &operator=(const FqSample &smp);
+ //float *dontuse(){return buffer;};
+};
+#endif
+
diff --git a/src/Samples/Makefile b/src/Samples/Makefile
@@ -0,0 +1,14 @@
+include ../Makefile.inc
+
+objects=Sample.o AuSample.o FqSample.o
+
+
+all: $(objects)
+
+-include ../Make.deps
+
+.PHONY : clean
+clean:
+ rm -f $(objects)
+ rm -f makeinclude.deps
+
diff --git a/src/Samples/Sample.C b/src/Samples/Sample.C
@@ -0,0 +1,63 @@
+#include "Sample.h"
+
+Sample::Sample(const Sample &smp)
+ : bufferSize(smp.bufferSize)
+{
+ buffer=new float[bufferSize];
+ for(int i=0;i<bufferSize;++i)
+ *(i+buffer)=*(i+smp.buffer);
+}
+
+Sample::Sample(const int &length)
+ : bufferSize(length)
+{
+ if(length<1)
+ bufferSize=1;
+ buffer=new float[bufferSize];
+ clear();
+}
+
+Sample::Sample(float *input,const int &length)
+ : bufferSize(length)
+{
+ if(length>0){
+ buffer=new float[length];
+ for(int i=0;i<length;++i)
+ *(buffer+i)=*(input+i);
+ }
+ else{
+ buffer=new float[1];
+ bufferSize=1;
+ *buffer=0;
+ }
+}
+
+Sample::~Sample()
+{
+ delete[] buffer;
+}
+
+void Sample::clear()
+{
+ for(int i=0;i<bufferSize;++i)
+ *(i+buffer)=0;
+}
+
+void Sample::operator=(const Sample &smp)
+{
+ /**\todo rewrite to be less repetitive*/
+ if(bufferSize==smp.bufferSize)
+ {
+ for(int i=0;i<bufferSize;++i)
+ *(i+buffer)=*(i+smp.buffer);
+ }
+ else
+ {
+ delete[] buffer;
+ buffer=new float[smp.bufferSize];
+ bufferSize=smp.bufferSize;
+ for(int i=0;i<bufferSize;++i)
+ *(i+buffer)=*(i+smp.buffer);
+ }
+}
+
diff --git a/src/Samples/Sample.h b/src/Samples/Sample.h
@@ -0,0 +1,54 @@
+/*
+ ZynAddSubFX - a software synthesizer
+
+ Sample.h - Object for storing information on samples
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of version 2 of the GNU General Public License
+ as published by the Free Software Foundation.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License (version 2 or later) for more details.
+
+ You should have received a copy of the GNU General Public License (version 2)
+ along with this program; if not, write to the Free Software Foundation,
+ Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+*/
+#ifndef SAMPLE_H
+#define SAMPLE_H
+
+/**
+ * Base Class for Samples
+ */
+class Sample{
+ public:
+ Sample(const Sample &smp);
+ Sample(const int &length);
+ Sample(float *input,const int &length);
+ ~Sample();
+ /**Fills the buffer with zeros*/
+ void clear();
+ /**States the size of the buffer
+ * @return the size of the buffer*/
+ int size() const {return bufferSize;};
+ /**Provides the indexing operator for non const Samples*/
+ float &operator[](int index){return *(buffer+index%bufferSize);};
+ /**Provides the indexing operator for const Samples*/
+ const float &operator[](int index)const{return *(buffer+index%bufferSize);};
+ /**Provides the assignment operator*/
+ void operator=(const Sample &smp);
+ /**Provides direct access to the buffer to allow for transition
+ *
+ * This method should be removed to ensure encapsulation once
+ * it is integrated into the code*/
+ float *dontuse(){return buffer;};
+ private:
+ int bufferSize;
+ float *buffer;
+
+
+};
+#endif
+
diff --git a/src/Samples/StereoSample.C b/src/Samples/StereoSample.C
@@ -0,0 +1,29 @@
+#include "StereoSample.h"
+
+StereoSample::StereoSample(int length)
+ :leftSample(length),rightSample(length)
+{std::cout<<"StereoSample\n";}
+
+void StereoSample::clear()
+{
+ std::cout<<"StereoSample::Clear\n";
+ leftSample.clear();
+ rightSample.clear();
+}
+
+int StereoSample::size() const
+{
+ return(leftSample.size());
+}
+
+float & StereoSample::operator[](const int &index)
+{
+ return(leftSample[index]);
+}
+
+StereoSample & StereoSample::operator=(const StereoSample & smp)
+{
+ std::cout<<"StereoSample::operator=\n";
+ leftSample=smp.leftSample;
+ rightSample=smp.rightSample;
+}
diff --git a/src/Samples/StereoSample.h b/src/Samples/StereoSample.h
@@ -0,0 +1,44 @@
+/*
+ ZynAddSubFX - a software synthesizer
+
+ Sample.h - Object for storing information on samples
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of version 2 of the GNU General Public License
+ as published by the Free Software Foundation.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License (version 2 or later) for more details.
+
+ You should have received a copy of the GNU General Public License (version 2)
+ along with this program; if not, write to the Free Software Foundation,
+ Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+*/
+#ifndef STEREOSAMPLE_H
+#define STEREOSAMPLE_H
+
+#include <iostream>
+#include "Sample.h"
+#include "MonoSample.h"
+
+class StereoSample:public Sample{
+ public:
+ StereoSample(int length);
+ StereoSample(const MonoSample &left_,const MonoSample &right_);
+ ~StereoSample(){std::cout<<"~StereoSample\n";};
+ void clear();
+ int size() const;
+
+ float &operator[](const int &index);
+ StereoSample &operator=(const StereoSample &smp);
+ MonoSample &left(){return leftSample;};
+ MonoSample &right(){return rightSample;};
+ private:
+ MonoSample leftSample;
+ MonoSample rightSample;
+
+};
+#endif
+
diff --git a/src/Seq/MIDIEvents.h b/src/Seq/MIDIEvents.h
@@ -62,5 +62,5 @@ class MIDIEvents{
};
-
#endif
+
diff --git a/src/Seq/MIDIFile.h b/src/Seq/MIDIFile.h
@@ -26,12 +26,15 @@
#include "../globals.h"
#include "MIDIEvents.h"
+/**MIDI file loader*/
class MIDIFile{
public:
MIDIFile();
~MIDIFile();
- //returns -1 if there is an error, otherwise 0
+ /**Loads the given file
+ * @param filename The name of the file to load
+ * @return -1 if there is an error, otherwise 0*/
int loadfile(const char *filename);
//returns -1 if there is an error, otherwise 0
@@ -88,3 +91,4 @@ class MIDIFile{
};
#endif
+
diff --git a/src/Seq/Sequencer.C b/src/Seq/Sequencer.C
@@ -163,3 +163,4 @@ void Sequencer::setplayspeed(int speed){
playspeed=speed;
realplayspeed=pow(10.0,speed/128.0);
};
+
diff --git a/src/Seq/Sequencer.h b/src/Seq/Sequencer.h
@@ -26,22 +26,29 @@
#include "MIDIEvents.h"
#include "MIDIFile.h"
+/**The Sequencer*/
class Sequencer:public MIDIEvents{
public:
+ /**Constructor*/
Sequencer();
+ /**Destructor
+ * \todo investigate deletelist, it looks suspicious*/
~Sequencer();
- //theese functions are called by the master and are ignored if the recorder/player are stopped
+ //these functions are called by the master and are ignored if the recorder/player are stopped
void recordnote(char chan, char note, char vel);
void recordcontroller(char chan,unsigned int type,int par);
- //this is only for player
- //it returns 1 if this must be called at least once more
- //it returns 0 if there are no more notes for the current time
- //or -1 if there is no note
+ /**Gets an event \todo better description
+ *
+ * this is only for player
+ * @return 1 if this must be called at least once more
+ * 0 if there are no more notes for the current time
+ * -1 if there are no notes*/
int getevent(char ntrack, int *midich,int *type,int *par1, int *par2);
- //returns 0 if ok or -1 if there is a error loading file
+ /**Imports a given midifile
+ * @return 0 if ok or -1 if there is a error loading file*/
int importmidifile(const char *filename);
void startplay();
@@ -61,8 +68,8 @@ class Sequencer:public MIDIEvents{
double abs;//the time from the begining of the track
double rel;//the time difference between the last and the current event
double last;//the time of the last event (absolute, since 1 Jan 1970)
- //theese must be double, because the float's precision is too low
- //and all theese represents the time in seconds
+ //these must be double, because the float's precision is too low
+ //and all these represent the time in seconds
} playtime[NUM_MIDI_TRACKS];
void resettime(timestruct *t);
@@ -79,6 +86,5 @@ class Sequencer:public MIDIEvents{
};
-
#endif
diff --git a/src/Synth/ADnote.h b/src/Synth/ADnote.h
@@ -32,48 +32,49 @@
//Globals
-//FM amplitude tune
+/**FM amplitude tune*/
#define FM_AMP_MULTIPLIER 14.71280603
#define OSCIL_SMP_EXTRA_SAMPLES 5
+/**The "additive" synthesizer*/
class ADnote{ //ADDitive note
- public:
- ADnote(ADnoteParameters *pars,Controller *ctl_,REALTYPE freq,REALTYPE velocity,int portamento_,int midinote_,bool besilent);//(gf)Added the besilent parameter to tell it to start silent (if true).
- ~ADnote();
+ public:
+ ADnote(ADnoteParameters *pars,Controller *ctl_,REALTYPE freq,REALTYPE velocity,int portamento_,int midinote_,bool besilent);//(gf)Added the besilent parameter to tell it to start silent (if true).
+ ~ADnote();
- void ADlegatonote(REALTYPE freq, REALTYPE velocity, int portamento_, int midinote_, bool externcall);
+ void ADlegatonote(REALTYPE freq, REALTYPE velocity, int portamento_, int midinote_, bool externcall);
- int noteout(REALTYPE *outl,REALTYPE *outr);
- void relasekey();
- int finished();
+ int noteout(REALTYPE *outl,REALTYPE *outr);
+ void relasekey();
+ int finished();
- /*ready - this is 0 if it is not ready (the parameters has to be computed)
- or other value if the parameters has been computed and if it is ready to output*/
- char ready;
+ /*ready - this is 0 if it is not ready (the parameters has to be computed)
+ or other value if the parameters has been computed and if it is ready to output*/
+ char ready;
- private:
+ private:
- void setfreq(int nvoice,REALTYPE freq);
- void setfreqFM(int nvoice,REALTYPE freq);
- void computecurrentparameters();
- void initparameters();
- void KillVoice(int nvoice);
- void KillNote();
- inline REALTYPE getvoicebasefreq(int nvoice);
- inline REALTYPE getFMvoicebasefreq(int nvoice);
- inline void ComputeVoiceOscillator_LinearInterpolation(int nvoice);
- inline void ComputeVoiceOscillator_CubicInterpolation(int nvoice);
- inline void ComputeVoiceOscillatorMorph(int nvoice);
- inline void ComputeVoiceOscillatorRingModulation(int nvoice);
- inline void ComputeVoiceOscillatorFrequencyModulation(int nvoice,int FMmode);//FMmode=0 for phase modulation, 1 for Frequency modulation
-// inline void ComputeVoiceOscillatorFrequencyModulation(int nvoice);
- inline void ComputeVoiceOscillatorPitchModulation(int nvoice);
-
- inline void ComputeVoiceNoise(int nvoice);
-
- inline void fadein(REALTYPE *smps);
+ void setfreq(int nvoice,REALTYPE freq);
+ void setfreqFM(int nvoice,REALTYPE freq);
+ void computecurrentparameters();
+ void initparameters();
+ void KillVoice(int nvoice);
+ void KillNote();
+ inline REALTYPE getvoicebasefreq(int nvoice);
+ inline REALTYPE getFMvoicebasefreq(int nvoice);
+ inline void ComputeVoiceOscillator_LinearInterpolation(int nvoice);
+ inline void ComputeVoiceOscillator_CubicInterpolation(int nvoice);
+ inline void ComputeVoiceOscillatorMorph(int nvoice);
+ inline void ComputeVoiceOscillatorRingModulation(int nvoice);
+ inline void ComputeVoiceOscillatorFrequencyModulation(int nvoice,int FMmode);//FMmode=0 for phase modulation, 1 for Frequency modulation
+ // inline void ComputeVoiceOscillatorFrequencyModulation(int nvoice);
+ inline void ComputeVoiceOscillatorPitchModulation(int nvoice);
+
+ inline void ComputeVoiceNoise(int nvoice);
+
+ inline void fadein(REALTYPE *smps);
//GLOBALS
diff --git a/src/Synth/Envelope.h b/src/Synth/Envelope.h
@@ -27,14 +27,22 @@
#include "../globals.h"
#include "../Params/EnvelopeParams.h"
+/**Implementation of a general Envelope*/
class Envelope{
public:
+
+ /**Constructor*/
Envelope(EnvelopeParams *envpars,REALTYPE basefreq);
+ /**Destructor*/
~Envelope();
void relasekey();
REALTYPE envout();
REALTYPE envout_dB();
- int finished();//returns 1 if the envelope is finished
+ /**Determines the status of the Envelope
+ *
+ *\todo see if this can be changed to use a boolean
+ * @return returns 1 if the envelope is finished*/
+ int finished();
private:
int envpoints;
int envsustain;//"-1" means disabled
@@ -45,8 +53,8 @@ private:
int currentpoint; //current envelope point (starts from 1)
int forcedrelase;
- char keyreleased; //if the key was released
- char envfinish;
+ char keyreleased; //if the key was released /** \todo figure out WHY IS THIS A CHAR*/
+ char envfinish; /** \todo figure out WHY IS THIS A CHAR*/
REALTYPE t; // the time from the last point
REALTYPE inct;// the time increment
REALTYPE envoutval;//used to do the forced release
@@ -55,4 +63,3 @@ private:
#endif
-
diff --git a/src/Synth/LFO.h b/src/Synth/LFO.h
@@ -26,10 +26,16 @@
#include "../globals.h"
#include "../Params/LFOParams.h"
-
+/**Class for creating Low Frequency Ocillators*/
class LFO{
public:
+ /**Constructor
+ *
+ * @param lfopars pointer to a LFOParams object
+ * @param basefreq base frequency of LFO
+ */
LFO(LFOParams *lfopars, REALTYPE basefreq);
+ /**Deconstructor*/
~LFO();
REALTYPE lfoout();
REALTYPE amplfoout();
@@ -40,6 +46,7 @@ class LFO{
REALTYPE lfointensity;
REALTYPE lfornd,lfofreqrnd;
REALTYPE lfodelay;
+ /**\todo see if an enum would be better here*/
char lfotype;
int freqrndenabled;
@@ -48,5 +55,5 @@ class LFO{
};
-
#endif
+
diff --git a/src/Synth/OscilGen.h b/src/Synth/OscilGen.h
@@ -34,10 +34,10 @@ class OscilGen:public Presets{
OscilGen(FFTwrapper *fft_,Resonance *res_);
~OscilGen();
- //computes the full spectrum of oscil from harmonics,phases and basefunc
+ /**computes the full spectrum of oscil from harmonics,phases and basefunc*/
void prepare();
- //do the antialiasing(cut off higher freqs.),apply randomness and do a IFFT
+ /**do the antialiasing(cut off higher freqs.),apply randomness and do a IFFT*/
short get(REALTYPE *smps,REALTYPE freqHz);//returns where should I start getting samples, used in block type randomness
short get(REALTYPE *smps,REALTYPE freqHz,int resonance);
//if freqHz is smaller than 0, return the "un-randomized" sample for UI
@@ -47,7 +47,8 @@ class OscilGen:public Presets{
//called by UI
void getspectrum(int n,REALTYPE *spc,int what);//what=0 pt. oscil,1 pt. basefunc
void getcurrentbasefunction(REALTYPE *smps);
- void useasbase();//convert oscil to base function
+ /**convert oscil to base function*/
+ void useasbase();
void add2XML(XMLwrapper *xml);
void defaults();
@@ -57,19 +58,19 @@ class OscilGen:public Presets{
//Parameters
- /*
- The hmag and hphase starts counting from 0, so the first harmonic(1) has the index 0,
- 2-nd harmonic has index 1, ..the 128 harminic has index 127
- */
+ /**
+ * The hmag and hphase starts counting from 0, so the first harmonic(1) has the index 0,
+ * 2-nd harmonic has index 1, ..the 128 harminic has index 127
+ */
unsigned char Phmag[MAX_AD_HARMONICS],Phphase[MAX_AD_HARMONICS];//the MIDI parameters for mag. and phases
- /*The Type of magnitude:
- 0 - Linear
- 1 - dB scale (-40)
- 2 - dB scale (-60)
- 3 - dB scale (-80)
- 4 - dB scale (-100)*/
+ /**The Type of magnitude:
+ * 0 - Linear
+ * 1 - dB scale (-40)
+ * 2 - dB scale (-60)
+ * 3 - dB scale (-80)
+ * 4 - dB scale (-100)*/
unsigned char Phmagtype;
unsigned char Pcurrentbasefunc;//The base function used - 0=sin, 1=...
diff --git a/src/Synth/PADnote.h b/src/Synth/PADnote.h
@@ -29,6 +29,7 @@
#include "../DSP/Filter.h"
#include "../Params/Controller.h"
+/**The "pad" synthesizer*/
class PADnote{
public:
PADnote(PADnoteParameters *parameters, Controller *ctl_,REALTYPE freq, REALTYPE velocity, int portamento_, int midinote, bool besilent);
diff --git a/src/Tests/SampleTest.h b/src/Tests/SampleTest.h
@@ -0,0 +1,56 @@
+#include <cxxtest/TestSuite.h>
+#include "../Samples/AuSample.h"
+
+class SampleTest : public CxxTest::TestSuite
+{
+ public:
+ void testInit()
+ {
+ AuSample smp(10);
+ TS_ASSERT_EQUALS(smp.size(),10);
+ for(int i=0;i<20;++i)
+ TS_ASSERT_EQUALS(smp[i],0.0);
+ }
+
+ void testAssign()
+ {
+ AuSample smp(3);
+ smp[0]=0;
+ smp[1]=1;
+ smp[2]=2;
+ AuSample nsmp(40);
+ nsmp=smp;
+ TS_ASSERT_EQUALS(smp.size(),nsmp.size());
+ for(int i=0;i<29;++i)
+ TS_ASSERT_EQUALS(smp[i],nsmp[i]);
+ }
+ void testBounds()
+ {
+ AuSample smp(0);
+ TS_ASSERT(smp.size()!=0);
+ }
+
+ void testAllocDealloc()
+ {
+ float * fl=new float[50];
+ for(int i=0;i<50;++i)
+ *(fl+i)=i;
+ AuSample smp(2);
+ smp = AuSample(fl, 50);
+ delete [] fl;
+ for(int i=0;i<50;++i)
+ TS_ASSERT_DELTA(smp[i],i,0.001);
+ smp = AuSample(3);
+ }
+
+ void testClear()
+ {
+ AuSample smp(50);
+ for(int i=0;i<50;++i)
+ smp[i]=10;
+ smp.clear();
+ for(int i=0;i<50;++i)
+ TS_ASSERT_EQUALS(smp[i],0);
+ }
+
+};
diff --git a/src/Tests/make.sh b/src/Tests/make.sh
@@ -0,0 +1,2 @@
+cxxtestgen.py --error-printer -o runner.cpp SampleTest.h
+g++ -g -o runner runner.cpp ../Samples/AuSample.o ../Samples/Sample.o
diff --git a/src/globals.h b/src/globals.h
@@ -35,10 +35,10 @@ struct FFTFREQS{
extern void newFFTFREQS(FFTFREQS *f,int size);
extern void deleteFFTFREQS(FFTFREQS *f);
-// Sampling rate
+/**Sampling rate*/
extern int SAMPLE_RATE;
-/*
+/**
* The size of a sound buffer (or the granularity)
* All internal transfer of sound data use buffer of this size
* All parameters are constant during this period of time, exception
@@ -49,21 +49,21 @@ extern int SAMPLE_RATE;
extern int SOUND_BUFFER_SIZE;
-/*
+/**
* The size of ADnote Oscillator
* Decrease this => poor quality
* Increase this => CPU requirements gets high (only at start of the note)
*/
extern int OSCIL_SIZE;
-/*
+/**
* The number of harmonics of additive synth
* This must be smaller than OSCIL_SIZE/2
*/
#define MAX_AD_HARMONICS 128
-/*
+/**
* The number of harmonics of substractive
*/
#define MAX_SUB_HARMONICS 64
diff --git a/src/main.C b/src/main.C
@@ -20,10 +20,8 @@
*/
-#include <math.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include <time.h>
+#include <stdio.h>//remove once iostream is used
+#include <iostream>
#include <unistd.h>
#include <pthread.h>
@@ -485,7 +483,7 @@ int main(int argc, char *argv[]){
OSCIL_SIZE=tmp;
if (OSCIL_SIZE<MAX_AD_HARMONICS*2) OSCIL_SIZE=MAX_AD_HARMONICS*2;
OSCIL_SIZE=(int) pow(2,ceil(log (OSCIL_SIZE-1.0)/log(2.0)));
- if (tmp!=OSCIL_SIZE) fprintf(stderr,"\nOSCIL_SIZE is wrong (must me 2^n) or too small. Adjusting to %d.\n",OSCIL_SIZE);
+ if (tmp!=OSCIL_SIZE) fprintf(stderr,"\nOSCIL_SIZE is wrong (must be 2^n) or too small. Adjusting to %d.\n",OSCIL_SIZE);
break;
case 'S':swaplr=1;
break;