ZynAddSubFX: resynced with upstream (version 2.4.1)
There have been some major updates with ZynAddSubFX. Completely resynced whole source tree up to version 2.4.1.
This commit is contained in:
@@ -59,7 +59,6 @@ set(ZASF_CORE_LIBS
|
||||
zynaddsubfx_params
|
||||
zynaddsubfx_dsp
|
||||
zynaddsubfx_samples
|
||||
zynaddsubfx_controls
|
||||
)
|
||||
|
||||
macro(unit_test NAME CXX_FILE FILES)
|
||||
@@ -67,7 +66,6 @@ endmacro(unit_test)
|
||||
|
||||
add_subdirectory(src/Misc)
|
||||
add_subdirectory(src/Input)
|
||||
add_subdirectory(src/Controls)
|
||||
add_subdirectory(src/Synth)
|
||||
add_subdirectory(src/Output)
|
||||
add_subdirectory(src/Seq)
|
||||
@@ -75,6 +73,7 @@ add_subdirectory(src/Effects)
|
||||
add_subdirectory(src/Params)
|
||||
add_subdirectory(src/DSP)
|
||||
add_subdirectory(src/Samples)
|
||||
add_subdirectory(src/Tests)
|
||||
|
||||
ADD_LIBRARY(ZynAddSubFxCore SHARED LocalZynAddSubFx.cpp)
|
||||
TARGET_LINK_LIBRARIES(ZynAddSubFxCore ${ZASF_CORE_LIBS} ${FFTW3F_LIBRARIES} ${QT_LIBRARIES} -lz -lpthread)
|
||||
|
||||
@@ -1,8 +0,0 @@
|
||||
set(zynaddsubfx_controls_SRCS
|
||||
Control.cpp
|
||||
DelayCtl.cpp
|
||||
)
|
||||
|
||||
add_library(zynaddsubfx_controls STATIC
|
||||
${zynaddsubfx_controls_SRCS}
|
||||
)
|
||||
@@ -1,40 +0,0 @@
|
||||
/*
|
||||
ZynAddSubFX - a software synthesizer
|
||||
|
||||
Control.C - Control base class
|
||||
Copyright (C) 2009-2009 Mark McCurry
|
||||
Author: Mark McCurry
|
||||
|
||||
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
|
||||
|
||||
*/
|
||||
#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;
|
||||
}
|
||||
|
||||
@@ -1,58 +0,0 @@
|
||||
/*
|
||||
ZynAddSubFX - a software synthesizer
|
||||
|
||||
Control.h - Control base class
|
||||
Copyright (C) 2009-2009 Mark McCurry
|
||||
Author: Mark McCurry
|
||||
|
||||
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 CONTROL_H
|
||||
#define CONTROL_H
|
||||
#include <string>
|
||||
/**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
|
||||
|
||||
@@ -1,51 +0,0 @@
|
||||
/*
|
||||
ZynAddSubFX - a software synthesizer
|
||||
|
||||
DelayCtl.C - Control For Delays
|
||||
Copyright (C) 2009-2009 Mark McCurry
|
||||
Author: Mark McCurry
|
||||
|
||||
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
|
||||
|
||||
*/
|
||||
#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;
|
||||
}
|
||||
|
||||
@@ -1,43 +0,0 @@
|
||||
/*
|
||||
ZynAddSubFX - a software synthesizer
|
||||
|
||||
DelayCtl.h - Control For Delays
|
||||
Copyright (C) 2009-2009 Mark McCurry
|
||||
Author: Mark McCurry
|
||||
|
||||
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
|
||||
|
||||
*/
|
||||
#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
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
ZynAddSubFX - a software synthesizer
|
||||
|
||||
AnalogFilter.C - Several analog filters (lowpass, highpass...)
|
||||
AnalogFilter.cpp - Several analog filters (lowpass, highpass...)
|
||||
Copyright (C) 2002-2005 Nasca Octavian Paul
|
||||
Author: Nasca Octavian Paul
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@ set(zynaddsubfx_dsp_SRCS
|
||||
Filter.cpp
|
||||
FormantFilter.cpp
|
||||
SVFilter.cpp
|
||||
Unison.cpp
|
||||
Unison.cpp
|
||||
)
|
||||
|
||||
add_library(zynaddsubfx_dsp STATIC
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
ZynAddSubFX - a software synthesizer
|
||||
|
||||
Filter.C - Filters, uses analog,formant,etc. filters
|
||||
Filter.cpp - Filters, uses analog,formant,etc. filters
|
||||
Copyright (C) 2002-2005 Nasca Octavian Paul
|
||||
Author: Nasca Octavian Paul
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
ZynAddSubFX - a software synthesizer
|
||||
|
||||
FormantFilter.C - formant filters
|
||||
FormantFilter.cpp - formant filters
|
||||
Copyright (C) 2002-2005 Nasca Octavian Paul
|
||||
Author: Nasca Octavian Paul
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
ZynAddSubFX - a software synthesizer
|
||||
|
||||
SVFilter.C - Several state-variable filters
|
||||
SVFilter.cpp - Several state-variable filters
|
||||
Copyright (C) 2002-2005 Nasca Octavian Paul
|
||||
Author: Nasca Octavian Paul
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
ZynAddSubFX - a software synthesizer
|
||||
|
||||
Alienwah.C - "AlienWah" effect
|
||||
Alienwah.cpp - "AlienWah" effect
|
||||
Copyright (C) 2002-2005 Nasca Octavian Paul
|
||||
Author: Nasca Octavian Paul
|
||||
|
||||
@@ -46,7 +46,7 @@ Alienwah::~Alienwah()
|
||||
/*
|
||||
* Apply the effect
|
||||
*/
|
||||
void Alienwah::out(REALTYPE *smpsl, REALTYPE *smpsr)
|
||||
void Alienwah::out(const Stereo<float *> &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:
|
||||
|
||||
@@ -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<float *> &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;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
ZynAddSubFX - a software synthesizer
|
||||
|
||||
Chorus.C - Chorus and Flange effects
|
||||
Chorus.cpp - Chorus and Flange effects
|
||||
Copyright (C) 2002-2005 Nasca Octavian Paul
|
||||
Author: Nasca Octavian Paul
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -65,24 +62,13 @@ REALTYPE Chorus::getdelay(REALTYPE xlfo)
|
||||
if((result + 0.5) >= maxdelay) {
|
||||
cerr
|
||||
<<
|
||||
"WARNING: Chorus.C::getdelay(..) too big delay (see setdelay and setdepth funcs.)\n";
|
||||
"WARNING: Chorus.cpp::getdelay(..) too big delay (see setdelay and setdepth funcs.)\n";
|
||||
result = maxdelay - 1.0;
|
||||
}
|
||||
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<float *> &input)
|
||||
{
|
||||
const REALTYPE one = 1.0;
|
||||
dl1 = dl2;
|
||||
@@ -92,14 +78,14 @@ void Chorus::out(const Stereo<AuSample> &input)
|
||||
dl2 = getdelay(lfol);
|
||||
dr2 = getdelay(lfor);
|
||||
|
||||
for(int i = 0; i < input.l().size(); i++) {
|
||||
REALTYPE inl = input.l()[i];
|
||||
REALTYPE inr = input.r()[i];
|
||||
for(int i = 0; i < SOUND_BUFFER_SIZE; i++) {
|
||||
REALTYPE inl = input.l[i];
|
||||
REALTYPE inr = input.r[i];
|
||||
//LRcross
|
||||
Stereo<REALTYPE> tmpc(inl, inr);
|
||||
//REALTYPE r=inr;
|
||||
inl = tmpc.l() * (1.0 - lrcross) + tmpc.r() * lrcross;
|
||||
inr = tmpc.r() * (1.0 - lrcross) + tmpc.l() * lrcross;
|
||||
inl = tmpc.l * (1.0 - lrcross) + tmpc.r * lrcross;
|
||||
inr = tmpc.r * (1.0 - lrcross) + tmpc.l * lrcross;
|
||||
|
||||
//Left channel
|
||||
|
||||
@@ -114,9 +100,9 @@ void Chorus::out(const Stereo<AuSample> &input)
|
||||
|
||||
dlhi2 = (dlhi - 1 + maxdelay) % maxdelay;
|
||||
dllo = 1.0 - fmod(tmp, one);
|
||||
efxoutl[i] = delaySample.l()[dlhi2] * dllo + delaySample.l()[dlhi]
|
||||
efxoutl[i] = delaySample.l[dlhi2] * dllo + delaySample.l[dlhi]
|
||||
* (1.0 - dllo);
|
||||
delaySample.l()[dlk] = inl + efxoutl[i] * fb;
|
||||
delaySample.l[dlk] = inl + efxoutl[i] * fb;
|
||||
|
||||
//Right channel
|
||||
|
||||
@@ -131,20 +117,20 @@ void Chorus::out(const Stereo<AuSample> &input)
|
||||
|
||||
dlhi2 = (dlhi - 1 + maxdelay) % maxdelay;
|
||||
dllo = 1.0 - fmod(tmp, one);
|
||||
efxoutr[i] = delaySample.r()[dlhi2] * dllo + delaySample.r()[dlhi]
|
||||
efxoutr[i] = delaySample.r[dlhi2] * dllo + delaySample.r[dlhi]
|
||||
* (1.0 - dllo);
|
||||
delaySample.r()[dlk] = inr + efxoutr[i] * fb;
|
||||
delaySample.r[dlk] = inr + efxoutr[i] * fb;
|
||||
}
|
||||
|
||||
if(Poutsub != 0)
|
||||
for(int i = 0; i < input.l().size(); i++) {
|
||||
for(int i = 0; i < SOUND_BUFFER_SIZE; i++) {
|
||||
efxoutl[i] *= -1.0;
|
||||
efxoutr[i] *= -1.0;
|
||||
}
|
||||
;
|
||||
|
||||
|
||||
for(int i = 0; i < input.l().size(); i++) {
|
||||
for(int i = 0; i < SOUND_BUFFER_SIZE; i++) {
|
||||
efxoutl[i] *= panning;
|
||||
efxoutr[i] *= (1.0 - panning);
|
||||
}
|
||||
@@ -155,31 +141,31 @@ void Chorus::out(const Stereo<AuSample> &input)
|
||||
*/
|
||||
void Chorus::cleanup()
|
||||
{
|
||||
delaySample.l().clear();
|
||||
delaySample.r().clear();
|
||||
delaySample.l.clear();
|
||||
delaySample.r.clear();
|
||||
}
|
||||
|
||||
/*
|
||||
* 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:
|
||||
|
||||
@@ -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<float *> &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;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
ZynAddSubFX - a software synthesizer
|
||||
|
||||
Distorsion.C - Distorsion effect
|
||||
Distorsion.cpp - Distorsion effect
|
||||
Copyright (C) 2002-2005 Nasca Octavian Paul
|
||||
Author: Nasca Octavian Paul
|
||||
|
||||
@@ -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<float *> &smp)
|
||||
{
|
||||
int i;
|
||||
REALTYPE l, r, lout, rout;
|
||||
@@ -271,14 +271,14 @@ void Distorsion::out(REALTYPE *smpsl, REALTYPE *smpsr)
|
||||
|
||||
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);
|
||||
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:
|
||||
|
||||
@@ -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<float *> &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;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
ZynAddSubFX - a software synthesizer
|
||||
|
||||
DynamicFilter.C - "WahWah" effect and others
|
||||
DynamicFilter.cpp - "WahWah" effect and others
|
||||
Copyright (C) 2002-2005 Nasca Octavian Paul
|
||||
Author: Nasca Octavian Paul
|
||||
|
||||
@@ -46,7 +46,7 @@ DynamicFilter::~DynamicFilter()
|
||||
/*
|
||||
* Apply the effect
|
||||
*/
|
||||
void DynamicFilter::out(REALTYPE *smpsl, REALTYPE *smpsr)
|
||||
void DynamicFilter::out(const Stereo<float *> &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:
|
||||
|
||||
@@ -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<float *> &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();
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
ZynAddSubFX - a software synthesizer
|
||||
|
||||
EQ.C - EQ effect
|
||||
EQ.cpp - EQ effect
|
||||
Copyright (C) 2002-2005 Nasca Octavian Paul
|
||||
Author: Nasca Octavian Paul
|
||||
|
||||
@@ -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<float *> &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:
|
||||
|
||||
@@ -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<float *> &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
|
||||
|
||||
@@ -1,9 +1,11 @@
|
||||
/*
|
||||
ZynAddSubFX - a software synthesizer
|
||||
|
||||
Echo.C - Echo effect
|
||||
Echo.cpp - Echo effect
|
||||
Copyright (C) 2002-2005 Nasca Octavian Paul
|
||||
Copyright (C) 2009-2010 Mark McCurry
|
||||
Author: Nasca Octavian Paul
|
||||
Mark McCurry
|
||||
|
||||
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
|
||||
@@ -21,95 +23,93 @@
|
||||
*/
|
||||
|
||||
#include <cmath>
|
||||
#include <iostream>
|
||||
#include "Echo.h"
|
||||
|
||||
#define MAX_DELAY 2
|
||||
|
||||
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), delaySample(1), old(0.0)
|
||||
delayTime(1), lrdelay(0), avgDelay(0),
|
||||
delay(new REALTYPE[(int)(MAX_DELAY * SAMPLE_RATE)],
|
||||
new REALTYPE[(int)(MAX_DELAY * SAMPLE_RATE)]),
|
||||
old(0.0), pos(0), delta(1), ndelta(1)
|
||||
{
|
||||
initdelays();
|
||||
setpreset(Ppreset);
|
||||
}
|
||||
|
||||
Echo::~Echo() {}
|
||||
Echo::~Echo()
|
||||
{
|
||||
delete[] delay.l;
|
||||
delete[] delay.r;
|
||||
}
|
||||
|
||||
/*
|
||||
* Cleanup the effect
|
||||
*/
|
||||
void Echo::cleanup()
|
||||
{
|
||||
delaySample.l().clear();
|
||||
delaySample.r().clear();
|
||||
memset(delay.l,0,MAX_DELAY*SAMPLE_RATE*sizeof(REALTYPE));
|
||||
memset(delay.r,0,MAX_DELAY*SAMPLE_RATE*sizeof(REALTYPE));
|
||||
old = Stereo<REALTYPE>(0.0);
|
||||
}
|
||||
|
||||
inline int max(int a, int b)
|
||||
{
|
||||
return a > b ? a : b;
|
||||
}
|
||||
|
||||
/*
|
||||
* Initialize the delays
|
||||
*/
|
||||
void Echo::initdelays()
|
||||
{
|
||||
/**\todo make this adjust insted of destroy old delays*/
|
||||
kl = 0;
|
||||
kr = 0;
|
||||
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;
|
||||
cleanup();
|
||||
//number of seconds to delay left chan
|
||||
float dl = avgDelay - lrdelay;
|
||||
|
||||
delaySample.l() = AuSample(dl);
|
||||
delaySample.r() = AuSample(dr);
|
||||
//number of seconds to delay right chan
|
||||
float dr = avgDelay + lrdelay;
|
||||
|
||||
old = Stereo<REALTYPE>(0.0);
|
||||
ndelta.l = max(1,(int) (dl * SAMPLE_RATE));
|
||||
ndelta.r = max(1,(int) (dr * SAMPLE_RATE));
|
||||
}
|
||||
|
||||
/*
|
||||
* Effect output
|
||||
*/
|
||||
void Echo::out(REALTYPE *const smpsl, REALTYPE *const smpsr)
|
||||
void Echo::out(const Stereo<float *> &input)
|
||||
{
|
||||
Stereo<AuSample> input(AuSample(SOUND_BUFFER_SIZE, smpsl), AuSample(
|
||||
SOUND_BUFFER_SIZE,
|
||||
smpsr));
|
||||
out(input);
|
||||
}
|
||||
REALTYPE ldl, rdl;
|
||||
|
||||
void Echo::out(const Stereo<AuSample> &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++) {
|
||||
ldl = delaySample.l()[kl];
|
||||
rdl = delaySample.r()[kr];
|
||||
l = ldl * (1.0 - lrcross) + rdl * lrcross;
|
||||
r = rdl * (1.0 - lrcross) + ldl * lrcross;
|
||||
ldl = l;
|
||||
rdl = r;
|
||||
for(int i = 0; i < SOUND_BUFFER_SIZE; ++i) {
|
||||
ldl = delay.l[pos.l];
|
||||
rdl = delay.r[pos.r];
|
||||
ldl = ldl * (1.0 - lrcross) + rdl * lrcross;
|
||||
rdl = rdl * (1.0 - lrcross) + ldl * lrcross;
|
||||
|
||||
efxoutl[i] = ldl * 2.0;
|
||||
efxoutr[i] = rdl * 2.0;
|
||||
|
||||
|
||||
ldl = input.l()[i] * panning - ldl * fb;
|
||||
rdl = input.r()[i] * (1.0 - panning) - rdl * fb;
|
||||
ldl = input.l[i] * panning - ldl * fb;
|
||||
rdl = input.r[i] * (1.0 - panning) - rdl * fb;
|
||||
|
||||
//LowPass Filter
|
||||
delaySample.l()[kl] = ldl = ldl * hidamp + old.l() * (1.0 - hidamp);
|
||||
delaySample.r()[kr] = rdl = rdl * hidamp + old.r() * (1.0 - hidamp);
|
||||
old.l() = ldl;
|
||||
old.r() = rdl;
|
||||
old.l = delay.l[(pos.l+delta.l)%(MAX_DELAY * SAMPLE_RATE)] = ldl * hidamp + old.l * (1.0 - hidamp);
|
||||
old.r = delay.r[(pos.r+delta.r)%(MAX_DELAY * SAMPLE_RATE)] = rdl * hidamp + old.r * (1.0 - hidamp);
|
||||
|
||||
if(++kl >= dl)
|
||||
kl = 0;
|
||||
if(++kr >= dr)
|
||||
kr = 0;
|
||||
//increment
|
||||
++pos.l;// += delta.l;
|
||||
++pos.r;// += delta.r;
|
||||
|
||||
//ensure that pos is still in bounds
|
||||
pos.l %= MAX_DELAY * SAMPLE_RATE;
|
||||
pos.r %= MAX_DELAY * SAMPLE_RATE;
|
||||
|
||||
//adjust delay if needed
|
||||
delta.l = (15*delta.l + ndelta.l)/16;
|
||||
delta.r = (15*delta.r + ndelta.r)/16;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -117,7 +117,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,45 +132,44 @@ 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;
|
||||
//delay=1+(int)(Pdelay/127.0*SAMPLE_RATE*1.5);//0 .. 1.5 sec
|
||||
this->Pdelay=Pdelay;
|
||||
avgDelay=(Pdelay/127.0*1.5);//0 .. 1.5 sec
|
||||
initdelays();
|
||||
}
|
||||
|
||||
void Echo::setlrdelay(const unsigned char &Plrdelay)
|
||||
void Echo::setlrdelay(unsigned char Plrdelay)
|
||||
{
|
||||
REALTYPE tmp;
|
||||
this->Plrdelay = Plrdelay;
|
||||
tmp =
|
||||
(pow(2, fabs(Plrdelay - 64.0) / 64.0 * 9) - 1.0) / 1000.0 * SAMPLE_RATE;
|
||||
(pow(2, fabs(Plrdelay - 64.0) / 64.0 * 9) - 1.0) / 1000.0;
|
||||
if(Plrdelay < 64.0)
|
||||
tmp = -tmp;
|
||||
lrdelay = (int) tmp;
|
||||
lrdelay = tmp;
|
||||
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:
|
||||
@@ -250,7 +249,7 @@ unsigned char Echo::getpar(const int &npar) const
|
||||
return Ppanning;
|
||||
break;
|
||||
case 2:
|
||||
return delay.getmVal();
|
||||
return Pdelay;
|
||||
break;
|
||||
case 3:
|
||||
return Plrdelay;
|
||||
|
||||
@@ -25,9 +25,8 @@
|
||||
|
||||
#include "../globals.h"
|
||||
#include "Effect.h"
|
||||
#include "../Samples/AuSample.h"
|
||||
#include "../Misc/Stereo.h"
|
||||
#include "../Controls/DelayCtl.h"
|
||||
#include "../Samples/Sample.h"
|
||||
|
||||
/**Echo Effect*/
|
||||
class Echo:public Effect
|
||||
@@ -51,15 +50,7 @@ class Echo:public Effect
|
||||
*/
|
||||
~Echo();
|
||||
|
||||
/**
|
||||
* Outputs the echo to efxoutl and efxoutr
|
||||
* @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 (It should be)
|
||||
*/
|
||||
void out(REALTYPE *const smpsl, REALTYPE *const smpr);
|
||||
void out(const Stereo<AuSample> &input);
|
||||
void out(const Stereo<float *> &input);
|
||||
|
||||
/**
|
||||
* Sets the state of Echo to the specified preset
|
||||
@@ -81,7 +72,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 +88,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,31 +99,39 @@ 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*/
|
||||
char Pdelay; /**<#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
|
||||
REALTYPE panning, lrcross, fb, hidamp;
|
||||
//Left/Right delay lengths
|
||||
Stereo<int> delayTime;
|
||||
REALTYPE lrdelay;
|
||||
REALTYPE avgDelay;
|
||||
|
||||
void initdelays();
|
||||
Stereo<AuSample> delaySample;
|
||||
//2 channel ring buffer
|
||||
Stereo<REALTYPE *> delay;
|
||||
Stereo<REALTYPE> old;
|
||||
|
||||
int kl, kr;
|
||||
//position of reading/writing from delaysample
|
||||
Stereo<int> pos;
|
||||
//step size for delay buffer
|
||||
Stereo<int> delta;
|
||||
Stereo<int> ndelta;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
ZynAddSubFX - a software synthesizer
|
||||
|
||||
Effect.C - this class is inherited by the all effects(Reverb, Echo, ..)
|
||||
Effect.cpp - this class is inherited by the all effects(Reverb, Echo, ..)
|
||||
Copyright (C) 2002-2005 Nasca Octavian Paul
|
||||
Author: Nasca Octavian Paul
|
||||
|
||||
@@ -22,10 +22,15 @@
|
||||
|
||||
#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<float *>(smpsl,smpsr));
|
||||
};
|
||||
|
||||
|
||||
@@ -26,6 +26,7 @@
|
||||
#include "../Misc/Util.h"
|
||||
#include "../globals.h"
|
||||
#include "../Params/FilterParams.h"
|
||||
#include "../Misc/Stereo.h"
|
||||
|
||||
|
||||
/**this class is inherited by the all effects(Reverb, Echo, ..)*/
|
||||
@@ -56,12 +57,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,18 +72,19 @@ 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<float *> &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*/
|
||||
REALTYPE *const efxoutl; /**<Effect out Left Channel*/
|
||||
REALTYPE *const efxoutr; /**<Effect out Right Channel*/
|
||||
/**\todo make efxoutl and efxoutr private and replace them with a StereoSample*/
|
||||
/**\todo make efxoutl and efxoutr private and replace them with a Stereo<float*>*/
|
||||
|
||||
REALTYPE outvolume;/**<This is the volume of effect and is public because
|
||||
* it is needed in system effects.
|
||||
@@ -96,7 +98,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
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
ZynAddSubFX - a software synthesizer
|
||||
|
||||
EffectLFO.C - Stereo LFO used by some effects
|
||||
EffectLFO.cpp - Stereo LFO used by some effects
|
||||
Copyright (C) 2002-2005 Nasca Octavian Paul
|
||||
Author: Nasca Octavian Paul
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
ZynAddSubFX - a software synthesizer
|
||||
|
||||
EffectMgr.C - Effect manager, an interface betwen the program and effects
|
||||
EffectMgr.cpp - Effect manager, an interface betwen the program and effects
|
||||
Copyright (C) 2002-2005 Nasca Octavian Paul
|
||||
Author: Nasca Octavian Paul
|
||||
|
||||
@@ -21,6 +21,8 @@
|
||||
*/
|
||||
|
||||
#include "EffectMgr.h"
|
||||
#include <iostream>
|
||||
using namespace std;
|
||||
|
||||
EffectMgr::EffectMgr(int insertion_, pthread_mutex_t *mutex_)
|
||||
:insertion(insertion_),
|
||||
|
||||
@@ -37,7 +37,6 @@
|
||||
#include "../Params/FilterParams.h"
|
||||
#include "../Params/Presets.h"
|
||||
|
||||
|
||||
/**Effect manager, an interface betwen the program and effects*/
|
||||
class EffectMgr:public Presets
|
||||
{
|
||||
|
||||
@@ -1,9 +1,18 @@
|
||||
/*
|
||||
|
||||
Phaser.cpp - Phasing and Approximate digital model of an analog JFET phaser.
|
||||
Analog modeling implemented by Ryan Billing aka Transmogrifox.
|
||||
ZynAddSubFX - a software synthesizer
|
||||
|
||||
Phaser.C - Phaser effect
|
||||
Phaser.cpp - Phaser effect
|
||||
Copyright (C) 2002-2005 Nasca Octavian Paul
|
||||
Copyright (C) 2009-2010 Ryan Billing
|
||||
Copyright (C) 2010-2010 Mark McCurry
|
||||
Author: Nasca Octavian Paul
|
||||
Ryan Billing
|
||||
Mark McCurry
|
||||
|
||||
DSP analog modeling theory & practice largely influenced by various CCRMA publications, particularly works by Julius O. Smith.
|
||||
|
||||
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
|
||||
@@ -21,89 +30,212 @@
|
||||
*/
|
||||
|
||||
#include <cmath>
|
||||
#include <algorithm>
|
||||
#include "Phaser.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
#define PHASER_LFO_SHAPE 2
|
||||
#define ONE_ 0.99999f // To prevent LFO ever reaching 1.0 for filter stability purposes
|
||||
#define ZERO_ 0.00001f // Same idea as above.
|
||||
|
||||
Phaser::Phaser(const int &insertion_, REALTYPE *efxoutl_, REALTYPE *efxoutr_)
|
||||
:Effect(insertion_, efxoutl_, efxoutr_, NULL, 0), old(1), oldgain(0.0)
|
||||
:Effect(insertion_, efxoutl_, efxoutr_, NULL, 0), xn1(NULL), yn1(NULL), diff(0.0), old(NULL), oldgain(0.0),
|
||||
fb(0.0)
|
||||
{
|
||||
analog_setup();
|
||||
setpreset(Ppreset);
|
||||
cleanup();
|
||||
}
|
||||
|
||||
Phaser::~Phaser()
|
||||
{}
|
||||
void Phaser::analog_setup()
|
||||
{
|
||||
//model mismatch between JFET devices
|
||||
offset[0] = -0.2509303f;
|
||||
offset[1] = 0.9408924f;
|
||||
offset[2] = 0.998f;
|
||||
offset[3] = -0.3486182f;
|
||||
offset[4] = -0.2762545f;
|
||||
offset[5] = -0.5215785f;
|
||||
offset[6] = 0.2509303f;
|
||||
offset[7] = -0.9408924f;
|
||||
offset[8] = -0.998f;
|
||||
offset[9] = 0.3486182f;
|
||||
offset[10] = 0.2762545f;
|
||||
offset[11] = 0.5215785f;
|
||||
|
||||
barber = 0; //Deactivate barber pole phasing by default
|
||||
|
||||
mis = 1.0f;
|
||||
Rmin = 625.0f;// 2N5457 typical on resistance at Vgs = 0
|
||||
Rmax = 22000.0f;// Resistor parallel to FET
|
||||
Rmx = Rmin/Rmax;
|
||||
Rconst = 1.0f + Rmx; // Handle parallel resistor relationship
|
||||
C = 0.00000005f; // 50 nF
|
||||
CFs = (float) 2.0f*(float)SAMPLE_RATE*C;
|
||||
invperiod = 1.0f / ((float) SOUND_BUFFER_SIZE);
|
||||
}
|
||||
|
||||
Phaser::~Phaser()
|
||||
{
|
||||
if(xn1.l)
|
||||
delete[] xn1.l;
|
||||
if(yn1.l)
|
||||
delete[] yn1.l;
|
||||
if(xn1.r)
|
||||
delete[] xn1.r;
|
||||
if(yn1.r)
|
||||
delete[] yn1.r;
|
||||
}
|
||||
|
||||
/*
|
||||
* Effect output
|
||||
*/
|
||||
void Phaser::out(REALTYPE *smpsl, REALTYPE *smpsr)
|
||||
void Phaser::out(const Stereo<REALTYPE *> &input)
|
||||
{
|
||||
int i, j;
|
||||
REALTYPE lfol, lfor, lgain, rgain, tmp;
|
||||
|
||||
lfo.effectlfoout(&lfol, &lfor);
|
||||
lgain = lfol;
|
||||
rgain = lfor;
|
||||
lgain = (exp(lgain * PHASER_LFO_SHAPE) - 1) / (exp(PHASER_LFO_SHAPE) - 1.0);
|
||||
rgain = (exp(rgain * PHASER_LFO_SHAPE) - 1) / (exp(PHASER_LFO_SHAPE) - 1.0);
|
||||
|
||||
|
||||
lgain = 1.0 - phase * (1.0 - depth) - (1.0 - phase) * lgain * depth;
|
||||
rgain = 1.0 - phase * (1.0 - depth) - (1.0 - phase) * rgain * depth;
|
||||
|
||||
if(lgain > 1.0)
|
||||
lgain = 1.0;
|
||||
if(Panalog)
|
||||
AnalogPhase(input);
|
||||
else
|
||||
if(lgain < 0.0)
|
||||
lgain = 0.0;
|
||||
if(rgain > 1.0)
|
||||
rgain = 1.0;
|
||||
else
|
||||
if(rgain < 0.0)
|
||||
rgain = 0.0;
|
||||
normalPhase(input);
|
||||
}
|
||||
|
||||
for(i = 0; i < SOUND_BUFFER_SIZE; i++) {
|
||||
REALTYPE x = (REALTYPE) i / SOUND_BUFFER_SIZE;
|
||||
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;
|
||||
void Phaser::AnalogPhase(const Stereo<REALTYPE *> &input)
|
||||
{
|
||||
Stereo<REALTYPE> gain(0.0), lfoVal(0.0), mod(0.0), g(0.0), b(0.0), hpf(0.0);
|
||||
|
||||
//Left channel
|
||||
for(j = 0; j < Pstages * 2; j++) { //Phasing routine
|
||||
tmp = old.left()[j];
|
||||
old.left()[j] = gl * tmp + inl;
|
||||
inl = tmp - gl *old.left()[j];
|
||||
}
|
||||
//Right channel
|
||||
for(j = 0; j < Pstages * 2; j++) { //Phasing routine
|
||||
tmp = old.right()[j];
|
||||
old.right()[j] = gr * tmp + inr;
|
||||
inr = tmp - gr *old.right()[j];
|
||||
}
|
||||
//Left/Right crossing
|
||||
REALTYPE l = inl;
|
||||
REALTYPE r = inr;
|
||||
inl = l * (1.0 - lrcross) + r * lrcross;
|
||||
inr = r * (1.0 - lrcross) + l * lrcross;
|
||||
lfo.effectlfoout(&lfoVal.l, &lfoVal.r);
|
||||
mod.l = lfoVal.l*width + (depth - 0.5f);
|
||||
mod.r = lfoVal.r*width + (depth - 0.5f);
|
||||
|
||||
fbl = inl * fb;
|
||||
fbr = inr * fb;
|
||||
efxoutl[i] = inl;
|
||||
efxoutr[i] = inr;
|
||||
mod.l = limit(mod.l, ZERO_, ONE_);
|
||||
mod.r = limit(mod.r, ZERO_, ONE_);
|
||||
|
||||
if(Phyper) {
|
||||
//Triangle wave squared is approximately sin on bottom, tri on top
|
||||
//Result is exponential sweep more akin to filter in synth with
|
||||
//exponential generator circuitry.
|
||||
mod.l *= mod.l;
|
||||
mod.r *= mod.r;
|
||||
}
|
||||
|
||||
oldgain = Stereo<REALTYPE>(lgain, rgain);
|
||||
//g.l,g.r is Vp - Vgs. Typical FET drain-source resistance follows constant/[1-sqrt(Vp - Vgs)]
|
||||
mod.l = sqrtf(1.0f - mod.l);
|
||||
mod.r = sqrtf(1.0f - mod.r);
|
||||
|
||||
if(Poutsub != 0)
|
||||
for(i = 0; i < SOUND_BUFFER_SIZE; i++) {
|
||||
efxoutl[i] *= -1.0;
|
||||
efxoutr[i] *= -1.0;
|
||||
diff.r = (mod.r - oldgain.r) * invperiod;
|
||||
diff.l = (mod.l - oldgain.l) * invperiod;
|
||||
|
||||
g = oldgain;
|
||||
oldgain = mod;
|
||||
|
||||
for (int i = 0; i < SOUND_BUFFER_SIZE; i++) {
|
||||
g.l += diff.l;// Linear interpolation between LFO samples
|
||||
g.r += diff.r;
|
||||
|
||||
Stereo<REALTYPE> xn(input.l[i] * panning,
|
||||
input.r[i] * (1.0f - panning));
|
||||
|
||||
if (barber) {
|
||||
g.l = fmodf((g.l + 0.25f), ONE_);
|
||||
g.r = fmodf((g.r + 0.25f), ONE_);
|
||||
}
|
||||
;
|
||||
|
||||
xn.l = applyPhase(xn.l, g.l, fb.l, hpf.l, yn1.l, xn1.l);
|
||||
xn.r = applyPhase(xn.r, g.r, fb.r, hpf.r, yn1.r, xn1.r);
|
||||
|
||||
|
||||
fb.l = xn.l * feedback;
|
||||
fb.r = xn.r * feedback;
|
||||
efxoutl[i] = xn.l;
|
||||
efxoutr[i] = xn.r;
|
||||
}
|
||||
|
||||
if(Poutsub) {
|
||||
invSignal(efxoutl, SOUND_BUFFER_SIZE);
|
||||
invSignal(efxoutr, SOUND_BUFFER_SIZE);
|
||||
}
|
||||
}
|
||||
|
||||
REALTYPE Phaser::applyPhase(REALTYPE x, REALTYPE g, REALTYPE fb,
|
||||
REALTYPE &hpf, REALTYPE *yn1, REALTYPE *xn1)
|
||||
{
|
||||
for(int j = 0; j < Pstages; j++) { //Phasing routine
|
||||
mis = 1.0f + offsetpct*offset[j];
|
||||
|
||||
//This is symmetrical.
|
||||
//FET is not, so this deviates slightly, however sym dist. is
|
||||
//better sounding than a real FET.
|
||||
float d = (1.0f + 2.0f*(0.25f + g)*hpf*hpf*distortion) * mis;
|
||||
Rconst = 1.0f + mis*Rmx;
|
||||
|
||||
// This is 1/R. R is being modulated to control filter fc.
|
||||
float b = (Rconst - g)/ (d*Rmin);
|
||||
float gain = (CFs - b)/(CFs + b);
|
||||
yn1[j] = gain * (x + yn1[j]) - xn1[j];
|
||||
|
||||
//high pass filter:
|
||||
//Distortion depends on the high-pass part of the AP stage.
|
||||
hpf = yn1[j] + (1.0f-gain)*xn1[j];
|
||||
|
||||
xn1[j] = x;
|
||||
x = yn1[j];
|
||||
if (j==1)
|
||||
x += fb; //Insert feedback after first phase stage
|
||||
}
|
||||
return x;
|
||||
}
|
||||
void Phaser::normalPhase(const Stereo<REALTYPE *> &input)
|
||||
{
|
||||
Stereo<REALTYPE> gain(0.0), lfoVal(0.0);
|
||||
|
||||
lfo.effectlfoout(&lfoVal.l, &lfoVal.r);
|
||||
gain.l = (exp(lfoVal.l * PHASER_LFO_SHAPE) - 1) / (exp(PHASER_LFO_SHAPE) - 1.0);
|
||||
gain.r = (exp(lfoVal.r * PHASER_LFO_SHAPE) - 1) / (exp(PHASER_LFO_SHAPE) - 1.0);
|
||||
|
||||
gain.l = 1.0 - phase * (1.0 - depth) - (1.0 - phase) * gain.l * depth;
|
||||
gain.r = 1.0 - phase * (1.0 - depth) - (1.0 - phase) * gain.r * depth;
|
||||
|
||||
gain.l = limit(gain.l, ZERO_, ONE_);
|
||||
gain.r = limit(gain.r, ZERO_, ONE_);
|
||||
|
||||
for(int i = 0; i < SOUND_BUFFER_SIZE; i++) {
|
||||
REALTYPE x = (REALTYPE) i / SOUND_BUFFER_SIZE;
|
||||
REALTYPE x1 = 1.0 - x;
|
||||
//TODO think about making panning an external feature
|
||||
Stereo<REALTYPE> xn(input.l[i] * panning + fb.l,
|
||||
input.r[i] * (1.0 - panning) + fb.r);
|
||||
|
||||
Stereo<REALTYPE> g(gain.l * x + oldgain.l * x1,
|
||||
gain.r * x + oldgain.r * x1);
|
||||
|
||||
xn.l = applyPhase(xn.l, g.l, old.l);
|
||||
xn.r = applyPhase(xn.r, g.r, old.r);
|
||||
|
||||
//Left/Right crossing
|
||||
crossover(xn.l, xn.r, lrcross);
|
||||
|
||||
fb.l = xn.l * feedback;
|
||||
fb.r = xn.r * feedback;
|
||||
efxoutl[i] = xn.l;
|
||||
efxoutr[i] = xn.r;
|
||||
}
|
||||
|
||||
oldgain = gain;
|
||||
|
||||
if(Poutsub) {
|
||||
invSignal(efxoutl, SOUND_BUFFER_SIZE);
|
||||
invSignal(efxoutr, SOUND_BUFFER_SIZE);
|
||||
}
|
||||
}
|
||||
|
||||
REALTYPE Phaser::applyPhase(REALTYPE x, REALTYPE g, REALTYPE *old)
|
||||
{
|
||||
for(int j = 0; j < Pstages * 2; j++) { //Phasing routine
|
||||
REALTYPE tmp = old[j];
|
||||
old[j] = g * tmp + x;
|
||||
x = tmp - g *old[j];
|
||||
}
|
||||
return x;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -111,30 +243,35 @@ void Phaser::out(REALTYPE *smpsl, REALTYPE *smpsr)
|
||||
*/
|
||||
void Phaser::cleanup()
|
||||
{
|
||||
fbl = 0.0;
|
||||
fbr = 0.0;
|
||||
oldgain = Stereo<REALTYPE>(0.0);
|
||||
old.l().clear();
|
||||
old.r().clear();
|
||||
fb = oldgain = Stereo<REALTYPE>(0.0);
|
||||
for(int i = 0; i < Pstages * 2; i++) {
|
||||
old.l[i] = 0.0;
|
||||
old.r[i] = 0.0;
|
||||
}
|
||||
for(int i = 0; i < Pstages; i++) {
|
||||
xn1.l[i] = 0.0;
|
||||
yn1.l[i] = 0.0;
|
||||
xn1.r[i] = 0.0;
|
||||
yn1.r[i] = 0.0;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Parameter control
|
||||
*/
|
||||
void Phaser::setdepth(const unsigned char &Pdepth)
|
||||
void Phaser::setwidth(unsigned char Pwidth)
|
||||
{
|
||||
this->Pdepth = Pdepth;
|
||||
depth = (Pdepth / 127.0);
|
||||
this->Pwidth = Pwidth;
|
||||
width = ((float)Pwidth / 127.0f);
|
||||
}
|
||||
|
||||
|
||||
void Phaser::setfb(const unsigned char &Pfb)
|
||||
void Phaser::setfb(unsigned char Pfb)
|
||||
{
|
||||
this->Pfb = Pfb;
|
||||
fb = (Pfb - 64.0) / 64.1;
|
||||
feedback = (float) (Pfb - 64) / 64.2f;
|
||||
}
|
||||
|
||||
void Phaser::setvolume(const unsigned char &Pvolume)
|
||||
void Phaser::setvolume(unsigned char Pvolume)
|
||||
{
|
||||
this->Pvolume = Pvolume;
|
||||
outvolume = Pvolume / 127.0;
|
||||
@@ -144,52 +281,90 @@ 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;
|
||||
panning = (float)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::setdistortion(unsigned char Pdistortion)
|
||||
{
|
||||
if(Pstages >= MAX_PHASER_STAGES)
|
||||
this->Pstages = MAX_PHASER_STAGES - 1;
|
||||
else
|
||||
this->Pstages = Pstages;
|
||||
old = Stereo<AuSample>(Pstages * 2);
|
||||
this->Pdistortion = Pdistortion;
|
||||
distortion = (float)Pdistortion / 127.0f;
|
||||
}
|
||||
|
||||
void Phaser::setoffset(unsigned char Poffset)
|
||||
{
|
||||
this->Poffset = Poffset;
|
||||
offsetpct = (float)Poffset / 127.0f;
|
||||
}
|
||||
|
||||
void Phaser::setstages(unsigned char Pstages)
|
||||
{
|
||||
if(xn1.l)
|
||||
delete[] xn1.l;
|
||||
if(yn1.l)
|
||||
delete[] yn1.l;
|
||||
if(xn1.r)
|
||||
delete[] xn1.r;
|
||||
if(yn1.r)
|
||||
delete[] yn1.r;
|
||||
|
||||
|
||||
this->Pstages = min(MAX_PHASER_STAGES, (int)Pstages);
|
||||
|
||||
old = Stereo<REALTYPE *>(new REALTYPE[Pstages * 2],
|
||||
new REALTYPE[Pstages * 2]);
|
||||
|
||||
xn1 = Stereo<REALTYPE *>(new REALTYPE[Pstages],
|
||||
new REALTYPE[Pstages]);
|
||||
|
||||
yn1 = Stereo<REALTYPE *>(new REALTYPE[Pstages],
|
||||
new REALTYPE[Pstages]);
|
||||
|
||||
cleanup();
|
||||
}
|
||||
|
||||
void Phaser::setphase(const unsigned char &Pphase)
|
||||
void Phaser::setphase(unsigned char Pphase)
|
||||
{
|
||||
this->Pphase = Pphase;
|
||||
phase = (Pphase / 127.0);
|
||||
}
|
||||
|
||||
void Phaser::setdepth(unsigned char Pdepth)
|
||||
{
|
||||
this->Pdepth = Pdepth;
|
||||
depth = (float)(Pdepth) / 127.0f;
|
||||
}
|
||||
|
||||
|
||||
void Phaser::setpreset(unsigned char npreset)
|
||||
{
|
||||
const int PRESET_SIZE = 12;
|
||||
const int NUM_PRESETS = 6;
|
||||
const int PRESET_SIZE = 15;
|
||||
const int NUM_PRESETS = 12;
|
||||
unsigned char presets[NUM_PRESETS][PRESET_SIZE] = {
|
||||
//Phaser1
|
||||
{64, 64, 36, 0, 0, 64, 110, 64, 1, 0, 0, 20},
|
||||
//Phaser2
|
||||
{64, 64, 35, 0, 0, 88, 40, 64, 3, 0, 0, 20},
|
||||
//Phaser3
|
||||
{64, 64, 31, 0, 0, 66, 68, 107, 2, 0, 0, 20},
|
||||
//Phaser4
|
||||
{39, 64, 22, 0, 0, 66, 67, 10, 5, 0, 1, 20},
|
||||
//Phaser5
|
||||
{64, 64, 20, 0, 1, 110, 67, 78, 10, 0, 0, 20},
|
||||
//Phaser6
|
||||
{64, 64, 53, 100, 0, 58, 37, 78, 3, 0, 0, 20}
|
||||
//Phaser
|
||||
//0 1 2 3 4 5 6 7 8 9 10 11 12 13 14
|
||||
{64, 64, 36, 0, 0, 64, 110, 64, 1, 0, 0, 20, 0, 0, 0},
|
||||
{64, 64, 35, 0, 0, 88, 40, 64, 3, 0, 0, 20, 0, 0, 0},
|
||||
{64, 64, 31, 0, 0, 66, 68, 107, 2, 0, 0, 20, 0, 0, 0},
|
||||
{39, 64, 22, 0, 0, 66, 67, 10, 5, 0, 1, 20, 0, 0, 0},
|
||||
{64, 64, 20, 0, 1, 110, 67, 78, 10, 0, 0, 20, 0, 0, 0},
|
||||
{64, 64, 53, 100, 0, 58, 37, 78, 3, 0, 0, 20, 0, 0, 0},
|
||||
//APhaser
|
||||
//0 1 2 3 4 5 6 7 8 9 10 11 12 13 14
|
||||
{64, 64, 14, 0, 1, 64, 64, 40, 4, 10, 0, 110, 1, 20, 1},
|
||||
{64, 64, 14, 5, 1, 64, 70, 40, 6, 10, 0, 110, 1, 20, 1},
|
||||
{64, 64, 9, 0, 0, 64, 60, 40, 8, 10, 0, 40, 0, 20, 1},
|
||||
{64, 64, 14, 10, 0, 64, 45, 80, 7, 10, 1, 110, 1, 20, 1},
|
||||
{25, 64, 127, 10, 0, 64, 25, 16, 8, 100, 0, 25, 0, 20, 1},
|
||||
{64, 64, 1, 10, 1, 64, 70, 40, 12, 10, 0, 110, 1, 20, 1}
|
||||
};
|
||||
if(npreset >= NUM_PRESETS)
|
||||
npreset = NUM_PRESETS - 1;
|
||||
@@ -199,96 +374,100 @@ 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:
|
||||
setvolume(value);
|
||||
break;
|
||||
case 1:
|
||||
setpanning(value);
|
||||
break;
|
||||
case 2:
|
||||
lfo.Pfreq = value;
|
||||
lfo.updateparams();
|
||||
break;
|
||||
case 3:
|
||||
lfo.Prandomness = value;
|
||||
lfo.updateparams();
|
||||
break;
|
||||
case 4:
|
||||
lfo.PLFOtype = value;
|
||||
lfo.updateparams();
|
||||
break;
|
||||
case 5:
|
||||
lfo.Pstereo = value;
|
||||
lfo.updateparams();
|
||||
break;
|
||||
case 6:
|
||||
setdepth(value);
|
||||
break;
|
||||
case 7:
|
||||
setfb(value);
|
||||
break;
|
||||
case 8:
|
||||
setstages(value);
|
||||
break;
|
||||
case 9:
|
||||
setlrcross(value);
|
||||
break;
|
||||
case 10:
|
||||
if(value > 1)
|
||||
Poutsub = 1;
|
||||
else
|
||||
Poutsub = value;
|
||||
break;
|
||||
case 11:
|
||||
setphase(value);
|
||||
break;
|
||||
case 0:
|
||||
setvolume(value);
|
||||
break;
|
||||
case 1:
|
||||
setpanning(value);
|
||||
break;
|
||||
case 2:
|
||||
lfo.Pfreq = value;
|
||||
lfo.updateparams();
|
||||
break;
|
||||
case 3:
|
||||
lfo.Prandomness = value;
|
||||
lfo.updateparams();
|
||||
break;
|
||||
case 4:
|
||||
lfo.PLFOtype = value;
|
||||
lfo.updateparams();
|
||||
barber = (2 == value);
|
||||
break;
|
||||
case 5:
|
||||
lfo.Pstereo = value;
|
||||
lfo.updateparams();
|
||||
break;
|
||||
case 6:
|
||||
setdepth(value);
|
||||
break;
|
||||
case 7:
|
||||
setfb(value);
|
||||
break;
|
||||
case 8:
|
||||
setstages(value);
|
||||
break;
|
||||
case 9:
|
||||
setlrcross(value);
|
||||
setoffset(value);
|
||||
break;
|
||||
case 10:
|
||||
Poutsub = min((int)value,1);
|
||||
break;
|
||||
case 11:
|
||||
setphase(value);
|
||||
setwidth(value);
|
||||
break;
|
||||
case 12:
|
||||
Phyper = min((int)value, 1);
|
||||
break;
|
||||
case 13:
|
||||
setdistortion(value);
|
||||
break;
|
||||
case 14:
|
||||
Panalog = value;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
unsigned char Phaser::getpar(const int &npar) const
|
||||
unsigned char Phaser::getpar(int npar) const
|
||||
{
|
||||
switch(npar) {
|
||||
case 0:
|
||||
return Pvolume;
|
||||
break;
|
||||
case 1:
|
||||
return Ppanning;
|
||||
break;
|
||||
case 2:
|
||||
return lfo.Pfreq;
|
||||
break;
|
||||
case 3:
|
||||
return lfo.Prandomness;
|
||||
break;
|
||||
case 4:
|
||||
return lfo.PLFOtype;
|
||||
break;
|
||||
case 5:
|
||||
return lfo.Pstereo;
|
||||
break;
|
||||
case 6:
|
||||
return Pdepth;
|
||||
break;
|
||||
case 7:
|
||||
return Pfb;
|
||||
break;
|
||||
case 8:
|
||||
return Pstages;
|
||||
break;
|
||||
case 9:
|
||||
return Plrcross;
|
||||
break;
|
||||
case 10:
|
||||
return Poutsub;
|
||||
break;
|
||||
case 11:
|
||||
return Pphase;
|
||||
break;
|
||||
default:
|
||||
return 0;
|
||||
case 0:
|
||||
return Pvolume;
|
||||
case 1:
|
||||
return Ppanning;
|
||||
case 2:
|
||||
return lfo.Pfreq;
|
||||
case 3:
|
||||
return lfo.Prandomness;
|
||||
case 4:
|
||||
return lfo.PLFOtype;
|
||||
case 5:
|
||||
return lfo.Pstereo;
|
||||
case 6:
|
||||
return Pdepth;
|
||||
case 7:
|
||||
return Pfb;
|
||||
case 8:
|
||||
return Pstages;
|
||||
case 9:
|
||||
return Plrcross;
|
||||
return Poffset;
|
||||
case 10:
|
||||
return Poutsub;
|
||||
case 11:
|
||||
return Pphase;
|
||||
return Pwidth;
|
||||
case 12:
|
||||
return Phyper;
|
||||
case 13:
|
||||
return Pdistortion;
|
||||
case 14:
|
||||
return Panalog;
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -3,7 +3,11 @@
|
||||
|
||||
Phaser.h - Phaser effect
|
||||
Copyright (C) 2002-2005 Nasca Octavian Paul
|
||||
Copyright (C) 2009-2010 Ryan Billing
|
||||
Copyright (C) 2010-2010 Mark McCurry
|
||||
Author: Nasca Octavian Paul
|
||||
Ryan Billing
|
||||
Mark McCurry
|
||||
|
||||
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
|
||||
@@ -23,53 +27,77 @@
|
||||
#ifndef PHASER_H
|
||||
#define PHASER_H
|
||||
#include "../globals.h"
|
||||
#include "../Misc/Stereo.h"
|
||||
#include "../Samples/AuSample.h"
|
||||
#include "Effect.h"
|
||||
#include "EffectLFO.h"
|
||||
|
||||
#define MAX_PHASER_STAGES 12
|
||||
/**Phaser Effect*/
|
||||
|
||||
class Phaser:public Effect
|
||||
{
|
||||
public:
|
||||
Phaser(const int &insetion_, REALTYPE *efxoutl_, REALTYPE *efxoutr_);
|
||||
Phaser(const int &insertion_, REALTYPE *efxoutl_, REALTYPE *efxoutr_);
|
||||
~Phaser();
|
||||
void out(REALTYPE *smpsl, REALTYPE *smpsr);
|
||||
void out(const Stereo<REALTYPE *> &input);
|
||||
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();
|
||||
|
||||
private:
|
||||
//Parametrii Phaser
|
||||
EffectLFO lfo; /**<lfo-ul Phaser*/
|
||||
unsigned char Pvolume;
|
||||
//Phaser parameters
|
||||
EffectLFO lfo; //Phaser modulator
|
||||
unsigned char Pvolume; //Used to set wet/dry mix
|
||||
unsigned char Ppanning;
|
||||
unsigned char Pdepth; /**<the depth of the Phaser*/
|
||||
unsigned char Pfb; /**<feedback*/
|
||||
unsigned char Plrcross; /**<feedback*/
|
||||
unsigned char Pstages;
|
||||
unsigned char Poutsub; /**<if I wish to substract the output instead of the adding it*/
|
||||
unsigned char Pdistortion; //Model distortion added by FET element
|
||||
unsigned char Pdepth; //Depth of phaser sweep
|
||||
unsigned char Pwidth; //Phaser width (LFO amplitude)
|
||||
unsigned char Pfb; //feedback
|
||||
unsigned char Poffset; //Model mismatch between variable resistors
|
||||
unsigned char Plrcross; //crossover
|
||||
unsigned char Pstages; //Number of first-order All-Pass stages
|
||||
unsigned char Poutsub; //if I wish to subtract the output instead of adding
|
||||
unsigned char Pphase;
|
||||
unsigned char Phyper; //lfo^2 -- converts tri into hyper-sine
|
||||
unsigned char Pbarber; //Enable parber pole phasing
|
||||
unsigned char Panalog;
|
||||
|
||||
//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 setdistortion(unsigned char Pdistortion);
|
||||
void setwidth(unsigned char Pwidth);
|
||||
void setoffset(unsigned char Poffset);
|
||||
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<REALTYPE> oldgain;
|
||||
//Internal Variables
|
||||
bool barber; //Barber pole phasing flag
|
||||
REALTYPE distortion, width, offsetpct;
|
||||
REALTYPE panning, feedback, depth, lrcross, phase;
|
||||
Stereo<REALTYPE *> old, xn1, yn1;
|
||||
Stereo<REALTYPE> diff, oldgain, fb;
|
||||
REALTYPE invperiod;
|
||||
REALTYPE offset[12];
|
||||
|
||||
float mis;
|
||||
float Rmin; // 3N5457 typical on resistance at Vgs = 0
|
||||
float Rmax; // Resistor parallel to FET
|
||||
float Rmx; // Rmin/Rmax to avoid division in loop
|
||||
float Rconst; // Handle parallel resistor relationship
|
||||
float C; // Capacitor
|
||||
float CFs; // A constant derived from capacitor and resistor relationships
|
||||
|
||||
void analog_setup();
|
||||
void AnalogPhase(const Stereo<REALTYPE *> &input);
|
||||
//analog case
|
||||
REALTYPE applyPhase(REALTYPE x, REALTYPE g, REALTYPE fb,
|
||||
REALTYPE &hpf, REALTYPE *yn1, REALTYPE *xn1);
|
||||
|
||||
void normalPhase(const Stereo<REALTYPE *> &input);
|
||||
REALTYPE applyPhase(REALTYPE x, REALTYPE g, REALTYPE *old);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
ZynAddSubFX - a software synthesizer
|
||||
|
||||
Reverb.C - Reverberation effect
|
||||
Reverb.cpp - Reverberation effect
|
||||
Copyright (C) 2002-2005 Nasca Octavian Paul
|
||||
Author: Nasca Octavian Paul
|
||||
|
||||
@@ -165,15 +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<float *> &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) {
|
||||
for(i = 0; i < SOUND_BUFFER_SIZE; i++) {
|
||||
@@ -184,7 +183,6 @@ void Reverb::out(REALTYPE *smps_l, REALTYPE *smps_r)
|
||||
idelayk++;
|
||||
if(idelayk >= idelaylen)
|
||||
idelayk = 0;
|
||||
;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -215,7 +213,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 +227,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;
|
||||
@@ -246,7 +244,6 @@ void Reverb::settime(const unsigned char &Ptime)
|
||||
combfb[i] =
|
||||
-exp((REALTYPE)comblen[i] / (REALTYPE)SAMPLE_RATE * log(0.001) / t);
|
||||
//the feedback is negative because it removes the DC
|
||||
;
|
||||
}
|
||||
|
||||
void Reverb::setlohidamp(unsigned char Plohidamp)
|
||||
@@ -271,7 +268,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 +287,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 +310,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 +402,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 +415,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 +465,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 +508,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:
|
||||
|
||||
@@ -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<float *> &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
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
ZynAddSubFX - a software synthesizer
|
||||
|
||||
ALSAMidiIn.C - Midi input for ALSA (this creates an ALSA virtual port)
|
||||
ALSAMidiIn.cpp - Midi input for ALSA (this creates an ALSA virtual port)
|
||||
Copyright (C) 2002-2005 Nasca Octavian Paul
|
||||
Author: Nasca Octavian Paul
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
ZynAddSubFX - a software synthesizer
|
||||
|
||||
MidiIn.C - This class is inherited by all the Midi input classes
|
||||
MidiIn.cpp - This class is inherited by all the Midi input classes
|
||||
Copyright (C) 2002-2005 Nasca Octavian Paul
|
||||
Author: Nasca Octavian Paul
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
ZynAddSubFX - a software synthesizer
|
||||
|
||||
NULLMidiIn.C - a dummy Midi port
|
||||
NULLMidiIn.cpp - a dummy Midi port
|
||||
Copyright (C) 2002-2005 Nasca Octavian Paul
|
||||
Author: Nasca Octavian Paul
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
ZynAddSubFX - a software synthesizer
|
||||
|
||||
OSSMidiIn.C - Midi input for Open Sound System
|
||||
OSSMidiIn.cpp - Midi input for Open Sound System
|
||||
Copyright (C) 2002-2005 Nasca Octavian Paul
|
||||
Author: Nasca Octavian Paul
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
ZynAddSubFX - a software synthesizer
|
||||
|
||||
WINMidiIn.C - Midi input for Windows
|
||||
WINMidiIn.cpp - Midi input for Windows
|
||||
Copyright (C) 2002-2005 Nasca Octavian Paul
|
||||
Author: Nasca Octavian Paul
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
ZynAddSubFX - a software synthesizer
|
||||
|
||||
Bank.C - Instrument Bank
|
||||
Bank.h - Instrument Bank
|
||||
Copyright (C) 2002-2005 Nasca Octavian Paul
|
||||
Author: Nasca Octavian Paul
|
||||
|
||||
|
||||
@@ -11,6 +11,10 @@ set(zynaddsubfx_misc_SRCS
|
||||
QtXmlWrapper.cpp
|
||||
)
|
||||
|
||||
if (LASH_FOUND)
|
||||
set(zynaddsubfx_misc_SRCS ${zynaddsubfx_misc_SRCS} LASHClient.cpp)
|
||||
endif()
|
||||
|
||||
add_library(zynaddsubfx_misc STATIC
|
||||
${zynaddsubfx_misc_SRCS}
|
||||
)
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
ZynAddSubFX - a software synthesizer
|
||||
|
||||
Config.C - Configuration file functions
|
||||
Config.cpp - Configuration file functions
|
||||
Copyright (C) 2003-2005 Nasca Octavian Paul
|
||||
Author: Nasca Octavian Paul
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
ZynAddSubFX - a software synthesizer
|
||||
|
||||
Dump.C - It dumps the notes to a text file
|
||||
Dump.cpp - It dumps the notes to a text file
|
||||
|
||||
Copyright (C) 2002-2005 Nasca Octavian Paul
|
||||
Author: Nasca Octavian Paul
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
ZynAddSubFX - a software synthesizer
|
||||
|
||||
LASHClient.C - LASH support
|
||||
LASHClient.cpp - LASH support
|
||||
Copyright (C) 2006-2009 Lars Luthman
|
||||
Author: Lars Luthman
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
ZynAddSubFX - a software synthesizer
|
||||
|
||||
Master.C - It sends Midi Messages to Parts, receives samples from parts,
|
||||
Master.cpp - It sends Midi Messages to Parts, receives samples from parts,
|
||||
process them with system/insertion effects and mix them
|
||||
Copyright (C) 2002-2005 Nasca Octavian Paul
|
||||
Author: Nasca Octavian Paul
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
ZynAddSubFX - a software synthesizer
|
||||
|
||||
Microtonal.C - Tuning settings and microtonal capabilities
|
||||
Microtonal.cpp - Tuning settings and microtonal capabilities
|
||||
Copyright (C) 2002-2005 Nasca Octavian Paul
|
||||
Author: Nasca Octavian Paul
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
ZynAddSubFX - a software synthesizer
|
||||
|
||||
Part.C - Part implementation
|
||||
Part.cpp - Part implementation
|
||||
Copyright (C) 2002-2005 Nasca Octavian Paul
|
||||
Author: Nasca Octavian Paul
|
||||
|
||||
@@ -249,7 +249,7 @@ void Part::NoteOn(unsigned char note,
|
||||
if(Ppolymode != 0) {
|
||||
fprintf(
|
||||
stderr,
|
||||
"ZynAddSubFX WARNING: Poly and Legato modes are both On, that should not happen ! ... Disabling Legato mode ! - (Part.C::NoteOn(..))\n");
|
||||
"ZynAddSubFX WARNING: Poly and Legato modes are both On, that should not happen ! ... Disabling Legato mode ! - (Part.cpp::NoteOn(..))\n");
|
||||
Plegatomode = 0;
|
||||
}
|
||||
else {
|
||||
@@ -293,7 +293,7 @@ void Part::NoteOn(unsigned char note,
|
||||
//test
|
||||
fprintf(stderr,
|
||||
"%s",
|
||||
"NOTES TOO MANY (> POLIPHONY) - (Part.C::NoteOn(..))\n");
|
||||
"NOTES TOO MANY (> POLIPHONY) - (Part.cpp::NoteOn(..))\n");
|
||||
else {
|
||||
//start the note
|
||||
partnote[pos].status = KEY_PLAYING;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
ZynAddSubFX - a software synthesizer
|
||||
|
||||
Stereo.C - Object for storing a pair of objects
|
||||
Stereo.cpp - Object for storing a pair of objects
|
||||
Copyright (C) 2009-2009 Mark McCurry
|
||||
Author: Mark McCurry
|
||||
|
||||
@@ -21,18 +21,19 @@
|
||||
|
||||
template<class T>
|
||||
Stereo<T>::Stereo(const T &left, const T &right)
|
||||
:leftChannel(left), rightChannel(right)
|
||||
:l(left), r(right)
|
||||
{}
|
||||
|
||||
template<class T>
|
||||
Stereo<T>::Stereo(const T &val)
|
||||
:leftChannel(val), rightChannel(val)
|
||||
:l(val), r(val)
|
||||
{}
|
||||
|
||||
template<class T>
|
||||
void Stereo<T>::operator=(const Stereo<T> &nstr)
|
||||
Stereo<T> &Stereo<T>::operator=(const Stereo<T> &nstr)
|
||||
{
|
||||
leftChannel = nstr.leftChannel;
|
||||
rightChannel = nstr.rightChannel;
|
||||
l = nstr.l;
|
||||
r = nstr.r;
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
#define STEREO_H
|
||||
|
||||
template<class T>
|
||||
class Stereo
|
||||
struct Stereo
|
||||
{
|
||||
public:
|
||||
Stereo(const T &left, const T &right);
|
||||
@@ -32,34 +32,10 @@ class Stereo
|
||||
Stereo(const T &val);
|
||||
~Stereo() {}
|
||||
|
||||
void operator=(const Stereo<T> &smp);
|
||||
T &left() {
|
||||
return leftChannel;
|
||||
}
|
||||
T &right() {
|
||||
return rightChannel;
|
||||
}
|
||||
T &l() {
|
||||
return leftChannel;
|
||||
}
|
||||
T &r() {
|
||||
return rightChannel;
|
||||
}
|
||||
const T &left() const {
|
||||
return leftChannel;
|
||||
}
|
||||
const T &right() const {
|
||||
return rightChannel;
|
||||
}
|
||||
const T &l() const {
|
||||
return leftChannel;
|
||||
}
|
||||
const T &r() const {
|
||||
return rightChannel;
|
||||
}
|
||||
private:
|
||||
T leftChannel;
|
||||
T rightChannel;
|
||||
Stereo<T> &operator=(const Stereo<T> &smp);
|
||||
|
||||
//data
|
||||
T l, r;
|
||||
};
|
||||
#include "Stereo.cpp"
|
||||
#endif
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
ZynAddSubFX - a software synthesizer
|
||||
|
||||
Util.C - Miscellaneous functions
|
||||
Util.cpp - Miscellaneous functions
|
||||
Copyright (C) 2002-2005 Nasca Octavian Paul
|
||||
Author: Nasca Octavian Paul
|
||||
|
||||
@@ -113,3 +113,18 @@ bool fileexists(const char *filename)
|
||||
return false;
|
||||
}
|
||||
|
||||
void invSignal(REALTYPE *sig, size_t len)
|
||||
{
|
||||
for(int i = 0; i < len; i++)
|
||||
sig[i] *= -1.0f;
|
||||
}
|
||||
|
||||
void crossover(REALTYPE &a, REALTYPE &b, REALTYPE crossover)
|
||||
{
|
||||
REALTYPE tmpa = a;
|
||||
REALTYPE tmpb = b;
|
||||
a = tmpa * (1.0 - crossover) + tmpb * crossover;
|
||||
b = tmpb * (1.0 - crossover) + tmpa * crossover;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -42,6 +42,10 @@ extern REALTYPE *denormalkillbuf; /**<the buffer to add noise in order to avoid
|
||||
|
||||
extern Config config;
|
||||
|
||||
void invSignal(REALTYPE *sig, size_t len);
|
||||
|
||||
void crossover(REALTYPE &a, REALTYPE &b, REALTYPE crossover);
|
||||
|
||||
template<class T>
|
||||
std::string stringFrom(T x)
|
||||
{
|
||||
@@ -60,5 +64,11 @@ T stringTo(const char *x)
|
||||
return ans;
|
||||
}
|
||||
|
||||
template <class T>
|
||||
T limit(T val, T min, T max)
|
||||
{
|
||||
return (val < min ? min : (val > max ? max : val));
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
ZynAddSubFX - a software synthesizer
|
||||
|
||||
XMLwrapper.C - XML wrapper
|
||||
XMLwrapper.cpp - XML wrapper
|
||||
Copyright (C) 2003-2005 Nasca Octavian Paul
|
||||
Copyright (C) 2009-2009 Mark McCurry
|
||||
Author: Nasca Octavian Paul
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
ZynAddSubFX - a software synthesizer
|
||||
|
||||
DSSIaudiooutput.C - Audio functions for DSSI
|
||||
DSSIaudiooutput.cpp - Audio functions for DSSI
|
||||
Copyright (C) 2002 Nasca Octavian Paul
|
||||
Author: Nasca Octavian Paul
|
||||
|
||||
@@ -20,268 +20,666 @@
|
||||
|
||||
*/
|
||||
|
||||
/*
|
||||
* Inital working DSSI output code contributed by Stephen G. Parry
|
||||
*/
|
||||
|
||||
//this file contains code used from trivial_synth.c from
|
||||
//the DSSI (published by Steve Harris under public domain) as a template
|
||||
//the code is incomplete
|
||||
//the DSSI (published by Steve Harris under public domain) as a template.
|
||||
|
||||
#include <string.h>
|
||||
#include "DSSIaudiooutput.h"
|
||||
#include "../Misc/Config.h"
|
||||
#include "../Misc/Bank.h"
|
||||
#include <limits.h>
|
||||
|
||||
static LADSPA_Descriptor *tsLDescriptor = NULL;
|
||||
static DSSI_Descriptor *tsDDescriptor = NULL;
|
||||
|
||||
typedef struct {
|
||||
LADSPA_Data *outl;
|
||||
LADSPA_Data *outr;
|
||||
// note_data data[MIDI_NOTES];
|
||||
// float omega[MIDI_NOTES];
|
||||
} TS;
|
||||
|
||||
|
||||
static void cleanupTS(LADSPA_Handle instance)
|
||||
//
|
||||
// Static stubs for LADSPA member functions
|
||||
//
|
||||
// LADSPA is essentially a C handle based API; This plug-in implementation is
|
||||
// a C++ OO one so we need stub functions to map from C API calls to C++ object
|
||||
// method calls.
|
||||
void DSSIaudiooutput::stub_connectPort(LADSPA_Handle instance, unsigned long port, LADSPA_Data * data)
|
||||
{
|
||||
free(instance);
|
||||
getInstance(instance)->connectPort(port, data);
|
||||
}
|
||||
static void connectPortTS(LADSPA_Handle instance, unsigned long port,
|
||||
LADSPA_Data *data)
|
||||
|
||||
void DSSIaudiooutput::stub_activate(LADSPA_Handle instance)
|
||||
{
|
||||
TS *plugin;
|
||||
plugin = (TS *) instance;
|
||||
switch(port) {
|
||||
case 0:
|
||||
plugin->outl = data;
|
||||
break;
|
||||
case 1:
|
||||
plugin->outr = data;
|
||||
break;
|
||||
}
|
||||
getInstance(instance)->activate();
|
||||
}
|
||||
|
||||
void DSSIaudiooutput::stub_run(LADSPA_Handle instance, unsigned long sample_count)
|
||||
{
|
||||
getInstance(instance)->run(sample_count);
|
||||
}
|
||||
|
||||
void DSSIaudiooutput::stub_deactivate(LADSPA_Handle instance)
|
||||
{
|
||||
getInstance(instance)->deactivate();
|
||||
}
|
||||
|
||||
|
||||
void DSSIaudiooutput::stub_cleanup(LADSPA_Handle instance)
|
||||
{
|
||||
DSSIaudiooutput* plugin_instance = getInstance(instance);
|
||||
plugin_instance->cleanup();
|
||||
delete plugin_instance;
|
||||
}
|
||||
|
||||
|
||||
const LADSPA_Descriptor *ladspa_descriptor(unsigned long index)
|
||||
{
|
||||
switch(index) {
|
||||
case 0:
|
||||
return tsLDescriptor;
|
||||
default:
|
||||
return NULL;
|
||||
}
|
||||
return DSSIaudiooutput::getLadspaDescriptor(index);
|
||||
}
|
||||
|
||||
//
|
||||
// Static stubs for DSSI member functions
|
||||
//
|
||||
// DSSI is essentially a C handle based API; This plug-in implementation is
|
||||
// a C++ OO one so we need stub functions to map from C API calls to C++ object
|
||||
// method calls.
|
||||
const DSSI_Program_Descriptor* DSSIaudiooutput::stub_getProgram (LADSPA_Handle instance, unsigned long index)
|
||||
{
|
||||
return getInstance(instance)->getProgram(index);
|
||||
}
|
||||
|
||||
void DSSIaudiooutput::stub_selectProgram(LADSPA_Handle instance, unsigned long bank, unsigned long program)
|
||||
{
|
||||
getInstance(instance)->selectProgram(bank, program);
|
||||
}
|
||||
|
||||
int DSSIaudiooutput::stub_getMidiControllerForPort(LADSPA_Handle instance, unsigned long port)
|
||||
{
|
||||
return getInstance(instance)->getMidiControllerForPort(port);
|
||||
}
|
||||
|
||||
void DSSIaudiooutput::stub_runSynth(LADSPA_Handle instance, unsigned long sample_count,
|
||||
snd_seq_event_t *events, unsigned long event_count)
|
||||
{
|
||||
getInstance(instance)->runSynth(sample_count, events, event_count);
|
||||
}
|
||||
|
||||
const DSSI_Descriptor *dssi_descriptor(unsigned long index)
|
||||
{
|
||||
// FILE *a=fopen("/tmp/zzzzz11z","w");
|
||||
// fprintf(a,"aaaaaaaaaaa TEST\n");
|
||||
// fclose(a);
|
||||
switch(index) {
|
||||
case 0:
|
||||
return tsDDescriptor;
|
||||
default:
|
||||
return DSSIaudiooutput::getDssiDescriptor(index);
|
||||
}
|
||||
|
||||
//
|
||||
// LADSPA member functions
|
||||
//
|
||||
|
||||
/**
|
||||
* Instantiates a plug-in.
|
||||
*
|
||||
* This LADSPA member function instantiates a plug-in.
|
||||
* Note that instance initialisation should generally occur in
|
||||
* activate() rather than here.
|
||||
*
|
||||
* Zyn Implementation
|
||||
* ------------------
|
||||
* This implementation creates a C++ class object and hides its pointer
|
||||
* in the handle by type casting.
|
||||
*
|
||||
* @param descriptor [in] the descriptor for this plug-in
|
||||
* @param s_rate [in] the sample rate
|
||||
* @return the plug-in instance handle if successful else NULL
|
||||
*/
|
||||
LADSPA_Handle DSSIaudiooutput::instantiate(const LADSPA_Descriptor * descriptor, unsigned long s_rate)
|
||||
{
|
||||
if(descriptor->UniqueID == dssiDescriptor->LADSPA_Plugin->UniqueID)
|
||||
{
|
||||
return (LADSPA_Handle)(new DSSIaudiooutput(s_rate));
|
||||
}
|
||||
else
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
static LADSPA_Handle instantiateTS(const LADSPA_Descriptor *descriptor,
|
||||
unsigned long s_rate)
|
||||
/**
|
||||
* Connects a port on an instantiated plug-in.
|
||||
*
|
||||
* This LADSPA member function connects a port on an instantiated plug-in to a
|
||||
* memory location at which a block of data for the port will be read/written.
|
||||
* The data location is expected to be an array of LADSPA_Data for audio ports
|
||||
* or a single LADSPA_Data value for control ports. Memory issues will be
|
||||
* managed by the host. The plug-in must read/write the data at these locations
|
||||
* every time run() or run_adding() is called and the data present at the time
|
||||
* of this connection call should not be considered meaningful.
|
||||
*
|
||||
* Zyn Implementation
|
||||
* ------------------
|
||||
* The buffer pointers are stored as member variables
|
||||
*
|
||||
* @param port [in] the port to be connected
|
||||
* @param data [in] the data buffer to write to / read from
|
||||
*/
|
||||
void DSSIaudiooutput::connectPort(unsigned long port, LADSPA_Data * data)
|
||||
{
|
||||
TS *plugin_data = (TS *) malloc(sizeof(TS));
|
||||
/* for (i=0; i<MIDI_NOTES; i++) {
|
||||
plugin_data->omega[i] = M_PI * 2.0 / (double)s_rate *
|
||||
pow(2.0, (i-69.0) / 12.0);
|
||||
}
|
||||
*/
|
||||
return (LADSPA_Handle) plugin_data;
|
||||
}
|
||||
|
||||
static void activateTS(LADSPA_Handle instance)
|
||||
{
|
||||
TS *plugin_data = (TS *) instance;
|
||||
|
||||
// for (i=0; i<MIDI_NOTES; i++) {
|
||||
// plugin_data->data[i].active = 0;
|
||||
// }
|
||||
}
|
||||
|
||||
|
||||
static void runTS(LADSPA_Handle instance, unsigned long sample_count,
|
||||
snd_seq_event_t *events, unsigned long event_count)
|
||||
{
|
||||
TS *plugin_data = (TS *) instance;
|
||||
// LADSPA_Data *const output = plugin_data->output;
|
||||
// LADSPA_Data freq = *(plugin_data->freq);
|
||||
// LADSPA_Data vol = *(plugin_data->vol);
|
||||
// note_data *data = plugin_data->data;
|
||||
unsigned long pos;
|
||||
unsigned long event_pos;
|
||||
unsigned long note;
|
||||
|
||||
/* if (freq < 1.0) {
|
||||
freq = 440.0f;
|
||||
}
|
||||
if (vol < 0.000001) {
|
||||
vol = 1.0f;
|
||||
}
|
||||
|
||||
if (event_count > 0) {
|
||||
printf("trivial_synth: have %ld events\n", event_count);
|
||||
}
|
||||
|
||||
for (pos = 0, event_pos = 0; pos < sample_count; pos++) {
|
||||
|
||||
while (event_pos < event_count
|
||||
&& pos == events[event_pos].time.tick) {
|
||||
|
||||
printf("trivial_synth: event type %d\n", events[event_pos].type);
|
||||
|
||||
if (events[event_pos].type == SND_SEQ_EVENT_NOTEON) {
|
||||
data[events[event_pos].data.note.note].amp =
|
||||
events[event_pos].data.note.velocity / 512.0f;
|
||||
data[events[event_pos].data.note.note].
|
||||
active = events[event_pos].data.note.velocity > 0;
|
||||
data[events[event_pos].data.note.note].
|
||||
phase = 0.0;
|
||||
} else if (events[event_pos].type == SND_SEQ_EVENT_NOTEOFF) {
|
||||
data[events[event_pos].data.note.note].
|
||||
active = 0;
|
||||
}
|
||||
event_pos++;
|
||||
}
|
||||
|
||||
output[pos] = 0.0f;
|
||||
for (note = 0; note < MIDI_NOTES; note++) {
|
||||
if (data[note].active) {
|
||||
output[pos] += sin(data[note].phase) * data[note].amp * vol;
|
||||
data[note].phase += plugin_data->omega[note] * freq;
|
||||
if (data[note].phase > M_PI * 2.0) {
|
||||
data[note].phase -= M_PI * 2.0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
|
||||
static void runTSWrapper(LADSPA_Handle instance,
|
||||
unsigned long sample_count)
|
||||
{
|
||||
runTS(instance, sample_count, NULL, 0);
|
||||
}
|
||||
|
||||
int getControllerTS(LADSPA_Handle instance, unsigned long port)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
void _init()
|
||||
{
|
||||
char **port_names;
|
||||
LADSPA_PortDescriptor *port_descriptors;
|
||||
LADSPA_PortRangeHint *port_range_hints;
|
||||
|
||||
FILE *a = fopen("/tmp/zzzzzz", "w");
|
||||
fprintf(a, "aaaaaaaaaaa TEST\n");
|
||||
fclose(a);
|
||||
|
||||
|
||||
tsLDescriptor = (LADSPA_Descriptor *) malloc(sizeof(LADSPA_Descriptor));
|
||||
if(tsLDescriptor) {
|
||||
tsLDescriptor->UniqueID = 100;
|
||||
tsLDescriptor->Label = "ZASF";
|
||||
tsLDescriptor->Properties = 0;
|
||||
tsLDescriptor->Name = "ZynAddSubFX";
|
||||
tsLDescriptor->Maker =
|
||||
"Nasca Octavian Paul <zynaddsubfx@yahoo.com>";
|
||||
tsLDescriptor->Copyright = "GNU General Public License v.2";
|
||||
tsLDescriptor->PortCount = 2;
|
||||
|
||||
port_descriptors = (LADSPA_PortDescriptor *)
|
||||
calloc(tsLDescriptor->PortCount, sizeof
|
||||
(LADSPA_PortDescriptor));
|
||||
tsLDescriptor->PortDescriptors =
|
||||
(const LADSPA_PortDescriptor *) port_descriptors;
|
||||
|
||||
port_range_hints = (LADSPA_PortRangeHint *)
|
||||
calloc(tsLDescriptor->PortCount, sizeof
|
||||
(LADSPA_PortRangeHint));
|
||||
tsLDescriptor->PortRangeHints =
|
||||
(const LADSPA_PortRangeHint *) port_range_hints;
|
||||
|
||||
port_names = (char **) calloc(tsLDescriptor->PortCount, sizeof(char *));
|
||||
tsLDescriptor->PortNames = (const char **) port_names;
|
||||
|
||||
port_descriptors[0] = LADSPA_PORT_OUTPUT | LADSPA_PORT_AUDIO;
|
||||
port_names[0] = "Output L";
|
||||
port_range_hints[0].HintDescriptor = 0;
|
||||
port_descriptors[1] = LADSPA_PORT_OUTPUT | LADSPA_PORT_AUDIO;
|
||||
port_names[1] = "Output R";
|
||||
port_range_hints[1].HintDescriptor = 0;
|
||||
|
||||
tsLDescriptor->activate = activateTS;
|
||||
tsLDescriptor->cleanup = cleanupTS;
|
||||
tsLDescriptor->connect_port = connectPortTS;
|
||||
tsLDescriptor->deactivate = NULL;
|
||||
tsLDescriptor->instantiate = instantiateTS;
|
||||
tsLDescriptor->run = runTSWrapper;
|
||||
tsLDescriptor->run_adding = NULL;
|
||||
tsLDescriptor->set_run_adding_gain = NULL;
|
||||
}
|
||||
|
||||
tsDDescriptor = (DSSI_Descriptor *) malloc(sizeof(DSSI_Descriptor));
|
||||
if(tsDDescriptor) {
|
||||
tsDDescriptor->DSSI_API_Version = 1;
|
||||
tsDDescriptor->LADSPA_Plugin = tsLDescriptor;
|
||||
tsDDescriptor->configure = NULL;
|
||||
tsDDescriptor->get_program = NULL;
|
||||
tsDDescriptor->get_midi_controller_for_port = getControllerTS;
|
||||
tsDDescriptor->select_program = NULL;
|
||||
tsDDescriptor->run_synth = runTS;
|
||||
tsDDescriptor->run_synth_adding = NULL;
|
||||
tsDDescriptor->run_multiple_synths = NULL;
|
||||
tsDDescriptor->run_multiple_synths_adding = NULL;
|
||||
switch (port) {
|
||||
case 0:
|
||||
outl = data;
|
||||
break;
|
||||
case 1:
|
||||
outr = data;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void _fini()
|
||||
{}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//the constructor and the destructor are defined in main.C
|
||||
/*
|
||||
void VSTSynth::process (float **inputs, float **outputs, long sampleframes){
|
||||
float *outl=outputs[0];
|
||||
float *outr=outputs[1];
|
||||
pthread_mutex_lock(&vmaster->mutex);
|
||||
vmaster->GetAudioOutSamples(sampleframes,(int) getSampleRate(),outl,outr);
|
||||
pthread_mutex_unlock(&vmaster->mutex);
|
||||
};
|
||||
|
||||
void VSTSynth::processReplacing (float **inputs, float **outputs, long sampleframes){
|
||||
process(inputs,outputs,sampleframes);
|
||||
};
|
||||
|
||||
long int VSTSynth::canDo(char *txt){
|
||||
if (strcmp(txt,"receiveVstEvents")==0) return (1);
|
||||
if (strcmp(txt,"receiveVstMidiEvent")==0) return (1);
|
||||
return(-1);
|
||||
};
|
||||
|
||||
bool VSTSynth::getVendorString(char *txt){
|
||||
strcpy(txt,"Nasca O. Paul");
|
||||
return(true);
|
||||
};
|
||||
|
||||
bool VSTSynth::getProductString(char *txt){
|
||||
strcpy(txt,"ZynAddSubFX");
|
||||
return(true);
|
||||
};
|
||||
|
||||
void VSTSynth::resume(){
|
||||
wantEvents();
|
||||
};
|
||||
|
||||
/**
|
||||
* Initialises a plug-in instance and activates it for use.
|
||||
*
|
||||
* This LADSPA member function initialises a plug-in instance and activates it
|
||||
* for use. This is separated from instantiate() to aid real-time support and
|
||||
* so that hosts can reinitialise a plug-in instance by calling deactivate() and
|
||||
* then activate(). In this case the plug-in instance must reset all state
|
||||
* information dependent on the history of the plug-in instance except for any
|
||||
* data locations provided by connect_port() and any gain set by
|
||||
* set_run_adding_gain().
|
||||
*
|
||||
* Zyn Implementation
|
||||
* ------------------
|
||||
* Currently this does nothing; Care must be taken as to code placed here as
|
||||
* too much code here seems to cause time-out problems in jack-dssi-host.
|
||||
*/
|
||||
void DSSIaudiooutput::activate()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Runs an instance of a plug-in for a block.
|
||||
*
|
||||
* This LADSPA member function runs an instance of a plug-in for a block.
|
||||
* Note that if an activate() function exists then it must be called before
|
||||
* run() or run_adding(). If deactivate() is called for a plug-in instance then
|
||||
* the plug-in instance may not be reused until activate() has been called again.
|
||||
*
|
||||
* Zyn Implementation
|
||||
* ------------------
|
||||
* This is a LADSPA function that does not process any MIDI events; it is hence
|
||||
* implemented by simply calling runSynth() with an empty event list.
|
||||
*
|
||||
* @param sample_count [in] the block size (in samples) for which the plug-in instance may run
|
||||
*/
|
||||
void DSSIaudiooutput::run(unsigned long sample_count)
|
||||
{
|
||||
runSynth(sample_count,NULL,(unsigned long)0);
|
||||
}
|
||||
|
||||
/**
|
||||
* Counterpart to activate().
|
||||
*
|
||||
* This LADSPA member function is the counterpart to activate() (see above).
|
||||
* Deactivation is not similar to pausing as the plug-in instance will be
|
||||
* reinitialised when activate() is called to reuse it.
|
||||
*
|
||||
* Zyn Implementation
|
||||
* ------------------
|
||||
* Currently this function does nothing.
|
||||
*/
|
||||
void DSSIaudiooutput::deactivate()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Deletes a plug-in instance that is no longer required.
|
||||
*
|
||||
* LADSPA member function; once an instance of a plug-in has been finished with
|
||||
* it can be deleted using this function. The instance handle ceases to be
|
||||
* valid after this call.
|
||||
*
|
||||
* If activate() was called for a plug-in instance then a corresponding call to
|
||||
* deactivate() must be made before cleanup() is called.
|
||||
*
|
||||
* Zyn Implementation
|
||||
* ------------------
|
||||
* Currently cleanup is deferred to the destructor that is invoked after cleanup()
|
||||
*/
|
||||
void DSSIaudiooutput::cleanup()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Initial entry point for the LADSPA plug-in library.
|
||||
*
|
||||
* This LADSPA function is the initial entry point for the plug-in library.
|
||||
* The LADSPA host looks for this entry point in each shared library object it
|
||||
* finds and then calls the function to enumerate the plug-ins within the
|
||||
* library.
|
||||
*
|
||||
* Zyn Implementation
|
||||
* ------------------
|
||||
* As the Zyn plug-in is a DSSI plug-in, the LADSPA descriptor is embedded inside
|
||||
* the DSSI descriptor, which is created by DSSIaudiooutput::initDssiDescriptor()
|
||||
* statically when the library is loaded. This function then merely returns a pointer
|
||||
* to that embedded descriptor.
|
||||
*
|
||||
* @param index [in] the index number of the plug-in within the library.
|
||||
* @return if index is in range, a pointer to the plug-in descriptor is returned, else NULL
|
||||
*/
|
||||
const LADSPA_Descriptor* DSSIaudiooutput::getLadspaDescriptor(unsigned long index)
|
||||
{
|
||||
if(index > 0 || dssiDescriptor == NULL)
|
||||
return NULL;
|
||||
else
|
||||
return dssiDescriptor->LADSPA_Plugin;
|
||||
}
|
||||
|
||||
//
|
||||
// DSSI member functions
|
||||
//
|
||||
|
||||
/**
|
||||
* Provides a description of a program available on this synth.
|
||||
*
|
||||
* This DSSI member function pointer provides a description of a program (named
|
||||
* preset sound) available on this synth.
|
||||
*
|
||||
* Zyn Implementation
|
||||
* ------------------
|
||||
* The instruments in all Zyn's bank directories, as shown by the `instrument
|
||||
* -> show instrument bank` command, are enumerated to the host by this
|
||||
* function, allowing access to all those instruments.
|
||||
* The first time an instrument is requested, the bank it is in and any
|
||||
* unmapped ones preceding that are mapped; all the instruments names and
|
||||
* filenames from those banks are stored in the programMap member variable for
|
||||
* later use. This is done on demand in this way, rather than up front in one
|
||||
* go because loading all the instrument names in one go can lead to timeouts
|
||||
* and zombies.
|
||||
*
|
||||
* @param index [in] index into the plug-in's list of
|
||||
* programs, not a program number as represented by the Program
|
||||
* field of the DSSI_Program_Descriptor. (This distinction is
|
||||
* needed to support synths that use non-contiguous program or
|
||||
* bank numbers.)
|
||||
* @return a DSSI_Program_Descriptor pointer that is
|
||||
* guaranteed to be valid only until the next call to get_program,
|
||||
* deactivate, or configure, on the same plug-in instance, or NULL if index is out of range.
|
||||
*/
|
||||
const DSSI_Program_Descriptor* DSSIaudiooutput::getProgram (unsigned long index)
|
||||
{
|
||||
static DSSI_Program_Descriptor retVal;
|
||||
|
||||
/* Make sure we have the list of banks loaded */
|
||||
initBanks();
|
||||
|
||||
/* Make sure that the bank containing the instrument has been mapped */
|
||||
while (index >= programMap.size() && mapNextBank())
|
||||
/* DO NOTHING MORE */;
|
||||
|
||||
if(index >= programMap.size())
|
||||
{
|
||||
/* No more instruments */
|
||||
return NULL;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* OK, return the instrument */
|
||||
retVal.Name = programMap[index].name.c_str();
|
||||
retVal.Program = programMap[index].program;
|
||||
retVal.Bank = programMap[index].bank;
|
||||
return &retVal;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Selects a new program for this synth.
|
||||
*
|
||||
* This DSSI member function selects a new program for this synth. The program
|
||||
* change will take effect immediately at the start of the next run_synth()
|
||||
* call. An invalid bank / instrument combination is ignored.
|
||||
*
|
||||
* Zyn Implementation
|
||||
* ------------------
|
||||
* the banks and instruments are as shown in the `instrument -> show instrument
|
||||
* bank` command in Zyn. The bank no is a 1-based index into the list of banks
|
||||
* Zyn loads and shows in the drop down and the program number is the
|
||||
* instrument within that bank.
|
||||
*
|
||||
* @param bank [in] the bank number to select
|
||||
* @param program [in] the program number within the bank to select
|
||||
*/
|
||||
void DSSIaudiooutput::selectProgram(unsigned long bank, unsigned long program)
|
||||
{
|
||||
initBanks();
|
||||
// cerr << "selectProgram(" << (bank & 0x7F) << ':' << ((bank >> 7) & 0x7F) << "," << program << ")" << '\n';
|
||||
if(bank < MAX_NUM_BANKS && program < BANK_SIZE)
|
||||
{
|
||||
char* bankdir = master->bank.banks[ bank ].dir;
|
||||
if(bankdir != NULL)
|
||||
{
|
||||
pthread_mutex_lock(&master->mutex);
|
||||
|
||||
/* We have to turn off the CheckPADsynth functionality, else
|
||||
* the program change takes way too long and we get timeouts
|
||||
* and hence zombies (!) */
|
||||
int save = config.cfg.CheckPADsynth;
|
||||
config.cfg.CheckPADsynth = 0;
|
||||
|
||||
/* Load the bank... */
|
||||
master->bank.loadbank(bankdir);
|
||||
|
||||
/* restore the CheckPADsynth flag */
|
||||
config.cfg.CheckPADsynth = save;
|
||||
|
||||
/* Now load the instrument... */
|
||||
master->bank.loadfromslot((unsigned int)program, master->part[0]);
|
||||
|
||||
pthread_mutex_unlock(&master->mutex);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the MIDI controller number or NRPN for a input control port
|
||||
*
|
||||
* This DSSI member function returns the MIDI controller number or NRPN that
|
||||
* should be mapped to the given input control port. If the given port should
|
||||
* not have any MIDI controller mapped to it, the function will return DSSI_NONE.
|
||||
* The behaviour of this function is undefined if the given port
|
||||
* number does not correspond to an input control port.
|
||||
*
|
||||
* Zyn Implementation
|
||||
* ------------------
|
||||
* Currently Zyn does not define any controller ports, but may do in the future.
|
||||
*
|
||||
* @param port [in] the input controller port
|
||||
* @return the CC and NRPN values shifted and ORed together.
|
||||
*/
|
||||
int DSSIaudiooutput::getMidiControllerForPort(unsigned long port)
|
||||
{
|
||||
return DSSI_NONE;
|
||||
}
|
||||
|
||||
/**
|
||||
* Runs the synth for a block.
|
||||
*
|
||||
* This DSSI member function runs the synth for a block. This is identical in
|
||||
* function to the LADSPA run() function, except that it also supplies events
|
||||
* to the synth.
|
||||
*
|
||||
* Zyn Implementation
|
||||
* ------------------
|
||||
* Zyn implements synthesis in Master::GetAudioOutSamples; runSynth calls this
|
||||
* function in chunks delimited by the sample_count and the frame indexes in
|
||||
* the events block, calling the appropriate NoteOn, NoteOff and SetController
|
||||
* members of Master to process the events supplied between each chunk.
|
||||
*
|
||||
* @param sample_count [in] the block size (in samples) for which the synth
|
||||
* instance may run.
|
||||
* @param events [in] The Events pointer points to a block of ALSA
|
||||
* sequencer events, used to communicate MIDI and related events to the synth.
|
||||
* Each event must be timestamped relative to the start of the block,
|
||||
* (mis)using the ALSA "tick time" field as a frame count. The host is
|
||||
* responsible for ensuring that events with differing timestamps are already
|
||||
* ordered by time. Must not include NOTE (only NOTE_ON / NOTE_OFF), LSB or MSB
|
||||
* events.
|
||||
* @param event_count [in] the number of entries in the `events` block
|
||||
*/
|
||||
void DSSIaudiooutput::runSynth(unsigned long sample_count, snd_seq_event_t *events, unsigned long event_count)
|
||||
{
|
||||
unsigned long from_frame = 0;
|
||||
unsigned long event_index = 0;
|
||||
unsigned long next_event_frame = 0;
|
||||
unsigned long to_frame = 0;
|
||||
pthread_mutex_lock(&master->mutex);
|
||||
|
||||
do {
|
||||
/* Find the time of the next event, if any */
|
||||
if(events == NULL || event_index >= event_count)
|
||||
next_event_frame = ULONG_MAX;
|
||||
else
|
||||
next_event_frame = events[event_index].time.tick;
|
||||
|
||||
/* find the end of the sub-sample to be processed this time round... */
|
||||
/* if the next event falls within the desired sample interval... */
|
||||
if(next_event_frame < sample_count && next_event_frame >= to_frame)
|
||||
/* set the end to be at that event */
|
||||
to_frame = next_event_frame;
|
||||
else
|
||||
/* ...else go for the whole remaining sample */
|
||||
to_frame = sample_count;
|
||||
if(from_frame<to_frame)
|
||||
{
|
||||
// call master to fill from `from_frame` to `to_frame`:
|
||||
master->GetAudioOutSamples(to_frame - from_frame, (int)sampleRate, &(outl[from_frame]), &(outr[from_frame]));
|
||||
// next sub-sample please...
|
||||
from_frame = to_frame;
|
||||
}
|
||||
|
||||
// Now process any event(s) at the current timing point
|
||||
while(events != NULL && event_index < event_count && events[event_index].time.tick == to_frame)
|
||||
{
|
||||
if(events[event_index].type == SND_SEQ_EVENT_NOTEON)
|
||||
{
|
||||
master->NoteOn(events[event_index].data.note.channel, events[event_index].data.note.note, events[event_index].data.note.velocity);
|
||||
}
|
||||
else if(events[event_index].type == SND_SEQ_EVENT_NOTEOFF)
|
||||
{
|
||||
master->NoteOff(events[event_index].data.note.channel, events[event_index].data.note.note);
|
||||
}
|
||||
else if(events[event_index].type == SND_SEQ_EVENT_CONTROLLER)
|
||||
{
|
||||
master->SetController(events[event_index].data.control.channel, events[event_index].data.control.param, events[event_index].data.control.value);
|
||||
}
|
||||
else
|
||||
{
|
||||
}
|
||||
event_index++;
|
||||
}
|
||||
|
||||
// Keep going until we have the desired total length of sample...
|
||||
} while(to_frame < sample_count);
|
||||
|
||||
pthread_mutex_unlock(&master->mutex);
|
||||
}
|
||||
|
||||
/**
|
||||
* Initial entry point for the DSSI plug-in library.
|
||||
*
|
||||
* This DSSI function is the initial entry point for the plug-in library.
|
||||
* The DSSI host looks for this entry point in each shared library object it
|
||||
* finds and then calls the function to enumerate the plug-ins within the
|
||||
* library.
|
||||
*
|
||||
* Zyn Implementation
|
||||
* ------------------
|
||||
* The descriptor is created statically by DSSIaudiooutput::initDssiDescriptor()
|
||||
* when the plug-in library is loaded. This function merely returns a pointer to
|
||||
* that descriptor.
|
||||
*
|
||||
* @param index [in] the index number of the plug-in within the library.
|
||||
* @return if index is in range, a pointer to the plug-in descriptor is returned, else NULL
|
||||
*/
|
||||
const DSSI_Descriptor* DSSIaudiooutput::getDssiDescriptor(unsigned long index)
|
||||
{
|
||||
if(index > 0 || dssiDescriptor == NULL)
|
||||
return NULL;
|
||||
else
|
||||
return dssiDescriptor;
|
||||
}
|
||||
|
||||
//
|
||||
// Internal member functions
|
||||
//
|
||||
|
||||
// Initialise the DSSI descriptor, statically:
|
||||
DSSI_Descriptor* DSSIaudiooutput::dssiDescriptor = DSSIaudiooutput::initDssiDescriptor();
|
||||
|
||||
/**
|
||||
* Initializes the DSSI (and LADSPA) descriptor, returning it is an object.
|
||||
*/
|
||||
DSSI_Descriptor* DSSIaudiooutput::initDssiDescriptor()
|
||||
{
|
||||
DSSI_Descriptor* newDssiDescriptor = new DSSI_Descriptor;
|
||||
|
||||
LADSPA_PortDescriptor* newPortDescriptors;
|
||||
char** newPortNames;
|
||||
LADSPA_PortRangeHint* newPortRangeHints;
|
||||
|
||||
if (newDssiDescriptor)
|
||||
{
|
||||
LADSPA_Descriptor* newLadspaDescriptor = new LADSPA_Descriptor;
|
||||
if (newLadspaDescriptor)
|
||||
{
|
||||
newLadspaDescriptor->UniqueID = 100;
|
||||
newLadspaDescriptor->Label = "ZASF";
|
||||
newLadspaDescriptor->Properties = 0;
|
||||
newLadspaDescriptor->Name = "ZynAddSubFX";
|
||||
newLadspaDescriptor->Maker = "Nasca Octavian Paul <zynaddsubfx@yahoo.com>";
|
||||
newLadspaDescriptor->Copyright = "GNU General Public License v.2";
|
||||
newLadspaDescriptor->PortCount = 2;
|
||||
|
||||
newPortNames = new char *[newLadspaDescriptor->PortCount];
|
||||
newPortNames[0] = "Output L";
|
||||
newPortNames[1] = "Output R";
|
||||
newLadspaDescriptor->PortNames = newPortNames;
|
||||
|
||||
newPortDescriptors = new LADSPA_PortDescriptor[newLadspaDescriptor->PortCount];
|
||||
newPortDescriptors[0] = LADSPA_PORT_OUTPUT | LADSPA_PORT_AUDIO;
|
||||
newPortDescriptors[1] = LADSPA_PORT_OUTPUT | LADSPA_PORT_AUDIO;
|
||||
newLadspaDescriptor->PortDescriptors = newPortDescriptors;
|
||||
|
||||
newPortRangeHints = new LADSPA_PortRangeHint[newLadspaDescriptor->PortCount];
|
||||
newPortRangeHints[0].HintDescriptor = 0;
|
||||
newPortRangeHints[1].HintDescriptor = 0;
|
||||
newLadspaDescriptor->PortRangeHints = newPortRangeHints;
|
||||
|
||||
newLadspaDescriptor->activate = stub_activate;
|
||||
newLadspaDescriptor->cleanup = stub_cleanup;
|
||||
newLadspaDescriptor->connect_port = stub_connectPort;
|
||||
newLadspaDescriptor->deactivate = stub_deactivate;
|
||||
newLadspaDescriptor->instantiate = instantiate;
|
||||
newLadspaDescriptor->run = stub_run;
|
||||
newLadspaDescriptor->run_adding = NULL;
|
||||
newLadspaDescriptor->set_run_adding_gain = NULL;
|
||||
}
|
||||
newDssiDescriptor->LADSPA_Plugin = newLadspaDescriptor;
|
||||
newDssiDescriptor->DSSI_API_Version = 1;
|
||||
newDssiDescriptor->configure = NULL;
|
||||
newDssiDescriptor->get_program = stub_getProgram;
|
||||
newDssiDescriptor->get_midi_controller_for_port = stub_getMidiControllerForPort;
|
||||
newDssiDescriptor->select_program = stub_selectProgram;
|
||||
newDssiDescriptor->run_synth = stub_runSynth;
|
||||
newDssiDescriptor->run_synth_adding = NULL;
|
||||
newDssiDescriptor->run_multiple_synths = NULL;
|
||||
newDssiDescriptor->run_multiple_synths_adding = NULL;
|
||||
}
|
||||
|
||||
dssiDescriptor = newDssiDescriptor;
|
||||
|
||||
return dssiDescriptor;
|
||||
}
|
||||
|
||||
/**
|
||||
* Converts a LADSPA / DSSI handle into a DSSIaudiooutput instance.
|
||||
*
|
||||
* @param instance [in]
|
||||
* @return the instance
|
||||
*/
|
||||
DSSIaudiooutput* DSSIaudiooutput::getInstance(LADSPA_Handle instance)
|
||||
{
|
||||
return (DSSIaudiooutput*)(instance);
|
||||
}
|
||||
|
||||
/**
|
||||
* The private sole constructor for the DSSIaudiooutput class.
|
||||
*
|
||||
* Only ever called via instantiate().
|
||||
* @param sampleRate [in] the sample rate to be used by the synth.
|
||||
* @return
|
||||
*/
|
||||
DSSIaudiooutput::DSSIaudiooutput(unsigned long sampleRate)
|
||||
{
|
||||
this->sampleRate = sampleRate;
|
||||
this->banksInited = false;
|
||||
|
||||
config.init();
|
||||
|
||||
srand(time(NULL));
|
||||
denormalkillbuf=new REALTYPE [SOUND_BUFFER_SIZE];
|
||||
for (int i=0;i<SOUND_BUFFER_SIZE;i++) denormalkillbuf[i]=(RND-0.5)*1e-16;
|
||||
|
||||
this->master = new Master();
|
||||
}
|
||||
|
||||
/**
|
||||
* The destructor for the DSSIaudiooutput class
|
||||
* @return
|
||||
*/
|
||||
DSSIaudiooutput::~DSSIaudiooutput()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Ensures the list of bank (directories) has been initialised.
|
||||
*/
|
||||
void DSSIaudiooutput::initBanks(void)
|
||||
{
|
||||
if(!banksInited)
|
||||
{
|
||||
pthread_mutex_lock(&master->mutex);
|
||||
master->bank.rescanforbanks();
|
||||
banksInited = true;
|
||||
pthread_mutex_unlock(&master->mutex);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* constructor for the internally used ProgramDescriptor class
|
||||
*
|
||||
* @param _bank [in] bank number
|
||||
* @param _program [in] program number
|
||||
* @param _name [in] instrument / sample name
|
||||
* @return
|
||||
*/
|
||||
DSSIaudiooutput::ProgramDescriptor::ProgramDescriptor(unsigned long _bank, unsigned long _program, char* _name) :
|
||||
bank(_bank), program(_program), name(_name)
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* The map of programs available; held as a single shared statically allocated object.
|
||||
*/
|
||||
vector <DSSIaudiooutput::ProgramDescriptor> DSSIaudiooutput::programMap = vector<DSSIaudiooutput::ProgramDescriptor>();
|
||||
|
||||
/**
|
||||
* Index controlling the map of banks
|
||||
*/
|
||||
long DSSIaudiooutput::bankNoToMap = 1;
|
||||
|
||||
/**
|
||||
* Queries and maps the next available bank of instruments.
|
||||
*
|
||||
* If the program index requested to getProgram() lies beyond the banks mapped to date,
|
||||
* this member function is called to map the next one.
|
||||
* @return true if a new bank has been found and mapped, else false.
|
||||
*/
|
||||
bool DSSIaudiooutput::mapNextBank()
|
||||
{
|
||||
pthread_mutex_lock(&master->mutex);
|
||||
Bank& bank = master->bank;
|
||||
bool retval;
|
||||
if(bankNoToMap >= MAX_NUM_BANKS || bank.banks[bankNoToMap].dir == NULL)
|
||||
{
|
||||
retval = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
bank.loadbank(bank.banks[bankNoToMap].dir);
|
||||
for(unsigned long instrument = 0; instrument < BANK_SIZE; instrument++)
|
||||
{
|
||||
char* insName = bank.getname(instrument);
|
||||
if(insName != NULL && insName[0] != '\0' && insName[0] != ' ')
|
||||
{
|
||||
programMap.push_back(ProgramDescriptor(bankNoToMap,instrument,insName));
|
||||
}
|
||||
}
|
||||
bankNoToMap ++;
|
||||
retval = true;
|
||||
}
|
||||
pthread_mutex_unlock(&master->mutex);
|
||||
return retval;
|
||||
}
|
||||
|
||||
@@ -26,34 +26,86 @@
|
||||
|
||||
#include "../globals.h"
|
||||
#include "../Misc/Master.h"
|
||||
#include "../UI/MasterUI.h"
|
||||
|
||||
#include <dssi.h>
|
||||
#include <ladspa.h>
|
||||
#include <vector>
|
||||
|
||||
/*
|
||||
class VSTSynth:public AudioEffectX{
|
||||
public:
|
||||
VSTSynth (audioMasterCallback audioMaster);
|
||||
~VSTSynth();
|
||||
class DSSIaudiooutput
|
||||
{
|
||||
public:
|
||||
//
|
||||
// Static stubs for LADSPA member functions
|
||||
//
|
||||
static void stub_connectPort(LADSPA_Handle instance, unsigned long port, LADSPA_Data * data);
|
||||
static void stub_activate(LADSPA_Handle instance);
|
||||
static void stub_run(LADSPA_Handle instance, unsigned long sample_count);
|
||||
static void stub_deactivate(LADSPA_Handle Instance);
|
||||
static void stub_cleanup(LADSPA_Handle instance);
|
||||
|
||||
virtual void process (float **inputs, float **outputs, long sampleframes);
|
||||
virtual void processReplacing (float **inputs, float **outputs, long sampleframes);
|
||||
virtual long processEvents(VstEvents *events);//this is used for Midi input
|
||||
virtual long int canDo(char *txt);
|
||||
virtual bool getVendorString(char *txt);
|
||||
virtual bool getProductString(char *txt);
|
||||
virtual void resume();
|
||||
//
|
||||
// Static stubs for DSSI member functions
|
||||
//
|
||||
static const DSSI_Program_Descriptor* stub_getProgram (LADSPA_Handle instance, unsigned long Index);
|
||||
static void stub_selectProgram(LADSPA_Handle instance, unsigned long bank, unsigned long program);
|
||||
static int stub_getMidiControllerForPort(LADSPA_Handle instance, unsigned long port);
|
||||
static void stub_runSynth(LADSPA_Handle instance, unsigned long sample_count,
|
||||
snd_seq_event_t *events, unsigned long event_count);
|
||||
|
||||
virtual long getChunk(void** data,bool isPreset=false);
|
||||
virtual void setChunk(void *data,long size,bool isPreset=false);
|
||||
/*
|
||||
* LADSPA member functions
|
||||
*/
|
||||
static LADSPA_Handle instantiate(const LADSPA_Descriptor * descriptor, unsigned long s_rate);
|
||||
void connectPort(unsigned long port, LADSPA_Data * data);
|
||||
void activate();
|
||||
void run(unsigned long sample_count);
|
||||
void deactivate();
|
||||
void cleanup();
|
||||
static const LADSPA_Descriptor* getLadspaDescriptor(unsigned long index);
|
||||
|
||||
MasterUI *ui;
|
||||
int Pexitprogram;
|
||||
/*
|
||||
* DSSI member functions
|
||||
*/
|
||||
const DSSI_Program_Descriptor* getProgram (unsigned long Index);
|
||||
void selectProgram(unsigned long bank, unsigned long program);
|
||||
int getMidiControllerForPort(unsigned long port);
|
||||
void runSynth(unsigned long sample_count, snd_seq_event_t *events, unsigned long event_count);
|
||||
static const DSSI_Descriptor* getDssiDescriptor(unsigned long index);
|
||||
|
||||
Master *vmaster;
|
||||
pthread_t thr;
|
||||
struct ProgramDescriptor
|
||||
{
|
||||
unsigned long bank;
|
||||
unsigned long program;
|
||||
string name;
|
||||
ProgramDescriptor(unsigned long _bank, unsigned long _program, char* _name);
|
||||
};
|
||||
|
||||
private:
|
||||
|
||||
DSSIaudiooutput(unsigned long sampleRate);
|
||||
~DSSIaudiooutput();
|
||||
static DSSI_Descriptor* initDssiDescriptor();
|
||||
static DSSIaudiooutput* getInstance(LADSPA_Handle instance);
|
||||
void initBanks();
|
||||
bool mapNextBank();
|
||||
|
||||
LADSPA_Data *outl;
|
||||
LADSPA_Data *outr;
|
||||
long sampleRate;
|
||||
Master* master;
|
||||
static DSSI_Descriptor* dssiDescriptor;
|
||||
static string bankDirNames[];
|
||||
static
|
||||
vector <ProgramDescriptor> programMap;
|
||||
|
||||
/**
|
||||
* Flag controlling the list of bank directories
|
||||
*/
|
||||
bool banksInited;
|
||||
|
||||
static
|
||||
long bankNoToMap;
|
||||
};
|
||||
*/
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
ZynAddSubFX - a software synthesizer
|
||||
|
||||
JACKaudiooutput.C - Audio output for JACK
|
||||
JACKaudiooutput.cpp - Audio output for JACK
|
||||
Copyright (C) 2002 Nasca Octavian Paul
|
||||
Author: Nasca Octavian Paul
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
ZynAddSubFX - a software synthesizer
|
||||
|
||||
JACKaudiooutput.C - Audio output for JACK
|
||||
JACKaudiooutput.cpp - Audio output for JACK
|
||||
Copyright (C) 2002 Nasca Octavian Paul
|
||||
Author: Nasca Octavian Paul
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
ZynAddSubFX - a software synthesizer
|
||||
|
||||
OSSaudiooutput.C - Audio output for Open Sound System
|
||||
OSSaudiooutput.cpp - Audio output for Open Sound System
|
||||
Copyright (C) 2002-2005 Nasca Octavian Paul
|
||||
Author: Nasca Octavian Paul
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
ZynAddSubFX - a software synthesizer
|
||||
|
||||
PAaudiooutput.C - Audio output for PortAudio
|
||||
PAaudiooutput.cpp - Audio output for PortAudio
|
||||
Copyright (C) 2002 Nasca Octavian Paul
|
||||
Author: Nasca Octavian Paul
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
ZynAddSubFX - a software synthesizer
|
||||
|
||||
Recorder.C - Records sound to a file
|
||||
Recorder.cpp - Records sound to a file
|
||||
Copyright (C) 2002-2005 Nasca Octavian Paul
|
||||
Author: Nasca Octavian Paul
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
ZynAddSubFX - a software synthesizer
|
||||
|
||||
VSTaudiooutput.C - Audio output for VST
|
||||
VSTaudiooutput.cpp - Audio output for VST
|
||||
Copyright (C) 2002 Nasca Octavian Paul
|
||||
Author: Nasca Octavian Paul
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
#include <string.h>
|
||||
#include "VSTaudiooutput.h"
|
||||
|
||||
//the constructor and the destructor are defined in main.C
|
||||
//the constructor and the destructor are defined in main.cpp
|
||||
|
||||
void VSTSynth::process(float **inputs, float **outputs, long sampleframes)
|
||||
{
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
ZynAddSubFX - a software synthesizer
|
||||
|
||||
ADnoteParameters.C - Parameters for ADnote (ADsynth)
|
||||
ADnoteParameters.cpp - Parameters for ADnote (ADsynth)
|
||||
Copyright (C) 2002-2005 Nasca Octavian Paul
|
||||
Author: Nasca Octavian Paul
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
ZynAddSubFX - a software synthesizer
|
||||
|
||||
Controller.C - (Midi) Controllers implementation
|
||||
Controller.cpp - (Midi) Controllers implementation
|
||||
Copyright (C) 2002-2005 Nasca Octavian Paul
|
||||
Author: Nasca Octavian Paul
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
ZynAddSubFX - a software synthesizer
|
||||
|
||||
EnvelopeParams.C - Parameters for Envelope
|
||||
EnvelopeParams.cpp - Parameters for Envelope
|
||||
Copyright (C) 2002-2005 Nasca Octavian Paul
|
||||
Author: Nasca Octavian Paul
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
ZynAddSubFX - a software synthesizer
|
||||
|
||||
FilterParams.C - Parameters for filter
|
||||
FilterParams.cpp - Parameters for filter
|
||||
Copyright (C) 2002-2005 Nasca Octavian Paul
|
||||
Author: Nasca Octavian Paul
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
ZynAddSubFX - a software synthesizer
|
||||
|
||||
LFOParams.C - Parameters for LFO
|
||||
LFOParams.cpp - Parameters for LFO
|
||||
Copyright (C) 2002-2005 Nasca Octavian Paul
|
||||
Author: Nasca Octavian Paul
|
||||
|
||||
@@ -33,7 +33,7 @@ LFOParams::LFOParams(char Pfreq_,
|
||||
char PLFOtype_,
|
||||
char Prandomness_,
|
||||
char Pdelay_,
|
||||
char Pcontinuous_,
|
||||
char Pcontinous_,
|
||||
char fel_):Presets()
|
||||
{
|
||||
switch(fel_) {
|
||||
@@ -53,7 +53,7 @@ LFOParams::LFOParams(char Pfreq_,
|
||||
DLFOtype = PLFOtype_;
|
||||
Drandomness = Prandomness_;
|
||||
Ddelay = Pdelay_;
|
||||
Dcontinuous = Pcontinuous_;
|
||||
Dcontinous = Pcontinous_;
|
||||
fel = fel_;
|
||||
time = 0;
|
||||
|
||||
@@ -71,7 +71,7 @@ void LFOParams::defaults()
|
||||
PLFOtype = DLFOtype;
|
||||
Prandomness = Drandomness;
|
||||
Pdelay = Ddelay;
|
||||
Pcontinuous = Dcontinuous;
|
||||
Pcontinous = Dcontinous;
|
||||
Pfreqrand = 0;
|
||||
Pstretch = 64;
|
||||
}
|
||||
@@ -87,7 +87,7 @@ void LFOParams::add2XML(XMLwrapper *xml)
|
||||
xml->addpar("randomness_frequency", Pfreqrand);
|
||||
xml->addpar("delay", Pdelay);
|
||||
xml->addpar("stretch", Pstretch);
|
||||
xml->addparbool("continuous", Pcontinuous);
|
||||
xml->addparbool("continous", Pcontinous);
|
||||
}
|
||||
|
||||
void LFOParams::getfromXML(XMLwrapper *xml)
|
||||
@@ -100,6 +100,6 @@ void LFOParams::getfromXML(XMLwrapper *xml)
|
||||
Pfreqrand = xml->getpar127("randomness_frequency", Pfreqrand);
|
||||
Pdelay = xml->getpar127("delay", Pdelay);
|
||||
Pstretch = xml->getpar127("stretch", Pstretch);
|
||||
Pcontinuous = xml->getparbool("continuous", Pcontinuous);
|
||||
Pcontinous = xml->getparbool("continous", Pcontinous);
|
||||
}
|
||||
|
||||
|
||||
@@ -35,7 +35,7 @@ class LFOParams:public Presets
|
||||
char PLFOtype_,
|
||||
char Prandomness_,
|
||||
char Pdelay_,
|
||||
char Pcontinuous,
|
||||
char Pcontinous,
|
||||
char fel_);
|
||||
~LFOParams();
|
||||
|
||||
@@ -52,11 +52,11 @@ class LFOParams:public Presets
|
||||
unsigned char Prandomness; /**<randomness (0=off)*/
|
||||
unsigned char Pfreqrand; /**<frequency randomness (0=off)*/
|
||||
unsigned char Pdelay; /**<delay (0=off)*/
|
||||
unsigned char Pcontinuous; /**<1 if LFO is continuous*/
|
||||
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 Pcontinuous parameter
|
||||
static int time; //is used by Pcontinous parameter
|
||||
private:
|
||||
/* Default parameters */
|
||||
unsigned char Dfreq;
|
||||
@@ -65,7 +65,7 @@ class LFOParams:public Presets
|
||||
unsigned char DLFOtype;
|
||||
unsigned char Drandomness;
|
||||
unsigned char Ddelay;
|
||||
unsigned char Dcontinuous;
|
||||
unsigned char Dcontinous;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
ZynAddSubFX - a software synthesizer
|
||||
|
||||
PADnoteParameters.C - Parameters for PADnote (PADsynth)
|
||||
PADnoteParameters.cpp - Parameters for PADnote (PADsynth)
|
||||
Copyright (C) 2002-2005 Nasca Octavian Paul
|
||||
Author: Nasca Octavian Paul
|
||||
|
||||
|
||||
@@ -52,7 +52,7 @@ class PADnoteParameters:public Presets
|
||||
|
||||
//parameters
|
||||
|
||||
//the mode: 0 - bandwidth, 1 - discrete (bandwidth=0), 2 - continuous
|
||||
//the mode: 0 - bandwidth, 1 - discrete (bandwidth=0), 2 - continous
|
||||
//the harmonic profile is used only on mode 0
|
||||
unsigned char Pmode;
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
ZynAddSubFX - a software synthesizer
|
||||
|
||||
Presets.C - Presets and Clipboard management
|
||||
Presets.cpp - Presets and Clipboard management
|
||||
Copyright (C) 2002-2005 Nasca Octavian Paul
|
||||
Author: Nasca Octavian Paul
|
||||
|
||||
@@ -47,11 +47,10 @@ void Presets::copy(const char *name)
|
||||
|
||||
char type[MAX_PRESETTYPE_SIZE];
|
||||
strcpy(type, this->type);
|
||||
strcat(type, "n");
|
||||
//strcat(type, "n");
|
||||
if(name == NULL)
|
||||
if(strstr(type, "Plfo") != NULL)
|
||||
strcpy(type, "Plfo");
|
||||
;
|
||||
|
||||
xml->beginbranch(type);
|
||||
add2XML(xml);
|
||||
@@ -69,12 +68,11 @@ void Presets::paste(int npreset)
|
||||
{
|
||||
char type[MAX_PRESETTYPE_SIZE];
|
||||
strcpy(type, this->type);
|
||||
strcat(type, "n");
|
||||
//strcat(type, "n");
|
||||
|
||||
if(npreset == 0)
|
||||
if(strstr(type, "Plfo") != NULL)
|
||||
strcpy(type, "Plfo");
|
||||
;
|
||||
|
||||
XMLwrapper *xml = new XMLwrapper();
|
||||
if(npreset == 0) {
|
||||
@@ -108,10 +106,6 @@ void Presets::paste(int npreset)
|
||||
|
||||
bool Presets::checkclipboardtype()
|
||||
{
|
||||
char type[MAX_PRESETTYPE_SIZE];
|
||||
strcpy(type, this->type);
|
||||
strcat(type, "n");
|
||||
|
||||
return presetsstore.checkclipboardtype(type);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
ZynAddSubFX - a software synthesizer
|
||||
|
||||
PresetsArray.C - PresetsArray and Clipboard management
|
||||
PresetsArray.cpp - PresetsArray and Clipboard management
|
||||
Copyright (C) 2002-2005 Nasca Octavian Paul
|
||||
Author: Nasca Octavian Paul
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
ZynAddSubFX - a software synthesizer
|
||||
|
||||
PresetsStore.C - Presets and Clipboard store
|
||||
PresetsStore.cpp - Presets and Clipboard store
|
||||
Copyright (C) 2002-2005 Nasca Octavian Paul
|
||||
Author: Nasca Octavian Paul
|
||||
|
||||
@@ -19,6 +19,9 @@
|
||||
Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
*/
|
||||
#include <iostream>
|
||||
#include <algorithm>
|
||||
#include <cctype>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <dirent.h>
|
||||
@@ -27,17 +30,14 @@
|
||||
#include "PresetsStore.h"
|
||||
#include "../Misc/Util.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
PresetsStore presetsstore;
|
||||
|
||||
PresetsStore::PresetsStore()
|
||||
{
|
||||
clipboard.data = NULL;
|
||||
clipboard.type[0] = 0;
|
||||
|
||||
for(int i = 0; i < MAX_PRESETS; i++) {
|
||||
presets[i].file = NULL;
|
||||
presets[i].name = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
PresetsStore::~PresetsStore()
|
||||
@@ -66,7 +66,7 @@ bool PresetsStore::pasteclipboard(XMLwrapper *xml)
|
||||
return true;
|
||||
}
|
||||
|
||||
bool PresetsStore::checkclipboardtype(char *type)
|
||||
bool PresetsStore::checkclipboardtype(const char *type)
|
||||
{
|
||||
//makes LFO's compatible
|
||||
if((strstr(type,
|
||||
@@ -78,128 +78,88 @@ bool PresetsStore::checkclipboardtype(char *type)
|
||||
//Presets management
|
||||
void PresetsStore::clearpresets()
|
||||
{
|
||||
for(int i = 0; i < MAX_PRESETS; i++) {
|
||||
if(presets[i].file != NULL) {
|
||||
delete (presets[i].file);
|
||||
presets[i].file = NULL;
|
||||
}
|
||||
if(presets[i].name != NULL) {
|
||||
delete (presets[i].name);
|
||||
presets[i].name = NULL;
|
||||
}
|
||||
}
|
||||
presets.clear();
|
||||
}
|
||||
|
||||
//a helper function that compares 2 presets[]
|
||||
int Presets_compar(const void *a, const void *b)
|
||||
bool PresetsStore::presetstruct::operator<(const presetstruct &b) const
|
||||
{
|
||||
struct PresetsStore::presetstruct *p1 = (PresetsStore::presetstruct *)a;
|
||||
struct PresetsStore::presetstruct *p2 = (PresetsStore::presetstruct *)b;
|
||||
if(((p1->name) == NULL) || ((p2->name) == NULL))
|
||||
return 0;
|
||||
|
||||
return strcasecmp(p1->name, p2->name) < 0;
|
||||
return name < b.name;
|
||||
}
|
||||
|
||||
|
||||
void PresetsStore::rescanforpresets(char *type)
|
||||
void PresetsStore::rescanforpresets(string type)
|
||||
{
|
||||
//std::cout << "Scanning For Presets" << std::endl;
|
||||
//std::cout << "Of Type: " << type << std::endl;
|
||||
|
||||
clearpresets();
|
||||
int presetk = 0;
|
||||
char ftype[MAX_STRING_SIZE];
|
||||
snprintf(ftype, MAX_STRING_SIZE, ".%s.xpz", type);
|
||||
string ftype = "." + type + ".xpz";
|
||||
|
||||
for(int i = 0; i < MAX_BANK_ROOT_DIRS; i++) {
|
||||
if(config.cfg.presetsDirList[i] == NULL)
|
||||
continue;
|
||||
char *dirname = config.cfg.presetsDirList[i];
|
||||
DIR *dir = opendir(dirname);
|
||||
|
||||
//open directory
|
||||
string dirname = config.cfg.presetsDirList[i];
|
||||
DIR *dir = opendir(dirname.c_str());
|
||||
if(dir == NULL)
|
||||
continue;
|
||||
struct dirent *fn;
|
||||
|
||||
//check all files in directory
|
||||
while((fn = readdir(dir))) {
|
||||
const char *filename = fn->d_name;
|
||||
if(strstr(filename, ftype) == NULL)
|
||||
string filename = fn->d_name;
|
||||
if(filename.find(ftype) == string::npos)
|
||||
continue;
|
||||
|
||||
|
||||
presets[presetk].file = new char [MAX_STRING_SIZE];
|
||||
presets[presetk].name = new char [MAX_STRING_SIZE];
|
||||
char tmpc = dirname[strlen(dirname) - 1];
|
||||
//ensure proper path is formed
|
||||
char tmpc = dirname[dirname.size() - 1];
|
||||
const char *tmps;
|
||||
if((tmpc == '/') || (tmpc == '\\'))
|
||||
tmps = "";
|
||||
else
|
||||
tmps = "/";
|
||||
snprintf(presets[presetk].file,
|
||||
MAX_STRING_SIZE,
|
||||
"%s%s%s",
|
||||
dirname,
|
||||
tmps,
|
||||
filename);
|
||||
snprintf(presets[presetk].name, MAX_STRING_SIZE, "%s", filename);
|
||||
|
||||
char *tmp = strstr(presets[presetk].name, ftype);
|
||||
if(tmp != NULL)
|
||||
tmp[0] = '\0';
|
||||
presetk++;
|
||||
if(presetk >= MAX_PRESETS)
|
||||
return;
|
||||
string location = "" + dirname + tmps + filename;
|
||||
|
||||
//trim file type off of name
|
||||
string name = filename.substr(0, filename.find(ftype));
|
||||
|
||||
//put on list
|
||||
presets.push_back(presetstruct(location, name));
|
||||
}
|
||||
|
||||
closedir(dir);
|
||||
}
|
||||
|
||||
//sort the presets
|
||||
for(int j = 0; j < MAX_PRESETS - 1; j++) {
|
||||
for(int i = j + 1; i < MAX_PRESETS; i++) {
|
||||
if(Presets_compar(&presets[i], &presets[j])) {
|
||||
presetstruct tmp = presets[i];
|
||||
presets[i] = presets[j];
|
||||
presets[j] = tmp;
|
||||
}
|
||||
}
|
||||
}
|
||||
sort(presets.begin(), presets.end());
|
||||
}
|
||||
|
||||
void PresetsStore::copypreset(XMLwrapper *xml, char *type, const char *name)
|
||||
{
|
||||
char filename[MAX_STRING_SIZE], tmpfilename[MAX_STRING_SIZE];
|
||||
|
||||
void PresetsStore::copypreset(XMLwrapper *xml, char *type, string name)
|
||||
{
|
||||
if(config.cfg.presetsDirList[0] == NULL)
|
||||
return;
|
||||
|
||||
snprintf(tmpfilename, MAX_STRING_SIZE, "%s", name);
|
||||
|
||||
//make the filenames legal
|
||||
for(int i = 0; i < (int) strlen(tmpfilename); i++) {
|
||||
char c = tmpfilename[i];
|
||||
if((c >= '0') && (c <= '9'))
|
||||
continue;
|
||||
if((c >= 'A') && (c <= 'Z'))
|
||||
continue;
|
||||
if((c >= 'a') && (c <= 'z'))
|
||||
continue;
|
||||
if((c == '-') || (c == ' '))
|
||||
continue;
|
||||
tmpfilename[i] = '_';
|
||||
for(int i = 0; i < (int) name.size(); i++) {
|
||||
char c = name[i];
|
||||
if(!(isdigit(c) || isalpha(c) || (c == '-') || (c == ' ')))
|
||||
name[i] = '_';
|
||||
}
|
||||
|
||||
const char *dirname = config.cfg.presetsDirList[0];
|
||||
char tmpc = dirname[strlen(dirname) - 1];
|
||||
//make path legal
|
||||
const string dirname = config.cfg.presetsDirList[0];
|
||||
char tmpc = dirname[dirname.size() - 1];
|
||||
const char *tmps;
|
||||
if((tmpc == '/') || (tmpc == '\\'))
|
||||
tmps = "";
|
||||
else
|
||||
tmps = "/";
|
||||
|
||||
snprintf(filename,
|
||||
MAX_STRING_SIZE,
|
||||
"%s%s%s.%s.xpz",
|
||||
dirname,
|
||||
tmps,
|
||||
name,
|
||||
type);
|
||||
string filename("" + dirname + tmps + name + type);
|
||||
|
||||
xml->saveXMLfile(filename);
|
||||
}
|
||||
@@ -207,10 +167,10 @@ void PresetsStore::copypreset(XMLwrapper *xml, char *type, const char *name)
|
||||
bool PresetsStore::pastepreset(XMLwrapper *xml, int npreset)
|
||||
{
|
||||
npreset--;
|
||||
if(npreset >= MAX_PRESETS)
|
||||
if(npreset >= presets.size())
|
||||
return false;
|
||||
char *filename = presets[npreset].file;
|
||||
if(filename == NULL)
|
||||
string filename = presets[npreset].file;
|
||||
if(filename.empty())
|
||||
return false;
|
||||
bool result = (xml->loadXMLfile(filename) >= 0);
|
||||
return result;
|
||||
@@ -219,11 +179,11 @@ bool PresetsStore::pastepreset(XMLwrapper *xml, int npreset)
|
||||
void PresetsStore::deletepreset(int npreset)
|
||||
{
|
||||
npreset--;
|
||||
if(npreset >= MAX_PRESETS)
|
||||
if(npreset >= presets.size())
|
||||
return;
|
||||
char *filename = presets[npreset].file;
|
||||
if(filename == NULL)
|
||||
string filename = presets[npreset].file;
|
||||
if(filename.empty())
|
||||
return;
|
||||
remove(filename);
|
||||
remove(filename.c_str());
|
||||
}
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
ZynAddSubFX - a software synthesizer
|
||||
|
||||
PresetsStore.C - Presets and Clipboard store
|
||||
PresetsStore.cpp - Presets and Clipboard store
|
||||
Copyright (C) 2002-2005 Nasca Octavian Paul
|
||||
Author: Nasca Octavian Paul
|
||||
|
||||
@@ -20,11 +20,12 @@
|
||||
|
||||
*/
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include "../Misc/XMLwrapper.h"
|
||||
#include "../Misc/Config.h"
|
||||
|
||||
#define MAX_PRESETTYPE_SIZE 30
|
||||
#define MAX_PRESETS 1000
|
||||
|
||||
class PresetsStore
|
||||
{
|
||||
@@ -35,20 +36,23 @@ class PresetsStore
|
||||
//Clipboard stuff
|
||||
void copyclipboard(XMLwrapper *xml, char *type);
|
||||
bool pasteclipboard(XMLwrapper *xml);
|
||||
bool checkclipboardtype(char *type);
|
||||
bool checkclipboardtype(const char *type);
|
||||
|
||||
//presets stuff
|
||||
void copypreset(XMLwrapper *xml, char *type, const char *name);
|
||||
void copypreset(XMLwrapper *xml, char *type, std::string name);
|
||||
bool pastepreset(XMLwrapper *xml, int npreset);
|
||||
void deletepreset(int npreset);
|
||||
|
||||
struct presetstruct {
|
||||
char *file;
|
||||
char *name;
|
||||
presetstruct(std::string _file, std::string _name)
|
||||
:file(_file),name(_name){};
|
||||
bool operator<(const presetstruct &b) const;
|
||||
std::string file;
|
||||
std::string name;
|
||||
};
|
||||
presetstruct presets[MAX_PRESETS];
|
||||
std::vector<presetstruct> presets;
|
||||
|
||||
void rescanforpresets(char *type);
|
||||
void rescanforpresets(const std::string type);
|
||||
|
||||
private:
|
||||
struct {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
ZynAddSubFX - a software synthesizer
|
||||
|
||||
SUBnoteParameters.C - Parameters for SUBnote (SUBsynth)
|
||||
SUBnoteParameters.cpp - Parameters for SUBnote (SUBsynth)
|
||||
Copyright (C) 2002-2005 Nasca Octavian Paul
|
||||
Author: Nasca Octavian Paul
|
||||
|
||||
|
||||
@@ -1,28 +0,0 @@
|
||||
/*
|
||||
ZynAddSubFX - a software synthesizer
|
||||
|
||||
AuSample.h - Object for storing information on audio samples (for one channel)
|
||||
Copyright (C) 2009-2009 Mark McCurry
|
||||
Author: Mark McCurry
|
||||
|
||||
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
|
||||
*/
|
||||
#include "AuSample.h"
|
||||
|
||||
AuSample::AuSample(int length, REALTYPE fill)
|
||||
:Sample(length, fill) {}
|
||||
|
||||
AuSample::AuSample(int length, const REALTYPE *input)
|
||||
:Sample(length, input) {}
|
||||
|
||||
@@ -1,35 +0,0 @@
|
||||
/*
|
||||
ZynAddSubFX - a software synthesizer
|
||||
|
||||
AuSample.h - Object for storing information on audio samples (for one channel)
|
||||
Copyright (C) 2009-2009 Mark McCurry
|
||||
Author: Mark McCurry
|
||||
|
||||
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(int length, REALTYPE fill = 0);
|
||||
AuSample(int length, const REALTYPE *input);
|
||||
FqSample getFqSample(); /**\todo implement this*/
|
||||
};
|
||||
#endif
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
set(zynaddsubfx_samples_SRCS
|
||||
AuSample.cpp
|
||||
FqSample.cpp
|
||||
Sample.cpp
|
||||
)
|
||||
|
||||
|
||||
@@ -1,33 +0,0 @@
|
||||
/*
|
||||
ZynAddSubFX - a software synthesizer
|
||||
|
||||
FqSample.C - Object for storing information on samples
|
||||
Copyright (C) 2009-2009 Mark McCurry
|
||||
Author: Mark McCurry
|
||||
|
||||
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
|
||||
*/
|
||||
#include "FqSample.h"
|
||||
|
||||
FqSample::FqSample(int length, REALTYPE fill)
|
||||
:Sample(length, fill)
|
||||
{}
|
||||
|
||||
FqSample::FqSample(int length, const REALTYPE *input)
|
||||
:Sample(length, input)
|
||||
{}
|
||||
|
||||
FqSample::~FqSample()
|
||||
{}
|
||||
|
||||
@@ -1,37 +0,0 @@
|
||||
/*
|
||||
ZynAddSubFX - a software synthesizer
|
||||
|
||||
FqSample.h - Object for storing information on samples
|
||||
Copyright (C) 2009-2009 Mark McCurry
|
||||
Author: Mark McCurry
|
||||
|
||||
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(int length, REALTYPE fill = 0);
|
||||
FqSample(int length, const REALTYPE *input);
|
||||
~FqSample();
|
||||
//FqSample &operator=(const FqSample &smp);
|
||||
//float *dontuse(){return buffer;};
|
||||
};
|
||||
#endif
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
ZynAddSubFX - a software synthesizer
|
||||
|
||||
Sample.C - Object for storing information on samples
|
||||
Sample.cpp - Object for storing information on samples
|
||||
Copyright (C) 2009-2009 Mark McCurry
|
||||
Author: Mark McCurry
|
||||
|
||||
@@ -19,8 +19,13 @@
|
||||
Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
#include <cmath>
|
||||
#include <cstring>//for memcpy/memset
|
||||
#include <iostream>
|
||||
#include "Sample.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
#warning TODO Think about renaming Sample to Frame
|
||||
/**\TODO start using pointer math here as these will be Frequency called
|
||||
* functions throughout the code*/
|
||||
Sample::Sample(const Sample &smp)
|
||||
@@ -92,6 +97,74 @@ bool Sample::operator==(const Sample &smp) const
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Linear point estimation
|
||||
* @param ya Y of point a
|
||||
* @param yb Y of point b
|
||||
* @param xt X of test point
|
||||
* @param xa X of point a
|
||||
* @param xb X of point b
|
||||
* @return estimated Y of test point
|
||||
*/
|
||||
inline float linearEstimate(float ya, float yb, float xt, int xa = 0, int xb = 1)
|
||||
{
|
||||
if(xa == xb)
|
||||
return ya;
|
||||
|
||||
return (yb-ya) * (xt-xa)/(xb-xa) + ya;
|
||||
}
|
||||
|
||||
void Sample::resize(unsigned int nsize)
|
||||
{
|
||||
if(bufferSize == nsize)
|
||||
return;
|
||||
else {//resampling occurs here
|
||||
float ratio = (nsize * 1.0) / (bufferSize * 1.0);
|
||||
|
||||
int nBufferSize = nsize;
|
||||
float *nBuffer = new float[nBufferSize];
|
||||
|
||||
//take care of edge cases
|
||||
*nBuffer = *buffer;
|
||||
*(nBuffer+nBufferSize-1) = *(buffer+bufferSize-1);
|
||||
|
||||
//addition is done to avoid 0 edge case
|
||||
for(int i = 1; i < nBufferSize - 1; ++i)
|
||||
{
|
||||
float left = floor(i/ratio);
|
||||
float right = ceil((i+1)/ratio);
|
||||
float test = i/ratio;
|
||||
if(left > bufferSize - 1)
|
||||
left = bufferSize - 1;
|
||||
if(right > bufferSize - 1)
|
||||
right = bufferSize - 1;
|
||||
if(left > test)
|
||||
test = left;
|
||||
nBuffer[i] = linearEstimate(buffer[(int)left],
|
||||
buffer[(int)right],
|
||||
test, (int)left, (int)right);
|
||||
}
|
||||
|
||||
//put the new data in
|
||||
delete[] buffer;
|
||||
buffer = nBuffer;
|
||||
bufferSize = nBufferSize;
|
||||
}
|
||||
}
|
||||
|
||||
void Sample::append(const Sample &smp)
|
||||
{
|
||||
int nbufferSize = bufferSize + smp.bufferSize;
|
||||
float *nbuffer = new float[nbufferSize];
|
||||
|
||||
memcpy(nbuffer, buffer, bufferSize * sizeof(float));
|
||||
memcpy(nbuffer + bufferSize, smp.buffer, smp.bufferSize * sizeof(float));
|
||||
delete buffer;
|
||||
|
||||
buffer = nbuffer;
|
||||
bufferSize = nbufferSize;
|
||||
}
|
||||
|
||||
REALTYPE Sample::max() const
|
||||
{
|
||||
REALTYPE max = -1500; //a good low considering that samples should store values -1.0 to 1.0
|
||||
|
||||
@@ -50,13 +50,19 @@ class Sample
|
||||
void operator=(const Sample &smp);
|
||||
/**Provides the == operator*/
|
||||
bool operator==(const Sample &smp) const;
|
||||
|
||||
/**Provides direct access to the buffer to allow for transition
|
||||
*
|
||||
* This method is like c_str() from the string class and should be used
|
||||
* sparingly*/
|
||||
const REALTYPE *c_buf() {
|
||||
return buffer;
|
||||
}
|
||||
const REALTYPE *c_buf() const {return buffer;}
|
||||
|
||||
/**Change the size of the sample*/
|
||||
void resize(unsigned int nsize);
|
||||
|
||||
/**Appends another Sample to this Sample*/
|
||||
void append(const Sample &smp);
|
||||
|
||||
REALTYPE max() const;
|
||||
REALTYPE min() const;
|
||||
REALTYPE absMax() const;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
ZynAddSubFX - a software synthesizer
|
||||
|
||||
MIDIEvents.C - It stores the midi events from midi file or sequencer
|
||||
MIDIEvents.cpp - It stores the midi events from midi file or sequencer
|
||||
Copyright (C) 2003-2005 Nasca Octavian Paul
|
||||
Author: Nasca Octavian Paul
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
ZynAddSubFX - a software synthesizer
|
||||
|
||||
MIDIFile.C - MIDI file loader
|
||||
MIDIFile.cpp - MIDI file loader
|
||||
Copyright (C) 2003-2005 Nasca Octavian Paul
|
||||
Author: Nasca Octavian Paul
|
||||
|
||||
@@ -101,7 +101,7 @@ int MIDIFile::parsemidifile(MIDIEvents *me_)
|
||||
}
|
||||
else //SMPTE (frames/second and ticks/frame)
|
||||
printf(
|
||||
"ERROR:in MIDIFile.C::parsemidifile() - SMPTE not implemented yet.");
|
||||
"ERROR:in MIDIFile.cpp::parsemidifile() - SMPTE not implemented yet.");
|
||||
;
|
||||
|
||||
if(ntracks >= NUM_MIDI_TRACKS)
|
||||
@@ -115,7 +115,7 @@ int MIDIFile::parsemidifile(MIDIEvents *me_)
|
||||
}
|
||||
|
||||
printf("\n\nCURRENT File position is = 0x%x\n", midifilek);
|
||||
printf("\nMIDI file successfully parsed.\n");
|
||||
printf("\nMIDI file succesfully parsed.\n");
|
||||
// printf("\n0x%x\n",getbyte());
|
||||
|
||||
this->me = NULL;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
ZynAddSubFX - a software synthesizer
|
||||
|
||||
Sequencer.C - The Sequencer
|
||||
Sequencer.cpp - The Sequencer
|
||||
Copyright (C) 2003-2005 Nasca Octavian Paul
|
||||
Author: Nasca Octavian Paul
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
ZynAddSubFX - a software synthesizer
|
||||
|
||||
ADnote.C - The "additive" synthesizer
|
||||
ADnote.cpp - The "additive" synthesizer
|
||||
Copyright (C) 2002-2005 Nasca Octavian Paul
|
||||
Author: Nasca Octavian Paul
|
||||
|
||||
@@ -408,8 +408,7 @@ ADnote::ADnote(ADnoteParameters *pars,
|
||||
tmpwave_unison = new REALTYPE *[max_unison];
|
||||
for(int k = 0; k < max_unison; k++) {
|
||||
tmpwave_unison[k] = new REALTYPE[SOUND_BUFFER_SIZE];
|
||||
for(int i = 0; i < SOUND_BUFFER_SIZE; i++)
|
||||
tmpwave_unison[k][i] = 0.0;
|
||||
memset(tmpwave_unison[k], 0, SOUND_BUFFER_SIZE * sizeof(REALTYPE));
|
||||
}
|
||||
|
||||
initparameters();
|
||||
@@ -775,7 +774,7 @@ void ADnote::KillVoice(int nvoice)
|
||||
|
||||
if(NoteVoicePar[nvoice].VoiceOut != NULL)
|
||||
memset(NoteVoicePar[nvoice].VoiceOut, 0, SOUND_BUFFER_SIZE
|
||||
* sizeof(REALTYPE)); //do not delete, yet: perhaps is used by another voice
|
||||
* sizeof(REALTYPE));//do not delete, yet: perhaps is used by another voice
|
||||
|
||||
NoteVoicePar[nvoice].Enabled = OFF;
|
||||
}
|
||||
@@ -1010,8 +1009,7 @@ void ADnote::initparameters()
|
||||
}
|
||||
;
|
||||
if(NoteVoicePar[nvoice].VoiceOut != NULL)
|
||||
for(i = 0; i < SOUND_BUFFER_SIZE; i++)
|
||||
NoteVoicePar[nvoice].VoiceOut[i] = 0.0;
|
||||
memset(NoteVoicePar[nvoice].VoiceOut, 0, SOUND_BUFFER_SIZE * sizeof(REALTYPE));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1469,8 +1467,8 @@ inline void ADnote::ComputeVoiceOscillatorFrequencyModulation(int nvoice,
|
||||
//if I use VoiceOut[] as modulator
|
||||
for(int k = 0; k < unison_size[nvoice]; k++) {
|
||||
REALTYPE *tw = tmpwave_unison[k];
|
||||
for(i = 0; i < SOUND_BUFFER_SIZE; i++)
|
||||
tw[i] = NoteVoicePar[NoteVoicePar[nvoice].FMVoice].VoiceOut[i];
|
||||
memcpy(tw, NoteVoicePar[NoteVoicePar[nvoice].FMVoice].VoiceOut,
|
||||
SOUND_BUFFER_SIZE * sizeof(REALTYPE));
|
||||
}
|
||||
}
|
||||
else {
|
||||
@@ -1654,11 +1652,9 @@ int ADnote::noteout(REALTYPE *outl, REALTYPE *outr)
|
||||
|
||||
|
||||
//mix subvoices into voice
|
||||
for(i = 0; i < SOUND_BUFFER_SIZE; i++)
|
||||
tmpwavel[i] = 0.0;
|
||||
memset(tmpwavel, 0, SOUND_BUFFER_SIZE * sizeof(REALTYPE));
|
||||
if(stereo)
|
||||
for(i = 0; i < SOUND_BUFFER_SIZE; i++)
|
||||
tmpwaver[i] = 0.0;
|
||||
memset(tmpwaver, 0, SOUND_BUFFER_SIZE * sizeof(REALTYPE));
|
||||
for(int k = 0; k < unison_size[nvoice]; k++) {
|
||||
REALTYPE *tw = tmpwave_unison[k];
|
||||
if(stereo) {
|
||||
@@ -1825,11 +1821,10 @@ int ADnote::noteout(REALTYPE *outl, REALTYPE *outr)
|
||||
//Processing Global parameters
|
||||
NoteGlobalPar.GlobalFilterL->filterout(&outl[0]);
|
||||
|
||||
if(stereo == 0)
|
||||
for(i = 0; i < SOUND_BUFFER_SIZE; i++) { //set the right channel=left channel
|
||||
outr[i] = outl[i];
|
||||
bypassr[i] = bypassl[i];
|
||||
}
|
||||
if(stereo == 0) { //set the right channel=left channel
|
||||
memcpy(outr, outl, SOUND_BUFFER_SIZE * sizeof(REALTYPE));
|
||||
memcpy(bypassr, bypassl, SOUND_BUFFER_SIZE * sizeof(REALTYPE));
|
||||
}
|
||||
else
|
||||
NoteGlobalPar.GlobalFilterR->filterout(&outr[0]);
|
||||
|
||||
@@ -1876,7 +1871,7 @@ int ADnote::noteout(REALTYPE *outl, REALTYPE *outr)
|
||||
if(Legato.silent) // Silencer
|
||||
if(Legato.msg != LM_FadeIn) {
|
||||
memset(outl, 0, SOUND_BUFFER_SIZE * sizeof(REALTYPE));
|
||||
memset(outl, 0, SOUND_BUFFER_SIZE * sizeof(REALTYPE));
|
||||
memset(outr, 0, SOUND_BUFFER_SIZE * sizeof(REALTYPE));
|
||||
}
|
||||
switch(Legato.msg) {
|
||||
case LM_CatchUp: // Continue the catch-up...
|
||||
|
||||
@@ -1,136 +0,0 @@
|
||||
#include <cxxtest/TestSuite.h>
|
||||
#include <iostream>
|
||||
#include <fstream>
|
||||
#include "../Misc/Master.h"
|
||||
#include "../Misc/Util.h"
|
||||
#include "../Synth/ADnote.h"
|
||||
#include "../Params/Presets.h"
|
||||
#include "../globals.h"
|
||||
|
||||
class AdNoteTest : public CxxTest::TestSuite
|
||||
{
|
||||
public:
|
||||
|
||||
ADnote *note;
|
||||
Master *master;
|
||||
Controller *controller;
|
||||
unsigned char testnote;
|
||||
|
||||
|
||||
float *outR,*outL;
|
||||
|
||||
void setUp() {
|
||||
|
||||
//First the sensible settings and variables that have to be set:
|
||||
SOUND_BUFFER_SIZE = 256;
|
||||
|
||||
outL=new float[SOUND_BUFFER_SIZE];
|
||||
for (int i=0;i<SOUND_BUFFER_SIZE;++i)
|
||||
*(outL+i)=0;
|
||||
outR=new float[SOUND_BUFFER_SIZE];
|
||||
for (int i=0;i<SOUND_BUFFER_SIZE;++i)
|
||||
*(outR+i)=0;
|
||||
|
||||
//next the bad global variables that for some reason have not been properly placed in some
|
||||
//initialization routine, but rather exist as cryptic oneliners in main.cpp:
|
||||
denormalkillbuf= new REALTYPE[SOUND_BUFFER_SIZE];
|
||||
for (int i=0;i<SOUND_BUFFER_SIZE;i++) denormalkillbuf[i]=0;
|
||||
|
||||
OscilGen::tmpsmps=new REALTYPE[OSCIL_SIZE];
|
||||
newFFTFREQS(&OscilGen::outoscilFFTfreqs,OSCIL_SIZE/2);
|
||||
|
||||
|
||||
//phew, glad to get thouse out of my way. took me a lot of sweat and gdb to get this far...
|
||||
|
||||
//prepare the default settings
|
||||
ADnoteParameters *defaultPreset = new ADnoteParameters(new FFTwrapper(OSCIL_SIZE));
|
||||
XMLwrapper *wrap = new XMLwrapper();
|
||||
wrap->loadXMLfile("src/Tests/guitar-adnote.xmz");
|
||||
TS_ASSERT(wrap->enterbranch("MASTER"));
|
||||
TS_ASSERT(wrap->enterbranch("PART", 0));
|
||||
TS_ASSERT(wrap->enterbranch("INSTRUMENT"));
|
||||
TS_ASSERT(wrap->enterbranch("INSTRUMENT_KIT"));
|
||||
TS_ASSERT(wrap->enterbranch("INSTRUMENT_KIT_ITEM", 0));
|
||||
TS_ASSERT(wrap->enterbranch("ADD_SYNTH_PARAMETERS"));
|
||||
defaultPreset->getfromXML(wrap);
|
||||
//defaultPreset->defaults();
|
||||
|
||||
|
||||
|
||||
controller = new Controller();
|
||||
|
||||
//lets go with.... 50! as a nice note
|
||||
testnote = 50;
|
||||
REALTYPE freq = 440.0*pow(2.0,(testnote-69.0)/12.0);
|
||||
|
||||
note = new ADnote(defaultPreset, controller, freq, 120, 0, testnote, false);
|
||||
|
||||
}
|
||||
|
||||
void willNoteBeRunButIsHereForLinkingReasonsHowsThisForCamelCaseEh()
|
||||
{
|
||||
master = new Master();
|
||||
}
|
||||
|
||||
void tearDown() {
|
||||
delete note;
|
||||
deleteFFTFREQS(&OscilGen::outoscilFFTfreqs);
|
||||
}
|
||||
|
||||
void testDefaults() {
|
||||
|
||||
TS_ASSERT(note->ready);
|
||||
int sampleCount = 0;
|
||||
|
||||
//#define WRITE_OUTPUT
|
||||
|
||||
#ifdef WRITE_OUTPUT
|
||||
ofstream file("adnoteout", ios::out);
|
||||
#endif
|
||||
note->noteout(outL, outR);
|
||||
#ifdef WRITE_OUTPUT
|
||||
for (int i = 0; i < SOUND_BUFFER_SIZE; ++i) {
|
||||
file << outL[i] << std::endl;
|
||||
}
|
||||
#endif
|
||||
sampleCount += SOUND_BUFFER_SIZE;
|
||||
|
||||
TS_ASSERT_DELTA(outL[255], 0.1724, 0.0001);
|
||||
|
||||
note->relasekey();
|
||||
|
||||
|
||||
note->noteout(outL, outR);
|
||||
sampleCount += SOUND_BUFFER_SIZE;
|
||||
TS_ASSERT_DELTA(outL[255], -0.1284, 0.0001);
|
||||
|
||||
note->noteout(outL, outR);
|
||||
sampleCount += SOUND_BUFFER_SIZE;
|
||||
TS_ASSERT_DELTA(outL[255], -0.0206, 0.0001);
|
||||
|
||||
note->noteout(outL, outR);
|
||||
sampleCount += SOUND_BUFFER_SIZE;
|
||||
TS_ASSERT_DELTA(outL[255], -0.1122, 0.0001);
|
||||
|
||||
note->noteout(outL, outR);
|
||||
sampleCount += SOUND_BUFFER_SIZE;
|
||||
TS_ASSERT_DELTA(outL[255], 0.1707, 0.0001);
|
||||
|
||||
while (!note->finished()) {
|
||||
note->noteout(outL, outR);
|
||||
#ifdef WRITE_OUTPUT
|
||||
for (int i = 0; i < SOUND_BUFFER_SIZE; ++i) {
|
||||
file << outL[i] << std::endl;
|
||||
}
|
||||
#endif
|
||||
sampleCount += SOUND_BUFFER_SIZE;
|
||||
}
|
||||
#ifdef WRITE_OUTPUT
|
||||
file.close();
|
||||
#endif
|
||||
|
||||
TS_ASSERT_EQUALS(sampleCount, 9472);
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
@@ -14,5 +14,3 @@ add_library(zynaddsubfx_synth STATIC
|
||||
|
||||
target_link_libraries(zynaddsubfx_synth)
|
||||
|
||||
unit_test(adnote_test ADnote.cxx "")
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
ZynAddSubFX - a software synthesizer
|
||||
|
||||
Envelope.C - Envelope implementation
|
||||
Envelope.cpp - Envelope implementation
|
||||
Copyright (C) 2002-2005 Nasca Octavian Paul
|
||||
Author: Nasca Octavian Paul
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
ZynAddSubFX - a software synthesizer
|
||||
|
||||
LFO.C - LFO implementation
|
||||
LFO.cpp - LFO implementation
|
||||
Copyright (C) 2002-2005 Nasca Octavian Paul
|
||||
Author: Nasca Octavian Paul
|
||||
|
||||
@@ -38,7 +38,7 @@ LFO::LFO(LFOParams *lfopars, REALTYPE basefreq)
|
||||
(pow(2, lfopars->Pfreq * 10.0) - 1.0) / 12.0 * lfostretch;
|
||||
incx = fabs(lfofreq) * (REALTYPE)SOUND_BUFFER_SIZE / (REALTYPE)SAMPLE_RATE;
|
||||
|
||||
if(lfopars->Pcontinuous == 0) {
|
||||
if(lfopars->Pcontinous == 0) {
|
||||
if(lfopars->Pstartphase == 0)
|
||||
x = RND;
|
||||
else
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
ZynAddSubFX - a software synthesizer
|
||||
|
||||
OscilGen.C - Waveform generator for ADnote
|
||||
OscilGen.cpp - Waveform generator for ADnote
|
||||
Copyright (C) 2002-2005 Nasca Octavian Paul
|
||||
Author: Nasca Octavian Paul
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
ZynAddSubFX - a software synthesizer
|
||||
|
||||
PADnote.C - The "pad" synthesizer
|
||||
PADnote.cpp - The "pad" synthesizer
|
||||
Copyright (C) 2002-2005 Nasca Octavian Paul
|
||||
Author: Nasca Octavian Paul
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
ZynAddSubFX - a software synthesizer
|
||||
|
||||
Resonance.C - Resonance
|
||||
Resonance.cpp - Resonance
|
||||
Copyright (C) 2002-2005 Nasca Octavian Paul
|
||||
Author: Nasca Octavian Paul
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
ZynAddSubFX - a software synthesizer
|
||||
|
||||
SUBnote.C - The "subtractive" synthesizer
|
||||
SUBnote.cpp - The "subtractive" synthesizer
|
||||
Copyright (C) 2002-2005 Nasca Octavian Paul
|
||||
Author: Nasca Octavian Paul
|
||||
|
||||
|
||||
@@ -1050,7 +1050,7 @@ Fl_Group* ADvoiceUI::make_window() {
|
||||
o->value(pars->VoicePar[nvoice].Pfixedfreq);
|
||||
} // Fl_Check_Button* o
|
||||
{ WidgetPDial* o = fixedfreqetdial = new WidgetPDial(405, 255, 15, 15, "Eq.T.");
|
||||
fixedfreqetdial->tooltip("How the frequency varies according to the keyboard (leftmost for fixed frequen\
|
||||
fixedfreqetdial->tooltip("How the frequency varies acording to the keyboard (leftmost for fixed frequen\
|
||||
cy)");
|
||||
fixedfreqetdial->box(FL_ROUND_UP_BOX);
|
||||
fixedfreqetdial->color(FL_BACKGROUND_COLOR);
|
||||
|
||||
@@ -481,7 +481,7 @@ if (x==0) fixedfreqetdial->deactivate();
|
||||
Fl_Dial fixedfreqetdial {
|
||||
label {Eq.T.}
|
||||
callback {pars->VoicePar[nvoice].PfixedfreqET=(int) o->value();}
|
||||
tooltip {How the frequency varies according to the keyboard (leftmost for fixed frequency)} xywh {405 255 15 15} box ROUND_UP_BOX labelsize 10 align 8 maximum 127 step 1
|
||||
tooltip {How the frequency varies acording to the keyboard (leftmost for fixed frequency)} xywh {405 255 15 15} box ROUND_UP_BOX labelsize 10 align 8 maximum 127 step 1
|
||||
code0 {o->value(pars->VoicePar[nvoice].PfixedfreqET);}
|
||||
code1 {if (pars->VoicePar[nvoice].Pfixedfreq==0) o->deactivate();}
|
||||
class WidgetPDial
|
||||
|
||||
32
plugins/zynaddsubfx/src/UI/CMakeLists.txt
Normal file
32
plugins/zynaddsubfx/src/UI/CMakeLists.txt
Normal file
@@ -0,0 +1,32 @@
|
||||
set(UI_fl_files
|
||||
ADnoteUI.fl
|
||||
BankUI.fl
|
||||
ConfigUI.fl
|
||||
EffUI.fl
|
||||
EnvelopeUI.fl
|
||||
FilterUI.fl
|
||||
LFOUI.fl
|
||||
MasterUI.fl
|
||||
MicrotonalUI.fl
|
||||
OscilGenUI.fl
|
||||
PADnoteUI.fl
|
||||
PartUI.fl
|
||||
PresetsUI.fl
|
||||
ResonanceUI.fl
|
||||
SeqUI.fl
|
||||
SUBnoteUI.fl
|
||||
VirKeyboard.fl
|
||||
WidgetPDial.fl
|
||||
)
|
||||
|
||||
include_directories(${CMAKE_CURRENT_BINARY_DIR})
|
||||
|
||||
set_source_files_properties(UI/MasterUI.h PROPERTIES GENERATED 1)
|
||||
fltk_wrap_ui(zynaddsubfx_gui ${UI_fl_files})
|
||||
|
||||
add_library(zynaddsubfx_gui STATIC
|
||||
${UI_objs}
|
||||
${zynaddsubfx_gui_FLTK_UI_SRCS}
|
||||
)
|
||||
|
||||
target_link_libraries(zynaddsubfx_gui ${FLTK_LIBRARIES} ${MYFLTK_LIBRARIES})
|
||||
@@ -437,6 +437,12 @@ Fl_Menu_Item EffUI::menu_phaserp[] = {
|
||||
{"Phaser 4", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 7},
|
||||
{"Phaser 5", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 7},
|
||||
{"Phaser 6", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 7},
|
||||
{"APhaser 1", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 7},
|
||||
{"APhaser 2", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 7},
|
||||
{"APhaser 3", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 7},
|
||||
{"APhaser 4", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 7},
|
||||
{"APhaser 5", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 7},
|
||||
{"APhaser 6", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 7},
|
||||
{0,0,0,0,0,0,0,0,0}
|
||||
};
|
||||
|
||||
@@ -468,6 +474,19 @@ void EffUI::cb_phaserp3(WidgetPDial* o, void* v) {
|
||||
((EffUI*)(o->parent()->user_data()))->cb_phaserp3_i(o,v);
|
||||
}
|
||||
|
||||
void EffUI::cb_phaserp4_i(Fl_Choice* o, void*) {
|
||||
eff->seteffectpar(4,(int) o->value());
|
||||
}
|
||||
void EffUI::cb_phaserp4(Fl_Choice* o, void* v) {
|
||||
((EffUI*)(o->parent()->user_data()))->cb_phaserp4_i(o,v);
|
||||
}
|
||||
|
||||
Fl_Menu_Item EffUI::menu_phaserp4[] = {
|
||||
{"SIN", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 0},
|
||||
{"TRI", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 0},
|
||||
{0,0,0,0,0,0,0,0,0}
|
||||
};
|
||||
|
||||
void EffUI::cb_phaserp5_i(WidgetPDial* o, void*) {
|
||||
eff->seteffectpar(5,(int) o->value());
|
||||
}
|
||||
@@ -489,6 +508,13 @@ void EffUI::cb_phaserp7(WidgetPDial* o, void* v) {
|
||||
((EffUI*)(o->parent()->user_data()))->cb_phaserp7_i(o,v);
|
||||
}
|
||||
|
||||
void EffUI::cb_phaserp8_i(Fl_Counter* o, void*) {
|
||||
eff->seteffectpar(8,(int) o->value());
|
||||
}
|
||||
void EffUI::cb_phaserp8(Fl_Counter* o, void* v) {
|
||||
((EffUI*)(o->parent()->user_data()))->cb_phaserp8_i(o,v);
|
||||
}
|
||||
|
||||
void EffUI::cb_phaserp9_i(WidgetPDial* o, void*) {
|
||||
eff->seteffectpar(9,(int) o->value());
|
||||
}
|
||||
@@ -503,26 +529,6 @@ void EffUI::cb_phaserp10(Fl_Check_Button* o, void* v) {
|
||||
((EffUI*)(o->parent()->user_data()))->cb_phaserp10_i(o,v);
|
||||
}
|
||||
|
||||
void EffUI::cb_phaserp4_i(Fl_Choice* o, void*) {
|
||||
eff->seteffectpar(4,(int) o->value());
|
||||
}
|
||||
void EffUI::cb_phaserp4(Fl_Choice* o, void* v) {
|
||||
((EffUI*)(o->parent()->user_data()))->cb_phaserp4_i(o,v);
|
||||
}
|
||||
|
||||
Fl_Menu_Item EffUI::menu_phaserp4[] = {
|
||||
{"SINE", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 0},
|
||||
{"TRI", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 0},
|
||||
{0,0,0,0,0,0,0,0,0}
|
||||
};
|
||||
|
||||
void EffUI::cb_phaserp8_i(Fl_Counter* o, void*) {
|
||||
eff->seteffectpar(8,(int) o->value());
|
||||
}
|
||||
void EffUI::cb_phaserp8(Fl_Counter* o, void* v) {
|
||||
((EffUI*)(o->parent()->user_data()))->cb_phaserp8_i(o,v);
|
||||
}
|
||||
|
||||
void EffUI::cb_phaserp11_i(WidgetPDial* o, void*) {
|
||||
eff->seteffectpar(11,(int) o->value());
|
||||
}
|
||||
@@ -530,6 +536,27 @@ void EffUI::cb_phaserp11(WidgetPDial* o, void* v) {
|
||||
((EffUI*)(o->parent()->user_data()))->cb_phaserp11_i(o,v);
|
||||
}
|
||||
|
||||
void EffUI::cb_phaserp12_i(Fl_Check_Button* o, void*) {
|
||||
eff->seteffectpar(12,(int) o->value());
|
||||
}
|
||||
void EffUI::cb_phaserp12(Fl_Check_Button* o, void* v) {
|
||||
((EffUI*)(o->parent()->user_data()))->cb_phaserp12_i(o,v);
|
||||
}
|
||||
|
||||
void EffUI::cb_phaserp13_i(WidgetPDial* o, void*) {
|
||||
eff->seteffectpar(13,(int) o->value());
|
||||
}
|
||||
void EffUI::cb_phaserp13(WidgetPDial* o, void* v) {
|
||||
((EffUI*)(o->parent()->user_data()))->cb_phaserp13_i(o,v);
|
||||
}
|
||||
|
||||
void EffUI::cb_phaserp14_i(Fl_Check_Button* o, void*) {
|
||||
eff->seteffectpar(14,(int) o->value());
|
||||
}
|
||||
void EffUI::cb_phaserp14(Fl_Check_Button* o, void* v) {
|
||||
((EffUI*)(o->parent()->user_data()))->cb_phaserp14_i(o,v);
|
||||
}
|
||||
|
||||
void EffUI::cb_awp_i(Fl_Choice* o, void*) {
|
||||
eff->changepreset((int)o->value());
|
||||
refresh(eff);
|
||||
@@ -1535,7 +1562,7 @@ Fl_Group* EffUI::make_phaser_window() {
|
||||
effphaserwindow->user_data((void*)(this));
|
||||
effphaserwindow->align(Fl_Align(FL_ALIGN_TOP));
|
||||
effphaserwindow->when(FL_WHEN_RELEASE);
|
||||
{ phaserp = new Fl_Choice(10, 15, 90, 15, "Preset");
|
||||
{ phaserp = new Fl_Choice(10, 15, 100, 15, "Preset");
|
||||
phaserp->down_box(FL_BORDER_BOX);
|
||||
phaserp->color((Fl_Color)14);
|
||||
phaserp->selection_color(FL_FOREGROUND_COLOR);
|
||||
@@ -1582,7 +1609,7 @@ Fl_Group* EffUI::make_phaser_window() {
|
||||
phaserp1->align(Fl_Align(FL_ALIGN_BOTTOM));
|
||||
phaserp1->when(FL_WHEN_CHANGED);
|
||||
} // WidgetPDial* phaserp1
|
||||
{ phaserp2 = new WidgetPDial(85, 40, 30, 30, "Freq");
|
||||
{ phaserp2 = new WidgetPDial(85, 45, 25, 25, "Freq");
|
||||
phaserp2->tooltip("LFO frequency");
|
||||
phaserp2->box(FL_ROUND_UP_BOX);
|
||||
phaserp2->color(FL_BACKGROUND_COLOR);
|
||||
@@ -1596,7 +1623,7 @@ Fl_Group* EffUI::make_phaser_window() {
|
||||
phaserp2->align(Fl_Align(FL_ALIGN_BOTTOM));
|
||||
phaserp2->when(FL_WHEN_CHANGED);
|
||||
} // WidgetPDial* phaserp2
|
||||
{ phaserp3 = new WidgetPDial(120, 40, 30, 30, "Rnd");
|
||||
{ phaserp3 = new WidgetPDial(120, 45, 25, 25, "Rnd");
|
||||
phaserp3->tooltip("LFO randomness");
|
||||
phaserp3->box(FL_ROUND_UP_BOX);
|
||||
phaserp3->color(FL_BACKGROUND_COLOR);
|
||||
@@ -1610,7 +1637,17 @@ Fl_Group* EffUI::make_phaser_window() {
|
||||
phaserp3->align(Fl_Align(FL_ALIGN_BOTTOM));
|
||||
phaserp3->when(FL_WHEN_RELEASE);
|
||||
} // WidgetPDial* phaserp3
|
||||
{ phaserp5 = new WidgetPDial(200, 40, 30, 30, "St.df");
|
||||
{ phaserp4 = new Fl_Choice(245, 55, 40, 15, "LFO");
|
||||
phaserp4->tooltip("LFO function");
|
||||
phaserp4->down_box(FL_BORDER_BOX);
|
||||
phaserp4->labelfont(1);
|
||||
phaserp4->labelsize(10);
|
||||
phaserp4->textsize(8);
|
||||
phaserp4->callback((Fl_Callback*)cb_phaserp4);
|
||||
phaserp4->align(Fl_Align(130));
|
||||
phaserp4->menu(menu_phaserp4);
|
||||
} // Fl_Choice* phaserp4
|
||||
{ phaserp5 = new WidgetPDial(155, 45, 25, 25, "St.df");
|
||||
phaserp5->tooltip("Left/Right Channel Phase Shift");
|
||||
phaserp5->box(FL_ROUND_UP_BOX);
|
||||
phaserp5->color(FL_BACKGROUND_COLOR);
|
||||
@@ -1624,21 +1661,21 @@ Fl_Group* EffUI::make_phaser_window() {
|
||||
phaserp5->align(Fl_Align(FL_ALIGN_BOTTOM));
|
||||
phaserp5->when(FL_WHEN_CHANGED);
|
||||
} // WidgetPDial* phaserp5
|
||||
{ phaserp6 = new WidgetPDial(235, 40, 30, 30, "Dpth");
|
||||
{ phaserp6 = new WidgetPDial(120, 5, 25, 25, "Dpth");
|
||||
phaserp6->tooltip("LFO Depth");
|
||||
phaserp6->box(FL_ROUND_UP_BOX);
|
||||
phaserp6->color(FL_BACKGROUND_COLOR);
|
||||
phaserp6->selection_color(FL_INACTIVE_COLOR);
|
||||
phaserp6->labeltype(FL_NORMAL_LABEL);
|
||||
phaserp6->labelfont(1);
|
||||
phaserp6->labelsize(11);
|
||||
phaserp6->labelsize(10);
|
||||
phaserp6->labelcolor(FL_FOREGROUND_COLOR);
|
||||
phaserp6->maximum(127);
|
||||
phaserp6->callback((Fl_Callback*)cb_phaserp6);
|
||||
phaserp6->align(Fl_Align(FL_ALIGN_BOTTOM));
|
||||
phaserp6->when(FL_WHEN_CHANGED);
|
||||
} // WidgetPDial* phaserp6
|
||||
{ phaserp7 = new WidgetPDial(270, 40, 30, 30, "Fb");
|
||||
{ phaserp7 = new WidgetPDial(185, 45, 25, 25, "Fb");
|
||||
phaserp7->tooltip("Feedback");
|
||||
phaserp7->box(FL_ROUND_UP_BOX);
|
||||
phaserp7->color(FL_BACKGROUND_COLOR);
|
||||
@@ -1652,7 +1689,17 @@ Fl_Group* EffUI::make_phaser_window() {
|
||||
phaserp7->align(Fl_Align(FL_ALIGN_BOTTOM));
|
||||
phaserp7->when(FL_WHEN_CHANGED);
|
||||
} // WidgetPDial* phaserp7
|
||||
{ phaserp9 = new WidgetPDial(345, 40, 30, 30, "L/R");
|
||||
{ Fl_Counter* o = phaserp8 = new Fl_Counter(290, 55, 35, 15, "Stages");
|
||||
phaserp8->type(1);
|
||||
phaserp8->labelfont(1);
|
||||
phaserp8->labelsize(11);
|
||||
phaserp8->minimum(0);
|
||||
phaserp8->maximum(127);
|
||||
phaserp8->step(1);
|
||||
phaserp8->callback((Fl_Callback*)cb_phaserp8);
|
||||
o->range(1,MAX_PHASER_STAGES);
|
||||
} // Fl_Counter* phaserp8
|
||||
{ phaserp9 = new WidgetPDial(215, 45, 25, 25, "L/R");
|
||||
phaserp9->tooltip("Channel Routing");
|
||||
phaserp9->box(FL_ROUND_UP_BOX);
|
||||
phaserp9->color(FL_BACKGROUND_COLOR);
|
||||
@@ -1666,7 +1713,7 @@ Fl_Group* EffUI::make_phaser_window() {
|
||||
phaserp9->align(Fl_Align(FL_ALIGN_BOTTOM));
|
||||
phaserp9->when(FL_WHEN_CHANGED);
|
||||
} // WidgetPDial* phaserp9
|
||||
{ phaserp10 = new Fl_Check_Button(185, 10, 74, 20, "Substract");
|
||||
{ phaserp10 = new Fl_Check_Button(200, 10, 74, 20, "Substract");
|
||||
phaserp10->tooltip("inverts output");
|
||||
phaserp10->box(FL_THIN_UP_BOX);
|
||||
phaserp10->down_box(FL_DOWN_BOX);
|
||||
@@ -1675,27 +1722,7 @@ Fl_Group* EffUI::make_phaser_window() {
|
||||
phaserp10->labelsize(10);
|
||||
phaserp10->callback((Fl_Callback*)cb_phaserp10);
|
||||
} // Fl_Check_Button* phaserp10
|
||||
{ phaserp4 = new Fl_Choice(155, 50, 40, 15, "LFO type");
|
||||
phaserp4->tooltip("LFO function");
|
||||
phaserp4->down_box(FL_BORDER_BOX);
|
||||
phaserp4->labelfont(1);
|
||||
phaserp4->labelsize(10);
|
||||
phaserp4->textsize(8);
|
||||
phaserp4->callback((Fl_Callback*)cb_phaserp4);
|
||||
phaserp4->align(Fl_Align(130));
|
||||
phaserp4->menu(menu_phaserp4);
|
||||
} // Fl_Choice* phaserp4
|
||||
{ Fl_Counter* o = phaserp8 = new Fl_Counter(305, 55, 35, 15, "Stages");
|
||||
phaserp8->type(1);
|
||||
phaserp8->labelfont(1);
|
||||
phaserp8->labelsize(11);
|
||||
phaserp8->minimum(0);
|
||||
phaserp8->maximum(127);
|
||||
phaserp8->step(1);
|
||||
phaserp8->callback((Fl_Callback*)cb_phaserp8);
|
||||
o->range(1,MAX_PHASER_STAGES);
|
||||
} // Fl_Counter* phaserp8
|
||||
{ phaserp11 = new WidgetPDial(155, 10, 25, 25, "Phase");
|
||||
{ phaserp11 = new WidgetPDial(155, 5, 25, 25, "Phase");
|
||||
phaserp11->box(FL_ROUND_UP_BOX);
|
||||
phaserp11->color(FL_BACKGROUND_COLOR);
|
||||
phaserp11->selection_color(FL_INACTIVE_COLOR);
|
||||
@@ -1708,6 +1735,29 @@ Fl_Group* EffUI::make_phaser_window() {
|
||||
phaserp11->align(Fl_Align(FL_ALIGN_BOTTOM));
|
||||
phaserp11->when(FL_WHEN_CHANGED);
|
||||
} // WidgetPDial* phaserp11
|
||||
{ phaserp12 = new Fl_Check_Button(245, 35, 55, 15, "hyp.");
|
||||
phaserp12->tooltip("hyper");
|
||||
phaserp12->down_box(FL_DOWN_BOX);
|
||||
phaserp12->callback((Fl_Callback*)cb_phaserp12);
|
||||
} // Fl_Check_Button* phaserp12
|
||||
{ phaserp13 = new WidgetPDial(340, 50, 25, 25, "dist");
|
||||
phaserp13->tooltip("Distortion");
|
||||
phaserp13->box(FL_ROUND_UP_BOX);
|
||||
phaserp13->color(FL_BACKGROUND_COLOR);
|
||||
phaserp13->selection_color(FL_INACTIVE_COLOR);
|
||||
phaserp13->labeltype(FL_NORMAL_LABEL);
|
||||
phaserp13->labelfont(1);
|
||||
phaserp13->labelsize(11);
|
||||
phaserp13->labelcolor(FL_FOREGROUND_COLOR);
|
||||
phaserp13->maximum(127);
|
||||
phaserp13->callback((Fl_Callback*)cb_phaserp13);
|
||||
phaserp13->align(Fl_Align(FL_ALIGN_BOTTOM));
|
||||
phaserp13->when(FL_WHEN_CHANGED);
|
||||
} // WidgetPDial* phaserp13
|
||||
{ phaserp14 = new Fl_Check_Button(305, 35, 70, 15, "Analog");
|
||||
phaserp14->down_box(FL_DOWN_BOX);
|
||||
phaserp14->callback((Fl_Callback*)cb_phaserp14);
|
||||
} // Fl_Check_Button* phaserp14
|
||||
effphaserwindow->end();
|
||||
} // Fl_Group* effphaserwindow
|
||||
return effphaserwindow;
|
||||
@@ -2504,6 +2554,9 @@ switch(eff->geteffect()){
|
||||
phaserp9->value(eff->geteffectpar(9));
|
||||
phaserp10->value(eff->geteffectpar(10));
|
||||
phaserp11->value(eff->geteffectpar(11));
|
||||
phaserp12->value(eff->geteffectpar(12));
|
||||
phaserp13->value(eff->geteffectpar(13));
|
||||
phaserp14->value(eff->geteffectpar(14));
|
||||
effphaserwindow->show();
|
||||
break;
|
||||
case 5:
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
# data file for the Fltk User Interface Designer (fluid)
|
||||
version 1.0109
|
||||
version 1.0107
|
||||
header_name {.h}
|
||||
code_name {.cc}
|
||||
decl {//Copyright (c) 2002-2005 Nasca Octavian Paul} {}
|
||||
@@ -155,7 +155,7 @@ return(log(freq/20.0)/log(1000.0));} {}
|
||||
decl {int maxdB;} {}
|
||||
}
|
||||
|
||||
class EffUI {open : {public Fl_Group,public PresetsUI_}
|
||||
class EffUI {: {public Fl_Group,public PresetsUI_}
|
||||
} {
|
||||
Function {EffUI(int x,int y, int w, int h, const char *label=0):Fl_Group(x,y,w,h,label)} {} {
|
||||
code {eff=NULL;
|
||||
@@ -179,7 +179,7 @@ if (filterwindow!=NULL){
|
||||
}
|
||||
Function {make_null_window()} {} {
|
||||
Fl_Window effnullwindow {
|
||||
xywh {287 379 380 95} type Double box PLASTIC_UP_BOX color 221 labelfont 1 hide
|
||||
xywh {216 539 380 95} type Double box PLASTIC_UP_BOX color 221 labelfont 1 hide
|
||||
class Fl_Group
|
||||
} {
|
||||
Fl_Text_Display {} {
|
||||
@@ -188,11 +188,10 @@ if (filterwindow!=NULL){
|
||||
}
|
||||
}
|
||||
}
|
||||
Function {make_reverb_window()} {open
|
||||
} {
|
||||
Fl_Window effreverbwindow {open
|
||||
xywh {343 337 380 95} type Double box PLASTIC_UP_BOX color 221 labelfont 1
|
||||
class Fl_Group visible
|
||||
Function {make_reverb_window()} {} {
|
||||
Fl_Window effreverbwindow {
|
||||
xywh {343 337 380 95} type Double box PLASTIC_UP_BOX color 221 labelfont 1 hide
|
||||
class Fl_Group
|
||||
} {
|
||||
Fl_Text_Display {} {
|
||||
label {Reverb }
|
||||
@@ -344,7 +343,7 @@ if (eff->geteffectpar(10)==2) revp12->activate();
|
||||
callback {int x=64;
|
||||
if (Fl::event_button1()) x=(int)o->value();
|
||||
else o->value(x);
|
||||
eff->seteffectpar(11,x);} selected
|
||||
eff->seteffectpar(11,x);}
|
||||
tooltip RoomSize xywh {200 10 25 25} box ROUND_UP_BOX labelfont 1 labelsize 8 align 8 minimum 1 maximum 127 step 1
|
||||
class WidgetPDial
|
||||
}
|
||||
@@ -585,14 +584,14 @@ refresh(eff);}
|
||||
}
|
||||
Function {make_phaser_window()} {} {
|
||||
Fl_Window effphaserwindow {
|
||||
xywh {389 213 380 95} type Double box PLASTIC_UP_BOX color 221 labelfont 1 hide
|
||||
xywh {75 25 380 95} type Double box PLASTIC_UP_BOX color 221 labelfont 1 hide
|
||||
class Fl_Group
|
||||
} {
|
||||
Fl_Choice phaserp {
|
||||
label Preset
|
||||
callback {eff->changepreset((int)o->value());
|
||||
refresh(eff);}
|
||||
xywh {10 15 90 15} down_box BORDER_BOX color 14 selection_color 0 labelfont 1 labelsize 10 align 5 textfont 1 textsize 10 textcolor 7
|
||||
xywh {10 15 100 15} down_box BORDER_BOX color 14 selection_color 0 labelfont 1 labelsize 10 align 5 textfont 1 textsize 10 textcolor 7
|
||||
} {
|
||||
MenuItem {} {
|
||||
label {Phaser 1}
|
||||
@@ -618,6 +617,30 @@ refresh(eff);}
|
||||
label {Phaser 6}
|
||||
xywh {80 80 100 20} labelfont 1 labelsize 10 labelcolor 7
|
||||
}
|
||||
MenuItem {} {
|
||||
label {APhaser 1}
|
||||
xywh {40 40 100 20} labelfont 1 labelsize 10 labelcolor 7
|
||||
}
|
||||
MenuItem {} {
|
||||
label {APhaser 2}
|
||||
xywh {50 50 100 20} labelfont 1 labelsize 10 labelcolor 7
|
||||
}
|
||||
MenuItem {} {
|
||||
label {APhaser 3}
|
||||
xywh {60 60 100 20} labelfont 1 labelsize 10 labelcolor 7
|
||||
}
|
||||
MenuItem {} {
|
||||
label {APhaser 4}
|
||||
xywh {70 70 100 20} labelfont 1 labelsize 10 labelcolor 7
|
||||
}
|
||||
MenuItem {} {
|
||||
label {APhaser 5}
|
||||
xywh {80 80 100 20} labelfont 1 labelsize 10 labelcolor 7
|
||||
}
|
||||
MenuItem {} {
|
||||
label {APhaser 6} selected
|
||||
xywh {90 90 100 20} labelfont 1 labelsize 10 labelcolor 7
|
||||
}
|
||||
}
|
||||
Fl_Text_Display {} {
|
||||
label Phaser
|
||||
@@ -638,51 +661,22 @@ refresh(eff);}
|
||||
Fl_Dial phaserp2 {
|
||||
label Freq
|
||||
callback {eff->seteffectpar(2,(int) o->value());}
|
||||
tooltip {LFO frequency} xywh {85 40 30 30} box ROUND_UP_BOX labelfont 1 labelsize 11 maximum 127
|
||||
tooltip {LFO frequency} xywh {85 45 25 25} box ROUND_UP_BOX labelfont 1 labelsize 11 maximum 127
|
||||
class WidgetPDial
|
||||
}
|
||||
Fl_Dial phaserp3 {
|
||||
label Rnd
|
||||
callback {eff->seteffectpar(3,(int) o->value());}
|
||||
tooltip {LFO randomness} xywh {120 40 30 30} box ROUND_UP_BOX labelfont 1 labelsize 11 when 4 maximum 127
|
||||
tooltip {LFO randomness} xywh {120 45 25 25} box ROUND_UP_BOX labelfont 1 labelsize 11 when 4 maximum 127
|
||||
class WidgetPDial
|
||||
}
|
||||
Fl_Dial phaserp5 {
|
||||
label {St.df}
|
||||
callback {eff->seteffectpar(5,(int) o->value());}
|
||||
tooltip {Left/Right Channel Phase Shift} xywh {200 40 30 30} box ROUND_UP_BOX labelfont 1 labelsize 11 maximum 127
|
||||
class WidgetPDial
|
||||
}
|
||||
Fl_Dial phaserp6 {
|
||||
label Dpth
|
||||
callback {eff->seteffectpar(6,(int) o->value());}
|
||||
tooltip {LFO Depth} xywh {235 40 30 30} box ROUND_UP_BOX labelfont 1 labelsize 11 maximum 127
|
||||
class WidgetPDial
|
||||
}
|
||||
Fl_Dial phaserp7 {
|
||||
label Fb
|
||||
callback {eff->seteffectpar(7,(int) o->value());}
|
||||
tooltip Feedback xywh {270 40 30 30} box ROUND_UP_BOX labelfont 1 labelsize 11 maximum 127
|
||||
class WidgetPDial
|
||||
}
|
||||
Fl_Dial phaserp9 {
|
||||
label {L/R}
|
||||
callback {eff->seteffectpar(9,(int) o->value());}
|
||||
tooltip {Channel Routing} xywh {345 40 30 30} box ROUND_UP_BOX labelfont 1 labelsize 11 maximum 127
|
||||
class WidgetPDial
|
||||
}
|
||||
Fl_Check_Button phaserp10 {
|
||||
label Substract
|
||||
callback {eff->seteffectpar(10,(int) o->value());}
|
||||
tooltip {inverts output} xywh {185 10 74 20} box THIN_UP_BOX down_box DOWN_BOX color 230 labelfont 1 labelsize 10
|
||||
}
|
||||
Fl_Choice phaserp4 {
|
||||
label {LFO type}
|
||||
label LFO
|
||||
callback {eff->seteffectpar(4,(int) o->value());}
|
||||
tooltip {LFO function} xywh {155 50 40 15} down_box BORDER_BOX labelfont 1 labelsize 10 align 130 textsize 8
|
||||
tooltip {LFO function} xywh {245 55 40 15} down_box BORDER_BOX labelfont 1 labelsize 10 align 130 textsize 8
|
||||
} {
|
||||
MenuItem {} {
|
||||
label SINE
|
||||
label SIN
|
||||
xywh {15 15 100 20} labelfont 1 labelsize 10
|
||||
}
|
||||
MenuItem {} {
|
||||
@@ -690,18 +684,63 @@ refresh(eff);}
|
||||
xywh {25 25 100 20} labelfont 1 labelsize 10
|
||||
}
|
||||
}
|
||||
Fl_Dial phaserp5 {
|
||||
label {St.df}
|
||||
callback {eff->seteffectpar(5,(int) o->value());}
|
||||
tooltip {Left/Right Channel Phase Shift} xywh {155 45 25 25} box ROUND_UP_BOX labelfont 1 labelsize 11 maximum 127
|
||||
class WidgetPDial
|
||||
}
|
||||
Fl_Dial phaserp6 {
|
||||
label Dpth
|
||||
callback {eff->seteffectpar(6,(int) o->value());}
|
||||
tooltip {LFO Depth} xywh {120 5 25 25} box ROUND_UP_BOX labelfont 1 labelsize 10 maximum 127
|
||||
class WidgetPDial
|
||||
}
|
||||
Fl_Dial phaserp7 {
|
||||
label Fb
|
||||
callback {eff->seteffectpar(7,(int) o->value());}
|
||||
tooltip Feedback xywh {185 45 25 25} box ROUND_UP_BOX labelfont 1 labelsize 11 maximum 127
|
||||
class WidgetPDial
|
||||
}
|
||||
Fl_Counter phaserp8 {
|
||||
label Stages
|
||||
callback {eff->seteffectpar(8,(int) o->value());}
|
||||
xywh {305 55 35 15} type Simple labelfont 1 labelsize 11 minimum 0 maximum 127 step 1
|
||||
xywh {290 55 35 15} type Simple labelfont 1 labelsize 11 minimum 0 maximum 127 step 1
|
||||
code0 {o->range(1,MAX_PHASER_STAGES);}
|
||||
}
|
||||
Fl_Dial phaserp9 {
|
||||
label {L/R}
|
||||
callback {eff->seteffectpar(9,(int) o->value());}
|
||||
tooltip {Channel Routing} xywh {215 45 25 25} box ROUND_UP_BOX labelfont 1 labelsize 11 maximum 127
|
||||
class WidgetPDial
|
||||
}
|
||||
Fl_Check_Button phaserp10 {
|
||||
label Substract
|
||||
callback {eff->seteffectpar(10,(int) o->value());}
|
||||
tooltip {inverts output} xywh {200 10 74 20} box THIN_UP_BOX down_box DOWN_BOX color 230 labelfont 1 labelsize 10
|
||||
}
|
||||
Fl_Dial phaserp11 {
|
||||
label Phase
|
||||
callback {eff->seteffectpar(11,(int) o->value());}
|
||||
xywh {155 10 25 25} box ROUND_UP_BOX labelfont 1 labelsize 10 maximum 127
|
||||
xywh {155 5 25 25} box ROUND_UP_BOX labelfont 1 labelsize 10 maximum 127
|
||||
class WidgetPDial
|
||||
}
|
||||
Fl_Check_Button phaserp12 {
|
||||
label {hyp.}
|
||||
callback {eff->seteffectpar(12,(int) o->value());}
|
||||
tooltip hyper xywh {245 35 55 15} down_box DOWN_BOX
|
||||
}
|
||||
Fl_Dial phaserp13 {
|
||||
label dist
|
||||
callback {eff->seteffectpar(13,(int) o->value());}
|
||||
tooltip Distortion xywh {340 50 25 25} box ROUND_UP_BOX labelfont 1 labelsize 11 maximum 127
|
||||
class WidgetPDial
|
||||
}
|
||||
Fl_Check_Button phaserp14 {
|
||||
label Analog
|
||||
callback {eff->seteffectpar(14,(int) o->value());}
|
||||
xywh {305 35 70 15} down_box DOWN_BOX
|
||||
}
|
||||
}
|
||||
}
|
||||
Function {make_alienwah_window()} {} {
|
||||
@@ -1353,6 +1392,9 @@ switch(eff->geteffect()){
|
||||
phaserp9->value(eff->geteffectpar(9));
|
||||
phaserp10->value(eff->geteffectpar(10));
|
||||
phaserp11->value(eff->geteffectpar(11));
|
||||
phaserp12->value(eff->geteffectpar(12));
|
||||
phaserp13->value(eff->geteffectpar(13));
|
||||
phaserp14->value(eff->geteffectpar(14));
|
||||
effphaserwindow->show();
|
||||
break;
|
||||
case 5:
|
||||
@@ -1422,7 +1464,8 @@ switch(eff->geteffect()){
|
||||
|
||||
this->show();} {}
|
||||
}
|
||||
Function {refresh()} {} {
|
||||
Function {refresh()} {open
|
||||
} {
|
||||
code {refresh(eff);} {}
|
||||
}
|
||||
decl {EffectMgr *eff;} {}
|
||||
|
||||
@@ -250,6 +250,12 @@ public:
|
||||
private:
|
||||
void cb_phaserp3_i(WidgetPDial*, void*);
|
||||
static void cb_phaserp3(WidgetPDial*, void*);
|
||||
public:
|
||||
Fl_Choice *phaserp4;
|
||||
private:
|
||||
void cb_phaserp4_i(Fl_Choice*, void*);
|
||||
static void cb_phaserp4(Fl_Choice*, void*);
|
||||
static Fl_Menu_Item menu_phaserp4[];
|
||||
public:
|
||||
WidgetPDial *phaserp5;
|
||||
private:
|
||||
@@ -265,6 +271,11 @@ public:
|
||||
private:
|
||||
void cb_phaserp7_i(WidgetPDial*, void*);
|
||||
static void cb_phaserp7(WidgetPDial*, void*);
|
||||
public:
|
||||
Fl_Counter *phaserp8;
|
||||
private:
|
||||
void cb_phaserp8_i(Fl_Counter*, void*);
|
||||
static void cb_phaserp8(Fl_Counter*, void*);
|
||||
public:
|
||||
WidgetPDial *phaserp9;
|
||||
private:
|
||||
@@ -275,22 +286,26 @@ public:
|
||||
private:
|
||||
void cb_phaserp10_i(Fl_Check_Button*, void*);
|
||||
static void cb_phaserp10(Fl_Check_Button*, void*);
|
||||
public:
|
||||
Fl_Choice *phaserp4;
|
||||
private:
|
||||
void cb_phaserp4_i(Fl_Choice*, void*);
|
||||
static void cb_phaserp4(Fl_Choice*, void*);
|
||||
static Fl_Menu_Item menu_phaserp4[];
|
||||
public:
|
||||
Fl_Counter *phaserp8;
|
||||
private:
|
||||
void cb_phaserp8_i(Fl_Counter*, void*);
|
||||
static void cb_phaserp8(Fl_Counter*, void*);
|
||||
public:
|
||||
WidgetPDial *phaserp11;
|
||||
private:
|
||||
void cb_phaserp11_i(WidgetPDial*, void*);
|
||||
static void cb_phaserp11(WidgetPDial*, void*);
|
||||
public:
|
||||
Fl_Check_Button *phaserp12;
|
||||
private:
|
||||
void cb_phaserp12_i(Fl_Check_Button*, void*);
|
||||
static void cb_phaserp12(Fl_Check_Button*, void*);
|
||||
public:
|
||||
WidgetPDial *phaserp13;
|
||||
private:
|
||||
void cb_phaserp13_i(WidgetPDial*, void*);
|
||||
static void cb_phaserp13(WidgetPDial*, void*);
|
||||
public:
|
||||
Fl_Check_Button *phaserp14;
|
||||
private:
|
||||
void cb_phaserp14_i(Fl_Check_Button*, void*);
|
||||
static void cb_phaserp14(Fl_Check_Button*, void*);
|
||||
public:
|
||||
Fl_Group* make_alienwah_window();
|
||||
Fl_Group *effalienwahwindow;
|
||||
|
||||
@@ -57,11 +57,11 @@ Fl_Menu_Item LFOUI::menu_LFOtype[] = {
|
||||
{0,0,0,0,0,0,0,0,0}
|
||||
};
|
||||
|
||||
void LFOUI::cb_continuous_i(Fl_Check_Button* o, void*) {
|
||||
pars->Pcontinuous=(int)o->value();
|
||||
void LFOUI::cb_continous_i(Fl_Check_Button* o, void*) {
|
||||
pars->Pcontinous=(int)o->value();
|
||||
}
|
||||
void LFOUI::cb_continuous(Fl_Check_Button* o, void* v) {
|
||||
((LFOUI*)(o->parent()->parent()->user_data()))->cb_continuous_i(o,v);
|
||||
void LFOUI::cb_continous(Fl_Check_Button* o, void* v) {
|
||||
((LFOUI*)(o->parent()->parent()->user_data()))->cb_continous_i(o,v);
|
||||
}
|
||||
|
||||
void LFOUI::cb_freqrand_i(WidgetPDial* o, void*) {
|
||||
@@ -203,13 +203,13 @@ Fl_Group* LFOUI::make_window() {
|
||||
LFOtype->align(Fl_Align(FL_ALIGN_BOTTOM));
|
||||
LFOtype->menu(menu_LFOtype);
|
||||
} // Fl_Choice* LFOtype
|
||||
{ continuous = new Fl_Check_Button(165, 35, 15, 15, "C.");
|
||||
continuous->tooltip("Continuous LFO");
|
||||
continuous->down_box(FL_DOWN_BOX);
|
||||
continuous->labelsize(10);
|
||||
continuous->callback((Fl_Callback*)cb_continuous);
|
||||
continuous->align(Fl_Align(FL_ALIGN_BOTTOM));
|
||||
} // Fl_Check_Button* continuous
|
||||
{ continous = new Fl_Check_Button(165, 35, 15, 15, "C.");
|
||||
continous->tooltip("Continous LFO");
|
||||
continous->down_box(FL_DOWN_BOX);
|
||||
continous->labelsize(10);
|
||||
continous->callback((Fl_Callback*)cb_continous);
|
||||
continous->align(Fl_Align(FL_ALIGN_BOTTOM));
|
||||
} // Fl_Check_Button* continous
|
||||
{ freqrand = new WidgetPDial(205, 7, 20, 20, "F.R.");
|
||||
freqrand->tooltip("LFO Frequency Randomness");
|
||||
freqrand->box(FL_ROUND_UP_BOX);
|
||||
@@ -268,7 +268,7 @@ void LFOUI::refresh() {
|
||||
intensity->value(pars->Pintensity);
|
||||
startphase->value(pars->Pstartphase);
|
||||
delay->value(pars->Pdelay);
|
||||
continuous->value(pars->Pcontinuous);
|
||||
continous->value(pars->Pcontinous);
|
||||
stretch->value(pars->Pstretch);
|
||||
randomness->value(pars->Prandomness);
|
||||
freqrand->value(pars->Pfreqrand);
|
||||
|
||||
@@ -119,10 +119,10 @@ hide();
|
||||
xywh {70 70 100 20} labelfont 1 labelsize 10
|
||||
}
|
||||
}
|
||||
Fl_Check_Button continuous {
|
||||
Fl_Check_Button continous {
|
||||
label {C.}
|
||||
callback {pars->Pcontinuous=(int)o->value();}
|
||||
tooltip {Continuous LFO} xywh {165 35 15 15} down_box DOWN_BOX labelsize 10 align 2
|
||||
callback {pars->Pcontinous=(int)o->value();}
|
||||
tooltip {Continous LFO} xywh {165 35 15 15} down_box DOWN_BOX labelsize 10 align 2
|
||||
}
|
||||
Fl_Dial freqrand {
|
||||
label {F.R.}
|
||||
@@ -154,7 +154,7 @@ hide();
|
||||
intensity->value(pars->Pintensity);
|
||||
startphase->value(pars->Pstartphase);
|
||||
delay->value(pars->Pdelay);
|
||||
continuous->value(pars->Pcontinuous);
|
||||
continous->value(pars->Pcontinous);
|
||||
stretch->value(pars->Pstretch);
|
||||
randomness->value(pars->Prandomness);
|
||||
freqrand->value(pars->Pfreqrand);
|
||||
|
||||
@@ -56,10 +56,10 @@ private:
|
||||
static void cb_LFOtype(Fl_Choice*, void*);
|
||||
static Fl_Menu_Item menu_LFOtype[];
|
||||
public:
|
||||
Fl_Check_Button *continuous;
|
||||
Fl_Check_Button *continous;
|
||||
private:
|
||||
void cb_continuous_i(Fl_Check_Button*, void*);
|
||||
static void cb_continuous(Fl_Check_Button*, void*);
|
||||
void cb_continous_i(Fl_Check_Button*, void*);
|
||||
static void cb_continous(Fl_Check_Button*, void*);
|
||||
public:
|
||||
WidgetPDial *freqrand;
|
||||
private:
|
||||
|
||||
@@ -2011,6 +2011,7 @@ General Public License for details.");
|
||||
o->labelfont(1);
|
||||
o->labelsize(12);
|
||||
o->align(Fl_Align(FL_ALIGN_BOTTOM|FL_ALIGN_INSIDE));
|
||||
o->hide();
|
||||
{ Fl_Counter* o = simplesyseffnocounter = new Fl_Counter(350, 75, 80, 20, "Sys.Effect No.");
|
||||
simplesyseffnocounter->type(1);
|
||||
simplesyseffnocounter->labelfont(1);
|
||||
@@ -2072,7 +2073,6 @@ General Public License for details.");
|
||||
o->labelfont(1);
|
||||
o->labelsize(12);
|
||||
o->align(Fl_Align(FL_ALIGN_BOTTOM|FL_ALIGN_INSIDE));
|
||||
o->hide();
|
||||
{ Fl_Counter* o = simpleinseffnocounter = new Fl_Counter(350, 75, 80, 20, "Ins.Effect No.");
|
||||
simpleinseffnocounter->type(1);
|
||||
simpleinseffnocounter->labelfont(1);
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user