CAPS: updated to version 0.4.5

Updated CAPS plugins to version 0.4.5 - changes:

  * Narrower plugin added
  * fixed 'configure.py' to work with python3
  * fixed Sin, Roessler and Lorenz gain smoothing on activation

Signed-off-by: Tobias Doerffel <tobias.doerffel@gmail.com>
This commit is contained in:
Tobias Doerffel
2011-04-05 14:33:08 +02:00
parent a90ffed0a8
commit d98acff3bb
63 changed files with 2969 additions and 391 deletions

View File

@@ -84,15 +84,15 @@ template <sample_func_t F, int OVERSAMPLE>
void
AmpIII::one_cycle (int frames)
{
d_sample * s = ports[0];
sample_t * s = ports[0];
d_sample gain = getport(1);
d_sample temp = getport(2) * tube.scale;
sample_t gain = getport(1);
sample_t temp = getport(2) * tube.scale;
drive = getport(3) * .5;
i_drive = 1 / (1 - drive);
d_sample * d = ports[4];
sample_t * d = ports[4];
*ports[5] = OVERSAMPLE;
@@ -109,7 +109,7 @@ AmpIII::one_cycle (int frames)
for (int i = 0; i < frames; ++i)
{
register d_sample a = s[i];
register sample_t a = s[i];
a = g * tube.transfer (a * temp);
a = filter.process (a + normal);
@@ -200,17 +200,17 @@ AmpIV::one_cycle (int frames)
{
double one_over_n = frames > 0 ? 1. / frames : 1;
d_sample * s = ports[0];
sample_t * s = ports[0];
d_sample gain = getport(1);
d_sample temp = getport(2) * tube.scale;
sample_t gain = getport(1);
sample_t temp = getport(2) * tube.scale;
tone.start_cycle (ports + 3, one_over_n);
drive = getport(7) * .5;
i_drive = 1 / (1 - drive);
d_sample * d = ports[8];
sample_t * d = ports[8];
*ports[9] = OVERSAMPLE;
@@ -226,7 +226,7 @@ AmpIV::one_cycle (int frames)
for (int i = 0; i < frames; ++i)
{
register d_sample a = s[i] + normal;
register sample_t a = s[i] + normal;
a = g * tube.transfer (a * temp);
a = tone.process (a);
@@ -337,9 +337,9 @@ template <sample_func_t F, int OVERSAMPLE>
void
AmpV::one_cycle (int frames)
{
d_sample * s = ports[0];
sample_t * s = ports[0];
d_sample gain = getport(1);
sample_t gain = getport(1);
if (*ports[2] != cut)
{
@@ -359,10 +359,10 @@ AmpV::one_cycle (int frames)
i_drive = 1 / (1 - drive);
#define MAX_WATTS port_info[5].range.UpperBound
d_sample sag = (MAX_WATTS - getport(5)) / MAX_WATTS;
sample_t sag = (MAX_WATTS - getport(5)) / MAX_WATTS;
sag = .6 * sag * sag;
d_sample * d = ports[6];
sample_t * d = ports[6];
*ports[7] = OVERSAMPLE;
@@ -382,8 +382,8 @@ AmpV::one_cycle (int frames)
for (int i = 0; i < frames; ++i)
{
register d_sample a = s[i];
register d_sample v = 3 - supply;
register sample_t a = s[i];
register sample_t v = 3 - supply;
/* alternative curve: v = v * v * .1 + .1; */
v = v * v * .06 + .46;
@@ -503,18 +503,18 @@ template <sample_func_t F, int OVERSAMPLE>
void
AmpVTS::one_cycle (int frames)
{
d_sample * s = ports[0];
sample_t * s = ports[0];
tonestack.start_cycle (ports + 1, 2);
d_sample gain = getport(2);
sample_t gain = getport(2);
drive = getport(6) * .5;
i_drive = 1 / (1 - drive);
d_sample sag = 1 - max (0.0001, min (1, getport(7)));
sample_t sag = 1 - max (0.0001, min (1, getport(7)));
sag = .6 * sag * sag; /* map to log space makes slider better */
d_sample * d = ports[8];
sample_t * d = ports[8];
*ports[9] = OVERSAMPLE;

View File

@@ -49,7 +49,7 @@ class AmpStub
public:
DSP::TwelveAX7_3 tube;
d_sample drive, i_drive;
sample_t drive, i_drive;
struct {
/* gain (remember current setting and fade to port setting in run) */
@@ -78,7 +78,7 @@ class AmpStub
void init (bool adjust_downsampler = false);
inline d_sample power_transfer (d_sample a)
inline sample_t power_transfer (sample_t a)
{
return i_drive * (a - drive * fabs (a) * a);
}
@@ -98,7 +98,7 @@ class PreampIII
public:
static PortInfo port_info[];
d_sample adding_gain;
sample_t adding_gain;
void init();
void activate()
@@ -136,7 +136,7 @@ class AmpIII
public:
static PortInfo port_info[];
d_sample adding_gain;
sample_t adding_gain;
void init();
void activate()
@@ -169,16 +169,16 @@ PreampBand;
class ToneControls
{
public:
d_sample eq_gain[4];
sample_t eq_gain[4];
DSP::Eq<4> eq;
static PreampBand bands[4];
public:
void init (double _fs);
void activate (d_sample **);
void activate (sample_t **);
inline void
start_cycle (d_sample ** ports, double one_over_n)
start_cycle (sample_t ** ports, double one_over_n)
{
for (int i = 0; i < 4; ++i)
{
@@ -198,7 +198,7 @@ class ToneControls
double get_band_gain (int i, double g);
void set_band_gain (int i, float g);
inline d_sample process (d_sample x)
inline sample_t process (sample_t x)
{
return eq.process (x);
}
@@ -218,7 +218,7 @@ class PreampIV
public:
static PortInfo port_info[];
d_sample adding_gain;
sample_t adding_gain;
void init();
void activate();
@@ -248,7 +248,7 @@ class AmpIV
public:
static PortInfo port_info[];
d_sample adding_gain;
sample_t adding_gain;
void init();
void activate()
@@ -284,16 +284,16 @@ class AmpV
DSP::BiQuad filter[3];
d_sample cut, tone;
sample_t cut, tone;
/* supply voltage sag */
d_sample supply;
sample_t supply;
DSP::BiQuad power_cap[2];
public:
static PortInfo port_info[];
d_sample adding_gain;
sample_t adding_gain;
void init();
void activate()
@@ -336,16 +336,16 @@ class AmpVTS
template <sample_func_t F, int OVERSAMPLE>
void one_cycle (int frames);
d_sample cut, tone;
sample_t cut, tone;
/* supply voltage sag */
d_sample supply;
sample_t supply;
DSP::BiQuad power_cap[2];
public:
static PortInfo port_info[];
d_sample adding_gain;
sample_t adding_gain;
void init();
void activate()

View File

@@ -0,0 +1,206 @@
0.4.5
* Narrower plugin added
* fixed 'configure.py' to work with python3
* fixed Sin, Roessler and Lorenz gain smoothing on activation
0.4.4
0.4.3
* basics.h cleanup / comments
* minor Makefile cleanup
* comment cosmetics
* Eq and Eq2x2 per-band Q changed to 1.414 (= 1 octave)
* Eq lowest band default value fixed to read 0
* Niclas' fix for the bessel function implemented
* uninitialised plugin states eliminated thanks to Damon
* linker options for OSX added to the Makefile
0.4.2
* fixed the 'model' port index for AmpVTS in the RDF generator
0.4.1
* cleaned up Eq.h and Eq.cc (many g++ versions choke on the unused code
there)
* changed -O3 to -O2 in the g++ invocation
0.4.0
* ToneStack plugins, by David Yeh
* AmpV + Tone stack plugin, employing David Yeh's fine work
* comment cosmetics
* Amp* denormal protection fixed (or is it, Dave? ;)
* minor code cleanup in Amp.cc
* caps.rdf updated with plugin categories (thanks to Paul Winkler)
* caps.rdf Cabinet* RDF preset labels renamed
* AutoWah plugin
* DSP::RMS reworked, may affect Compress plugin
* DSP::Eq reworked for double precision and denormal protection
* ./configure.py checks SSE availability
* in case of SSE math denormal flush to zero activated for all plugins
* all plugins renamed C* .. instead of CAPS: ..
* Eq modified to play nice with ardour
* Eq2x2
* introduced the Plugin base class, collecting common traits (normal etc)
* getport() -- read access to control ports which is clamped to port bounds
and maps inf and nan to 0 as well
* all LADSPA_HINT_SAMPLE_RATE ports changed to *_LOGARITHMIC because
of broken implementations (no surprise given the vagueness of ladspa.h
regarding this matter) -- this means changed default parameters of the
affected ports, too
* VCO* "latency" output ports removed
* actual activate() call is deferred to first run() after activate()
in order to prevent inadvertent parameter smoothing sweeps during the first
block of audio after activation, this should fix all problems with ardour
(except those caused by denormals or invalid audio input)
* caps.rdf installed by 'make install'
* fixed a bug in tools/make-ps.py that caused the spectrum plots to
be inaccurate for multi-channel plugins
0.3.0
* TwelveAX7_3 changed to clip slightly early in the upper lobe
* Scape plugin added
* plugin names rewritten, prefixed with "CAPS:"
* new ChorusII, StereoChorusII plugins
* Chorus, StereoChorus relabeled, appended 'I' suffix
* new PhaserII plugin (great stuff if I may say so)
* Phaser relabeled, appended 'I' suffix
* new AmpV plugin, based on AmpIII, emulates compression and distortion
modulation through power supply shortcomings, plus lots of fine-tuning
and an additional biquad. We're getting there!
* all Preamp and Amp models fitted with a new 12AX7 model, linear
interpolation of a sample table obtained from spice simulation
0.2.4
* feedback default reverted to 0 for the Chorus units
* fixed Cabinet to switch to correct gain at 'model' control change
* fixed 'model' control in Cabinet to work with a broader range of hosts
* Cabinet name changed to CabinetI
* CabinetII plugin: Cabinet with 32nd order IIR filters, more fidelity
to the original frequency responses, supplied coefficients for 4 of the
most used sample rates
* applied the gcc-4 enabling patch
* SweepVF renamed to SweepVFI
* new SweepVFII plugin, variant of SweepVFI with Q modulated by a
second Lorenz fractal
* dsp/exp2 dumped in favour of libm's exp2(3)
0.2.3
* StereoChorus denormal protection made functional
(Thanks again to S. Savolainen)
* Phaser denormal protected
0.2.2
* Build was _not_ fixed for g++-4.0.
* AmpIV gain control restored to operate as expected
* Chorus/StereoChorus denormal protection (thanks to S. Savolainen)
* a few cosmetic changes elsewhere
0.2.1
* Build fixed for g++-4.0, PPC and AMD64
(Thanks to Niklas Werner, Andreas Jochens and Mario Lang)
* Reverb.* cosmetics
* AmpIV tone controls moved to after initial tube transfer
0.2.0
* denormal protection for Preamp*, Amp*
* Capitalized plugin Names
* PDF now lists audio in- and outputs as well as control inputs, only
gives average CPU rating
* AmpIV: PreampIV + power amp stage
* Plate2x2: Plate with 2-in, 2-out audio routing
* Plate damping and bandwidth controls changed to map to filter fc, fixes
behaviour in hosts that handle the log hint incorrectly
0.1.13
* AmpIII activate() resets the boost filter
0.1.12
* PreampIV band controls fixed to operate as expected
0.1.11
* amps changed back to old tube model :) but new temp & gain behaviour stays
* SweepVF, AmpIII default value adjustments
0.1.10
* HRTF recursion runs in doubles
* Cabinet recursion runs in doubles for much clearer sound
* all amps fitted with a common tube voltage mapping, dsp/TwelveAX7.h
* all amps: temperature and gain controls changed slightly
* all amps declared in one common Amp.h
* Pan echo fixed to be filtered independent of sample rate
* Cabinet cosmetics and activate() from port values fix
* SweepVF fixed to activate() from the current control settings
* rid all *amp* plugins of the initial hi-pass, not needed anymore
* PreampIII and AmpIII more authentic with an rbj lo-shelve, +6 dB > 1.2 kHz
as hinted by circuit analysis
* something_random() removed, stdlib for random generation
0.1.9
* Pan plugin
* 'make depend' instead of 'make dep', uses $(CC) -MM instead of 'makedepend'
* *Chorus, AmpIII, Plate defaults changed
* *Chorus optimizations, reintroduces funny zipper noise when 'feedback' is
non-zero and 't' is changed
* experimental HRTF plugin
* Plate 'blend' goes all the way to wet output only
* dsp/White offers a get_31() method for reduced number of bitshifts needed
* *Chorus delay line tapping changed to employ cubic interpolation, sounds
better
* SweepVF modulation mix algorithm changed to clamp if over-fed, makes
for wider sweeps
0.1.8
* all oversampling plugins use Kaiser windows instead of Blackman-Harris,
for much better performance
* SweepVF modulation range slightly increased
* Cabinet filter loop cosmetics (slight speedup)
* new AmpIII Plugin: Preamp plus power amp emulation
* lowered NOISE_FLOOR (equals 'renormal' number)
0.1.7
* connect ports to lower bound on instantiate()
* Plate delay line lengths raised, sound changed
* Eq activate() fixed to initialize from the current settings
* Preamp* cutoff reverted to 0.1.3 setting, thanks to Ben Saylor for
testing
* old IIR-based Preamp cleaned from the sources
* zipper-noise in *Chorus units for t changes with feedback > 0 eliminated
* all plugin constructor code moved to init() calls
0.1.6
* SweepVF modulation mix algorithm changed to maintain proportion, not
absolute value if x + y + z > 1, for better control
* create $(DEST) directory on make install, pointed out by Daniel James
0.1.5
* fixed delay line length miscalculation in ModLattice
0.1.4
* SweepVF modulation source can be mixed now
* latency port for VCO*
* Lorenz and Roessler get x, y, z mixing knobs
* PreampIV eq bands slightly tuned and coefficients moved into common struct
* Preamp*, VCO* downsampler filter cutoff lowered
* Clip downsampler filter cutoff lowered
* nonsensical audio output bounds removed
* simplified VCO* implementation
* JVRev rewritten for code clarity (funny enough, it also got quicker)
* fixed JVRev to reset its history on activate()
* added purpose, copyright and licensing information to all (i think) files.
* HACKING file
* CHANGES file
0.1.3
* fixed all compilation problems with gcc 3.3, with the patient help
of the lad mailing list community
* dsp/Eq.h SSE assembler code had to go (gcc > 3 doesn't like multi-line
asm, and efficiency and even reliability go down if we allow gcc to
intersperse its 'optimization' code with our asm)
0.1.2
* fixed more compilation problems with gcc >= 3.0
0.1.1
* tried to (but didn't really) fix compilation problem with ladspa.h
0.1.0
* initial release

View File

@@ -101,21 +101,22 @@ void
CabinetI::activate()
{
switch_model ((int) getport(1));
gain = models[model].gain * DSP::db2lin (getport(2));
}
template <sample_func_t F>
void
CabinetI::one_cycle (int frames)
{
d_sample * s = ports[0];
sample_t * s = ports[0];
int m = (int) getport (1);
if (m != model) switch_model (m);
d_sample g = models[model].gain * DSP::db2lin (getport(2));
sample_t g = models[model].gain * DSP::db2lin (getport(2));
double gf = pow (g / gain, 1 / (double) frames);
d_sample * d = ports[3];
sample_t * d = ports[3];
for (int i = 0; i < frames; ++i)
{
@@ -227,15 +228,14 @@ template <sample_func_t F>
void
CabinetII::one_cycle (int frames)
{
d_sample * s = ports[0];
sample_t * s = ports[0];
int m = (int) getport (1);
if (m != model) switch_model (m);
d_sample g = models[model].gain * DSP::db2lin (getport(2));
sample_t g = models[model].gain * DSP::db2lin (getport(2));
double gf = pow (g / gain, 1 / (double) frames);
d_sample * d = ports[3];
sample_t * d = ports[3];
for (int i = 0; i < frames; ++i)
{

View File

@@ -57,7 +57,7 @@ class CabinetI
: public Plugin
{
public:
d_sample gain;
sample_t gain;
static Model16 models [];
int model;
@@ -95,7 +95,7 @@ class CabinetII
: public Plugin
{
public:
d_sample gain;
sample_t gain;
static Model32 models44100 [];
static Model32 models48000 [];
@@ -116,7 +116,7 @@ class CabinetII
public:
static PortInfo port_info [];
d_sample adding_gain;
sample_t adding_gain;
void init();
void activate();

View File

@@ -34,7 +34,7 @@ template <sample_func_t F>
void
ChorusI::one_cycle (int frames)
{
d_sample * s = ports[0];
sample_t * s = ports[0];
double one_over_n = 1 / (double) frames;
double ms = .001 * fs;
@@ -56,13 +56,13 @@ ChorusI::one_cycle (int frames)
double ff = getport(5);
double fb = getport(6);
d_sample * d = ports[7];
sample_t * d = ports[7];
DSP::FPTruncateMode truncate;
for (int i = 0; i < frames; ++i)
{
d_sample x = s[i];
sample_t x = s[i];
/* truncate the feedback tap to integer, better quality for less
* cycles (just a bit of zipper when changing 't', but it does sound
@@ -153,7 +153,7 @@ template <sample_func_t F>
void
StereoChorusI::one_cycle (int frames)
{
d_sample * s = ports[0];
sample_t * s = ports[0];
double one_over_n = 1 / (double) frames;
double ms = .001 * fs;
@@ -181,8 +181,8 @@ StereoChorusI::one_cycle (int frames)
double ff = getport(6);
double fb = getport(7);
d_sample * dl = ports[8];
d_sample * dr = ports[9];
sample_t * dl = ports[8];
sample_t * dr = ports[9];
/* to go sure (on i386) that the fistp instruction does the right thing
* when looking up fractional sample indices */
@@ -190,7 +190,7 @@ StereoChorusI::one_cycle (int frames)
for (int i = 0; i < frames; ++i)
{
d_sample x = s[i];
sample_t x = s[i];
/* truncate the feedback tap to integer, better quality for less
* cycles (just a bit of zipper when changing 't', but it does sound
@@ -201,8 +201,8 @@ StereoChorusI::one_cycle (int frames)
delay.put (x + normal);
d_sample l = blend * x + ff * delay.get_cubic (t + w * left.lfo.get());
d_sample r = blend * x + ff * delay.get_cubic (t + w * right.lfo.get());
sample_t l = blend * x + ff * delay.get_cubic (t + w * left.lfo.get());
sample_t r = blend * x + ff * delay.get_cubic (t + w * right.lfo.get());
F (dl, i, l, adding_gain);
F (dr, i, r, adding_gain);
@@ -281,7 +281,7 @@ template <sample_func_t F>
void
ChorusII::one_cycle (int frames)
{
d_sample * s = ports[0];
sample_t * s = ports[0];
double one_over_n = 1 / (double) frames;
double ms = .001 * fs;
@@ -303,13 +303,13 @@ ChorusII::one_cycle (int frames)
double ff = getport(5);
double fb = getport(6);
d_sample * d = ports[7];
sample_t * d = ports[7];
DSP::FPTruncateMode truncate;
for (int i = 0; i < frames; ++i)
{
d_sample x = s[i];
sample_t x = s[i];
x -= fb * delay.get_cubic (t);
@@ -389,7 +389,7 @@ template <sample_func_t F>
void
StereoChorusII::one_cycle (int frames)
{
d_sample * s = ports[0];
sample_t * s = ports[0];
double one_over_n = 1 / (double) frames;
double ms = .001 * fs;
@@ -410,8 +410,8 @@ StereoChorusII::one_cycle (int frames)
double ff = getport(5);
double fb = getport(6);
d_sample * dl = ports[7];
d_sample * dr = ports[8];
sample_t * dl = ports[7];
sample_t * dr = ports[8];
/* to go sure (on i386) that the fistp instruction does the right thing
* when looking up fractional sample indices */
@@ -419,7 +419,7 @@ StereoChorusII::one_cycle (int frames)
for (int i = 0; i < frames; ++i)
{
d_sample x = s[i];
sample_t x = s[i];
/* truncate the feedback tap to integer, better quality for less
* cycles (just a bit of zipper when changing 't', but it does sound
@@ -432,9 +432,9 @@ StereoChorusII::one_cycle (int frames)
double m;
m = left.lfo_lp.process (left.fractal.get());
d_sample l = blend * x + ff * delay.get_cubic (t + w * m);
sample_t l = blend * x + ff * delay.get_cubic (t + w * m);
m = right.lfo_lp.process (right.fractal.get());
d_sample r = blend * x + ff * delay.get_cubic (t + w * m);
sample_t r = blend * x + ff * delay.get_cubic (t + w * m);
F (dl, i, l, adding_gain);
F (dr, i, r, adding_gain);

View File

@@ -41,7 +41,7 @@ class ChorusStub
: public Plugin
{
public:
d_sample time, width, rate;
sample_t time, width, rate;
};
class ChorusI
@@ -92,8 +92,8 @@ class StereoChorusI
: public ChorusStub
{
public:
d_sample rate;
d_sample phase;
sample_t rate;
sample_t phase;
DSP::Delay delay;
@@ -161,14 +161,14 @@ class FracTap
f2.init (.001, frandom());
}
void set_rate (d_sample r)
void set_rate (sample_t r)
{
f1.set_rate (r * FRACTAL_RATE);
f2.set_rate (3.3 * r * FRACTAL_RATE);
}
/* t = time, w = width, should inline nicely */
d_sample get (DSP::Delay & d, double t, double w)
sample_t get (DSP::Delay & d, double t, double w)
{
double m = lp.process (f1.get() + .3 * f2.get());
return d.get_cubic (t + w * m);
@@ -190,7 +190,7 @@ class ChorusII
template <sample_func_t>
void one_cycle (int frames);
void set_rate (d_sample r)
void set_rate (sample_t r)
{
rate = r;
for (int i = 0; i < Taps; ++i)
@@ -237,8 +237,8 @@ class StereoChorusII
: public ChorusStub
{
public:
d_sample rate;
d_sample phase;
sample_t rate;
sample_t phase;
DSP::Delay delay;
@@ -251,7 +251,7 @@ class StereoChorusII
template <sample_func_t>
void one_cycle (int frames);
void set_rate (d_sample r)
void set_rate (sample_t r)
{
rate = r;
left.fractal.set_rate (rate * FRACTAL_RATE);
@@ -262,7 +262,7 @@ class StereoChorusII
public:
static PortInfo port_info [];
d_sample adding_gain;
sample_t adding_gain;
void init()
{

View File

@@ -46,10 +46,10 @@ void
ClickStub::one_cycle (int frames)
{
bpm = getport(0);
d_sample gain = getport(1) * *ports[1];
sample_t gain = getport(1) * *ports[1];
lp.set (1 - *ports[2]);
d_sample * d = ports[3];
sample_t * d = ports[3];
while (frames)
{
@@ -67,7 +67,7 @@ ClickStub::one_cycle (int frames)
for (int i = 0; i < n; ++i)
{
d_sample x = gain * wave [played + i] + normal;
sample_t x = gain * wave [played + i] + normal;
F (d, i, lp.process (x), adding_gain);
normal = -normal;
}

View File

@@ -35,7 +35,7 @@ class ClickStub
: public Plugin
{
public:
d_sample bpm;
sample_t bpm;
float * wave;
int N; /* number of samples in wave */

View File

@@ -62,8 +62,8 @@ Clip::init()
up.c[i] *= s;
}
inline d_sample
Clip::clip (d_sample a)
inline sample_t
Clip::clip (sample_t a)
{
if (a < threshold[0])
return threshold[0];
@@ -76,7 +76,7 @@ template <sample_func_t F>
void
Clip::one_cycle (int frames)
{
d_sample * s = ports[0];
sample_t * s = ports[0];
double g = getport (1);
double gf;
@@ -85,16 +85,16 @@ Clip::one_cycle (int frames)
else
{
gain_db = g;
d_sample g = DSP::db2lin (gain_db);
sample_t g = DSP::db2lin (gain_db);
gf = pow (g / gain, 1 / (double) frames);
}
d_sample * d = ports[2];
sample_t * d = ports[2];
*ports[3] = OVERSAMPLE;
for (int i = 0; i < frames; ++i)
{
register d_sample a = gain * s[i];
register sample_t a = gain * s[i];
a = down.process (clip (up.upsample (a)));

View File

@@ -37,9 +37,9 @@ class Clip
: public Plugin
{
public:
d_sample gain, gain_db;
sample_t gain, gain_db;
d_sample threshold[2];
sample_t threshold[2];
enum {
OVERSAMPLE = 8,
@@ -53,7 +53,7 @@ class Clip
template <sample_func_t F>
void one_cycle (int frames);
inline d_sample clip (d_sample x);
inline sample_t clip (sample_t x);
public:
static PortInfo port_info[];

View File

@@ -35,10 +35,10 @@ template <sample_func_t F>
void
Compress::one_cycle (int frames)
{
d_sample * s = ports[0];
sample_t * s = ports[0];
d_sample range = DSP::db2lin (getport(1));
d_sample ratio = (*ports[2] - 1) / getport(2);
sample_t range = DSP::db2lin (getport(1));
sample_t ratio = (*ports[2] - 1) / getport(2);
/* sc1 has lookup tables here, and they're only 40 % used (400 ms/1 s).
* thus, sc1's attack/release controls are a bit coarse due to truncation
@@ -54,16 +54,16 @@ Compress::one_cycle (int frames)
double ga = exp (-1 / (fs * getport(3)));
double gr = exp (-1 / (fs * getport(4)));
d_sample threshold = getport(5);
d_sample knee = getport(6);
sample_t threshold = getport(5);
sample_t knee = getport(6);
d_sample * d = ports[7];
sample_t * d = ports[7];
d_sample knee0 = DSP::db2lin (threshold - knee);
d_sample knee1 = DSP::db2lin (threshold + knee);
sample_t knee0 = DSP::db2lin (threshold - knee);
sample_t knee1 = DSP::db2lin (threshold + knee);
d_sample ef_a = ga * .25;
d_sample ef_ai = 1 - ef_a;
sample_t ef_a = ga * .25;
sample_t ef_ai = 1 - ef_a;
for (int i = 0; i < frames; ++i)
{

View File

@@ -36,10 +36,10 @@ class Compress
{
public:
double fs;
d_sample f;
sample_t f;
DSP::RMS rms;
d_sample sum, amp, env, gain, gain_t;
sample_t sum, amp, env, gain, gain_t;
int count;

View File

@@ -1,12 +1,12 @@
/*
Descriptor.h
Copyright 2004-9 Tim Goetze <tim@quitte.de>
Copyright 2004-10 Tim Goetze <tim@quitte.de>
http://quitte.de/dsp/
Creating a LADSPA_Descriptor for a CAPS plugin via a C++ template,
saves us a virtual function call compared to the usual method used
saving a virtual function call compared to the usual method used
for C++ plugins in a C context.
Descriptor<P> expects P to declare some common methods, like init(),
@@ -130,7 +130,7 @@ class Descriptor
LADSPA_PortRangeHint * ranges = ((Descriptor *) d)->ranges;
plugin->ranges = ranges;
plugin->ports = new d_sample * [n];
plugin->ports = new sample_t * [n];
/* connect to lower bound as a safety measure */
for (int i = 0; i < n; ++i)
@@ -159,7 +159,7 @@ class Descriptor
* plugin's activate() method for the first run() after
* the host called in here.
*
* It's simplest way to prevent a parameter smoothing sweep
* It's the simplest way to prevent a parameter smoothing sweep
* in the first audio block after activation.
plugin->activate();
*/

View File

@@ -70,7 +70,7 @@ template <sample_func_t F>
void
Eq::one_cycle (int frames)
{
d_sample * s = ports[0];
sample_t * s = ports[0];
/* evaluate band gain changes and compute recursion factor to prevent
* zipper noise */
@@ -78,7 +78,7 @@ Eq::one_cycle (int frames)
for (int i = 0; i < 10; ++i)
{
d_sample g = getport (1 + i);
sample_t g = getport (1 + i);
if (g == gain[i])
{
/* no gain factoring */
@@ -91,11 +91,11 @@ Eq::one_cycle (int frames)
eq.gf[i] = pow (want / eq.gain[i], one_over_n);
}
d_sample * d = ports[11];
sample_t * d = ports[11];
for (int i = 0; i < frames; ++i)
{
d_sample x = s[i];
sample_t x = s[i];
x = eq.process (x);
F (d, i, x, adding_gain);
}
@@ -230,13 +230,13 @@ Eq2x2::one_cycle (int frames)
for (int c = 0; c < 2; ++c)
{
d_sample
sample_t
* s = ports[c],
* d = ports[12 + c];
for (int i = 0; i < frames; ++i)
{
d_sample x = s[i];
sample_t x = s[i];
x = eq[c].process (x);
F (d, i, x, adding_gain);
}

View File

@@ -37,7 +37,7 @@ class Eq
: public Plugin
{
public:
d_sample gain[10];
sample_t gain[10];
DSP::Eq<10> eq;
int block;
@@ -67,7 +67,7 @@ class Eq2x2
: public Plugin
{
public:
d_sample gain[10];
sample_t gain[10];
DSP::Eq<10> eq[2];
template <sample_func_t F>

View File

@@ -71,13 +71,13 @@ template <sample_func_t F>
void
HRTF::one_cycle (int frames)
{
d_sample * s = ports[0];
sample_t * s = ports[0];
int p = (int) getport(1);
if (p != pan) set_pan (p);
d_sample * dl = ports[2];
d_sample * dr = ports[3];
sample_t * dl = ports[2];
sample_t * dr = ports[3];
double l, r;

View File

@@ -1,7 +1,7 @@
/*
Lorenz.cc
Copyright 2002-7 Tim Goetze <tim@quitte.de>
Copyright 2002-11 Tim Goetze <tim@quitte.de>
http://quitte.de/dsp/
@@ -48,9 +48,9 @@ Lorenz::one_cycle (int frames)
double g = (gain == *ports[4]) ?
1 : pow (getport(4) / gain, 1. / (double) frames);
d_sample * d = ports[5];
sample_t * d = ports[5];
d_sample x, sx = getport(1), sy = getport(2), sz = getport(3);
sample_t x, sx = getport(1), sy = getport(2), sz = getport(3);
for (int i = 0; i < frames; ++i)
{
@@ -73,7 +73,7 @@ Lorenz::port_info [] =
{
"h",
INPUT | CONTROL,
{BOUNDED, 0, 1}
{BOUNDED | DEFAULT_LOW, 0, 1}
}, {
"x",
INPUT | CONTROL,

View File

@@ -1,7 +1,7 @@
/*
Lorenz.h
Copyright 2004-5 Tim Goetze <tim@quitte.de>
Copyright 2004-11 Tim Goetze <tim@quitte.de>
http://quitte.de/dsp/
@@ -34,7 +34,7 @@ class Lorenz
: public Plugin
{
public:
d_sample h, gain;
sample_t h, gain;
DSP::Lorenz lorenz;
@@ -45,7 +45,8 @@ class Lorenz
static PortInfo port_info [];
void init();
void activate() {}
void activate()
{ gain = getport(4); }
void run (int n)
{

View File

@@ -1,11 +1,12 @@
/*
Pan.cc
Copyright 2002-7 Tim Goetze <tim@quitte.de>
Copyright 2002-11 Tim Goetze <tim@quitte.de>
http://quitte.de/dsp/
panorama with width control
panorama with width control,
stereo image width reduction
*/
/*
@@ -41,11 +42,11 @@ Pan::activate()
{
delay.reset();
tap.reset (400 / fs);
set_pan (*ports[1]);
set_pan (getport (1));
}
inline void
Pan::set_pan (d_sample p)
Pan::set_pan (sample_t p)
{
pan = p;
@@ -59,13 +60,13 @@ template <sample_func_t F>
void
Pan::one_cycle (int frames)
{
d_sample * s = ports[0];
sample_t * s = ports[0];
if (pan != *ports[1])
set_pan (getport(1));
d_sample g = getport(2);
d_sample
sample_t g = getport(2);
sample_t
width_l = g * gain_r,
width_r = g * gain_l;
@@ -73,10 +74,10 @@ Pan::one_cycle (int frames)
bool mono = getport(4);
d_sample * dl = ports[5];
d_sample * dr = ports[6];
sample_t * dl = ports[5];
sample_t * dr = ports[6];
d_sample x, xt;
sample_t x, xt;
if (mono) for (int i = 0; i < frames; ++i)
{
@@ -93,7 +94,7 @@ Pan::one_cycle (int frames)
normal = -normal;
}
else for (int i = 0; i < frames; ++i)
else /* stereo */ for (int i = 0; i < frames; ++i)
{
x = s[i];
@@ -159,3 +160,92 @@ Descriptor<Pan>::setup()
autogen();
}
/* //////////////////////////////////////////////////////////////////////// */
void
Narrower::init()
{
}
void
Narrower::activate()
{
}
template <sample_func_t F>
void
Narrower::one_cycle (int frames)
{
sample_t * sl = ports[0];
sample_t * sr = ports[1];
if (strength != *ports[2])
strength = *ports[2];
sample_t * dl = ports[3];
sample_t * dr = ports[4];
double xl, xr, m;
double dry = 1 - strength, wet = strength;
for (int i = 0; i < frames; ++i)
{
xl = sl[i];
xr = sr[i];
m = wet * (xl + xr) * .5;
xl *= dry;
xr *= dry;
xl += m;
xr += m;
F (dl, i, xl, adding_gain);
F (dr, i, xr, adding_gain);
}
}
/* //////////////////////////////////////////////////////////////////////// */
PortInfo
Narrower::port_info [] =
{
{
"in:l",
INPUT | AUDIO,
{0}
}, {
"in:r",
INPUT | AUDIO,
{0}
}, {
"strength",
INPUT | CONTROL,
{BOUNDED | DEFAULT_LOW, 0, 1}
}, {
"out:l",
OUTPUT | AUDIO,
{0}
}, {
"out:r",
OUTPUT | AUDIO,
{0}
}
};
template <> void
Descriptor<Narrower>::setup()
{
UniqueID = 2595;
Label = "Narrower";
Properties = HARD_RT;
Name = CAPS "Narrower - Stereo image width reduction";
Maker = "Tim Goetze <tim@quitte.de>";
Copyright = "GPL, 2011";
/* fill port info and vtable */
autogen();
}

View File

@@ -1,11 +1,12 @@
/*
Pan.h
Copyright 2004-5 Tim Goetze <tim@quitte.de>
Copyright 2004-11 Tim Goetze <tim@quitte.de>
http://quitte.de/dsp/
panorama with width control
panorama with width control,
stereo image width reduction
*/
/*
@@ -37,7 +38,7 @@ class PanTap
int t;
DSP::OnePoleLP damper;
d_sample get (DSP::Delay & delay)
sample_t get (DSP::Delay & delay)
{
return damper.process (delay[t]);
}
@@ -53,9 +54,9 @@ class Pan
: public Plugin
{
public:
d_sample pan;
sample_t pan;
d_sample gain_l, gain_r;
sample_t gain_l, gain_r;
DSP::Delay delay;
PanTap tap;
@@ -63,7 +64,7 @@ class Pan
template <sample_func_t F>
void one_cycle (int frames);
inline void set_pan (d_sample);
inline void set_pan (sample_t);
public:
static PortInfo port_info [];
@@ -82,4 +83,32 @@ class Pan
}
};
/* stereo width reduction */
class Narrower
: public Plugin
{
public:
sample_t strength;
template <sample_func_t F>
void one_cycle (int frames);
public:
static PortInfo port_info [];
void init();
void activate();
void run (int n)
{
one_cycle<store_func> (n);
}
void run_adding (int n)
{
one_cycle<adding_func> (n);
}
};
#endif /* _PAN_H_ */

View File

@@ -37,7 +37,7 @@ template <sample_func_t F>
void
PhaserI::one_cycle (int frames)
{
d_sample * s = ports[0];
sample_t * s = ports[0];
if (rate != *ports[1])
{
@@ -49,7 +49,7 @@ PhaserI::one_cycle (int frames)
double spread = 1 + getport(3);
double fb = getport(4);
d_sample * dst = ports[5];
sample_t * dst = ports[5];
while (frames)
{
@@ -67,8 +67,8 @@ PhaserI::one_cycle (int frames)
for (int i = 0; i < n; ++i)
{
d_sample x = s[i];
d_sample y = x + y0 * fb + normal;
sample_t x = s[i];
sample_t y = x + y0 * fb + normal;
for (int j = 5; j >= 0; --j)
y = ap[j].process (y);
@@ -138,7 +138,7 @@ template <sample_func_t F>
void
PhaserII::one_cycle (int frames)
{
d_sample * s = ports[0];
sample_t * s = ports[0];
lorenz.set_rate (getport(1) * .08);
@@ -146,7 +146,7 @@ PhaserII::one_cycle (int frames)
double spread = 1 + getport(3);
double fb = getport(4);
d_sample * dst = ports[5];
sample_t * dst = ports[5];
while (frames)
{
@@ -164,8 +164,8 @@ PhaserII::one_cycle (int frames)
for (int i = 0; i < n; ++i)
{
d_sample x = s[i];
d_sample y = x + y0 * fb + normal;
sample_t x = s[i];
sample_t y = x + y0 * fb + normal;
for (int j = 5; j >= 0; --j)
y = ap[j].process (y);

View File

@@ -36,7 +36,7 @@
class PhaserAP
{
public:
d_sample a, m;
sample_t a, m;
PhaserAP()
{
@@ -48,9 +48,9 @@ class PhaserAP
a = (1 - delay) / (1 + delay);
}
d_sample process (d_sample x)
sample_t process (sample_t x)
{
register d_sample y = -a * x + m;
register sample_t y = -a * x + m;
m = a * y + x;
return y;
@@ -64,8 +64,8 @@ class PhaserI
PhaserAP ap[6];
DSP::Sine lfo;
d_sample rate;
d_sample y0;
sample_t rate;
sample_t y0;
struct {
double bottom, range;
@@ -117,8 +117,8 @@ class PhaserII
PhaserAP ap[6];
DSP::Lorenz lorenz;
d_sample rate;
d_sample y0;
sample_t rate;
sample_t y0;
struct {
double bottom, range;

View File

@@ -42,10 +42,10 @@ template <sample_func_t F, int OVERSAMPLE>
void
PreampIII::one_cycle (int frames)
{
d_sample * s = ports[0];
d_sample gain = getport(1);
d_sample temp = getport(2) * tube.scale;
d_sample * d = ports[3];
sample_t * s = ports[0];
sample_t gain = getport(1);
sample_t temp = getport(2) * tube.scale;
sample_t * d = ports[3];
*ports[4] = OVERSAMPLE;
double g = current.g;
@@ -62,7 +62,7 @@ PreampIII::one_cycle (int frames)
for (int i = 0; i < frames; ++i)
{
register d_sample a = s[i] + normal;
register sample_t a = s[i] + normal;
a = g * tube.transfer (a * temp);
a = filter.process (a);
@@ -145,13 +145,13 @@ PreampIV::one_cycle (int frames)
{
double one_over_n = frames > 0 ? 1. / frames : 1;
d_sample * s = ports[0];
d_sample gain = getport(1);
d_sample temp = getport(2) * tube.scale;
sample_t * s = ports[0];
sample_t gain = getport(1);
sample_t temp = getport(2) * tube.scale;
tone.start_cycle (ports + 3, one_over_n);
d_sample * d = ports[7];
sample_t * d = ports[7];
*ports[8] = OVERSAMPLE;
double g = current.g;
@@ -166,7 +166,7 @@ PreampIV::one_cycle (int frames)
for (int i = 0; i < frames; ++i)
{
register d_sample a = tone.process (s[i] + normal);
register sample_t a = tone.process (s[i] + normal);
a = g * tube.transfer (a * temp);

View File

@@ -89,7 +89,7 @@ JVRev::init()
}
void
JVRev::set_t60 (d_sample t)
JVRev::set_t60 (sample_t t)
{
t60 = t;
@@ -118,19 +118,19 @@ template <sample_func_t F>
void
JVRev::one_cycle (int frames)
{
d_sample * s = ports[0];
sample_t * s = ports[0];
if (t60 != *ports[1])
set_t60 (getport(1));
double wet = getport(2), dry = 1 - wet;
d_sample * dl = ports[3];
d_sample * dr = ports[4];
sample_t * dl = ports[3];
sample_t * dr = ports[4];
for (int i = 0; i < frames; ++i)
{
d_sample x = s[i], a = x + normal;
sample_t x = s[i], a = x + normal;
x *= dry;
@@ -140,7 +140,7 @@ JVRev::one_cycle (int frames)
a = allpass[2].process (a, -apc);
/* tank */
d_sample t = 0;
sample_t t = 0;
a -= normal;
for (int j = 0; j < 4; ++j)
@@ -254,7 +254,7 @@ PlateStub::init()
}
inline void
PlateStub::process (d_sample x, d_sample decay, d_sample * _xl, d_sample * _xr)
PlateStub::process (sample_t x, sample_t decay, sample_t * _xl, sample_t * _xr)
{
x = input.bandwidth.process (x);
@@ -267,8 +267,8 @@ PlateStub::process (d_sample x, d_sample decay, d_sample * _xl, d_sample * _xr)
x = input.lattice[3].process (x, indiff2);
/* summation point */
register d_sample xl = x + decay * tank.delay[3].get();
register d_sample xr = x + decay * tank.delay[1].get();
register sample_t xl = x + decay * tank.delay[3].get();
register sample_t xr = x + decay * tank.delay[1].get();
/* lh */
xl = tank.mlattice[0].process (xl, dediff1);
@@ -311,20 +311,20 @@ template <sample_func_t F>
void
Plate::one_cycle (int frames)
{
d_sample * s = ports[0];
sample_t * s = ports[0];
input.bandwidth.set (exp (-M_PI * (1. - getport(1))));
d_sample decay = getport(2);
sample_t decay = getport(2);
double damp = exp (-M_PI * getport(3));
tank.damping[0].set (damp);
tank.damping[1].set (damp);
d_sample blend = getport(4), dry = 1 - blend;
sample_t blend = getport(4), dry = 1 - blend;
d_sample * dl = ports[5];
d_sample * dr = ports[6];
sample_t * dl = ports[5];
sample_t * dr = ports[6];
/* the modulated lattices interpolate, which needs truncated float */
DSP::FPTruncateMode _truncate;
@@ -332,9 +332,9 @@ Plate::one_cycle (int frames)
for (int i = 0; i < frames; ++i)
{
normal = -normal;
d_sample x = s[i] + normal;
sample_t x = s[i] + normal;
d_sample xl, xr;
sample_t xl, xr;
PlateStub::process (x, decay, &xl, &xr);
@@ -402,21 +402,21 @@ template <sample_func_t F>
void
Plate2x2::one_cycle (int frames)
{
d_sample * sl = ports[0];
d_sample * sr = ports[1];
sample_t * sl = ports[0];
sample_t * sr = ports[1];
input.bandwidth.set (exp (-M_PI * (1. - getport(2))));
d_sample decay = getport(3);
sample_t decay = getport(3);
double damp = exp (-M_PI * getport(4));
tank.damping[0].set (damp);
tank.damping[1].set (damp);
d_sample blend = getport(5), dry = 1 - blend;
sample_t blend = getport(5), dry = 1 - blend;
d_sample * dl = ports[6];
d_sample * dr = ports[7];
sample_t * dl = ports[6];
sample_t * dr = ports[7];
/* the modulated lattices interpolate, which needs truncated float */
DSP::FPTruncateMode _truncate;
@@ -424,9 +424,9 @@ Plate2x2::one_cycle (int frames)
for (int i = 0; i < frames; ++i)
{
normal = -normal;
d_sample x = (sl[i] + sr[i] + normal) * .5;
sample_t x = (sl[i] + sr[i] + normal) * .5;
d_sample xl, xr;
sample_t xl, xr;
PlateStub::process (x, decay, &xl, &xr);
xl = blend * xl + dry * sl[i];

View File

@@ -59,10 +59,10 @@ class Lattice
: public DSP::Delay
{
public:
inline d_sample
process (d_sample x, double d)
inline sample_t
process (sample_t x, double d)
{
d_sample y = get();
sample_t y = get();
x -= d * y;
put (x);
return d * x + y;
@@ -76,8 +76,8 @@ class JVComb
public:
float c;
inline d_sample
process (d_sample x)
inline sample_t
process (sample_t x)
{
x += c * get();
put (x);
@@ -90,7 +90,7 @@ class JVRev
{
public:
static int default_length[9];
d_sample t60;
sample_t t60;
Lattice allpass [3];
JVComb comb[4];
@@ -104,7 +104,7 @@ class JVRev
int length [9];
void set_t60 (d_sample t);
void set_t60 (sample_t t);
public:
static PortInfo port_info [];
@@ -147,11 +147,11 @@ class ModLattice
tap.reset();
}
inline d_sample
process (d_sample x, double d)
inline sample_t
process (sample_t x, double d)
{
/* TODO: try all-pass interpolation */
d_sample y = delay.get_at (n0 + width * lfo.get());
sample_t y = delay.get_at (n0 + width * lfo.get());
x += d * y;
delay.put (x);
return y - d * x; /* note sign */
@@ -162,9 +162,9 @@ class PlateStub
: public Plugin
{
public:
d_sample f_lfo;
sample_t f_lfo;
d_sample indiff1, indiff2, dediff1, dediff2;
sample_t indiff1, indiff2, dediff1, dediff2;
struct {
DSP::OnePoleLP bandwidth;
@@ -202,8 +202,8 @@ class PlateStub
tank.mlattice[1].lfo.set_f (1.2, fs, .5 * M_PI);
}
inline void process (d_sample x, d_sample decay,
d_sample * xl, d_sample * xr);
inline void process (sample_t x, sample_t decay,
sample_t * xl, sample_t * xr);
};
/* /////////////////////////////////////////////////////////////////////// */

View File

@@ -1,7 +1,7 @@
/*
Roessler.cc
Copyright 2002-7 Tim Goetze <tim@quitte.de>
Copyright 2002-11 Tim Goetze <tim@quitte.de>
http://quitte.de/dsp/
@@ -48,9 +48,9 @@ Roessler::one_cycle (int frames)
double g = (gain == getport(4)) ?
1 : pow (getport(4) / gain, 1. / (double) frames);
d_sample * d = ports[5];
sample_t * d = ports[5];
d_sample x,
sample_t x,
sx = .043 * getport(1),
sy = .051 * getport(2),
sz = .018 * getport(3);
@@ -79,7 +79,7 @@ Roessler::port_info [] =
{
"h",
INPUT | CONTROL,
{BOUNDED, 0, 1}
{BOUNDED | DEFAULT_LOW, 0, 1}
}, {
"x",
INPUT | CONTROL,

View File

@@ -1,7 +1,7 @@
/*
Roessler.h
Copyright 2004-5 Tim Goetze <tim@quitte.de>
Copyright 2004-11 Tim Goetze <tim@quitte.de>
http://quitte.de/dsp/
@@ -34,7 +34,7 @@ class Roessler
: public Plugin
{
public:
d_sample h, gain;
sample_t h, gain;
DSP::Roessler roessler;
@@ -44,10 +44,11 @@ class Roessler
public:
static PortInfo port_info [];
d_sample adding_gain;
sample_t adding_gain;
void init();
void activate() {}
void activate()
{ gain = getport(4); }
void run (int n)
{

View File

@@ -61,7 +61,7 @@ template <sample_func_t F>
void
Scape::one_cycle (int frames)
{
d_sample * s = ports[0];
sample_t * s = ports[0];
// double one_over_n = 1 / (double) frames;
@@ -76,8 +76,8 @@ Scape::one_cycle (int frames)
dry = dry * dry;
double blend = getport(5);
d_sample * dl = ports[6];
d_sample * dr = ports[7];
sample_t * dl = ports[6];
sample_t * dr = ports[7];
DSP::FPTruncateMode truncate;
@@ -116,10 +116,10 @@ Scape::one_cycle (int frames)
/* sample loop */
for (int i = 0; i < n; ++i)
{
d_sample x = s[i] + normal;
sample_t x = s[i] + normal;
d_sample x1 = delay.get_at (t1);
d_sample x2 = delay.get_at (t2);
sample_t x1 = delay.get_at (t1);
sample_t x2 = delay.get_at (t2);
delay.put (x + fb * x1 + normal);
x = dry * x + .2 * svf[0].process (x) + .6 * svf[3].process(x);
@@ -130,7 +130,7 @@ Scape::one_cycle (int frames)
x1 = hipass[1].process (x1);
x2 = hipass[2].process (x2);
d_sample x1l, x1r, x2l, x2r;
sample_t x1l, x1r, x2l, x2r;
x1l = fabs (lfo[0].get());
x1r = 1 - x1l;
x2r = fabs (lfo[1].get());

View File

@@ -41,7 +41,7 @@ class Scape
: public Plugin
{
public:
d_sample time, fb;
sample_t time, fb;
double period;
DSP::Lorenz lfo[2];

View File

@@ -47,7 +47,7 @@ Sin::one_cycle (int frames)
double g = (gain == *ports[1]) ?
1 : pow (getport(1) / gain, 1. / (double) frames);
d_sample * d = ports[2];
sample_t * d = ports[2];
for (int i = 0; i < frames; ++i)
{

View File

@@ -1,7 +1,7 @@
/*
Sin.h
Copyright 2004-5 Tim Goetze <tim@quitte.de>
Copyright 2004-11 Tim Goetze <tim@quitte.de>
http://quitte.de/dsp/
@@ -34,7 +34,7 @@ class Sin
: public Plugin
{
public:
d_sample f, gain;
sample_t f, gain;
DSP::Sine sin;
@@ -45,7 +45,8 @@ class Sin
static PortInfo port_info [];
void init();
void activate() {}
void activate()
{ gain = getport(1); }
void run (int n)
{

View File

@@ -54,7 +54,7 @@ template <sample_func_t F>
void
SweepVFI::one_cycle (int frames)
{
d_sample * s = ports[0];
sample_t * s = ports[0];
int blocks = frames / BLOCK_SIZE;
if (frames & (BLOCK_SIZE - 1))
@@ -69,7 +69,7 @@ SweepVFI::one_cycle (int frames)
lorenz.set_rate (getport(7));
d_sample * d = ports[8];
sample_t * d = ports[8];
while (frames)
{
@@ -183,7 +183,7 @@ template <sample_func_t F>
void
SweepVFII::one_cycle (int frames)
{
d_sample * s = ports[0];
sample_t * s = ports[0];
int blocks = frames / BLOCK_SIZE;
if (frames & (BLOCK_SIZE - 1))
@@ -199,7 +199,7 @@ SweepVFII::one_cycle (int frames)
lorenz1.set_rate (getport(7));
lorenz2.set_rate (getport(11));
d_sample * d = ports[12];
sample_t * d = ports[12];
while (frames)
{
@@ -354,7 +354,7 @@ template <sample_func_t F>
void
AutoWah::one_cycle (int frames)
{
d_sample * s = ports[0];
sample_t * s = ports[0];
int blocks = frames / BLOCK_SIZE;
if (frames & (BLOCK_SIZE - 1))
@@ -367,7 +367,7 @@ AutoWah::one_cycle (int frames)
double scale = getport(3);
d_sample * d = ports[4];
sample_t * d = ports[4];
while (frames)
{
@@ -389,7 +389,7 @@ AutoWah::one_cycle (int frames)
for (int i = 0; i < n; ++i)
{
d_sample x = s[i] + normal;
sample_t x = s[i] + normal;
/* A stacked SVF in bandpass mode is rather quiet, which is
* compensated here */
F (d, i, 2 * svf.process (x), adding_gain);

View File

@@ -49,7 +49,7 @@ class SweepVFI
double fs;
/* svf parameters */
d_sample f, Q;
sample_t f, Q;
/* needs to be a power of two */
enum {
@@ -84,7 +84,7 @@ class SweepVFII
{
public:
/* svf parameters */
d_sample f, Q;
sample_t f, Q;
/* needs to be a power of two */
enum {
@@ -124,7 +124,7 @@ class AutoWah
double fs;
/* svf parameters */
d_sample f, Q;
sample_t f, Q;
/* needs to be a power of two */
enum {

View File

@@ -62,7 +62,7 @@ ToneControls::set_band_gain (int i, float g)
}
void
ToneControls::activate (d_sample ** ports)
ToneControls::activate (sample_t ** ports)
{
for (int i = 0; i < 4; ++i)
set_band_gain (i, *ports[i]);

View File

@@ -76,13 +76,13 @@ template <sample_func_t F>
void
ToneStack::one_cycle (int frames)
{
d_sample * s = ports[0];
sample_t * s = ports[0];
tonestack.start_cycle (ports + 1);
d_sample * d = ports[5];
sample_t * d = ports[5];
for (int i = 0; i < frames; ++i)
{
register d_sample a = s[i];
register sample_t a = s[i];
a = tonestack.process (a + normal);
F (d, i, a, adding_gain);
}
@@ -140,13 +140,13 @@ template <sample_func_t F>
void
ToneStackLT::one_cycle (int frames)
{
d_sample * s = ports[0];
sample_t * s = ports[0];
tonestack.updatecoefs (ports + 1);
d_sample * d = ports[4];
sample_t * d = ports[4];
for (int i = 0; i < frames; ++i)
{
register d_sample a = s[i];
register sample_t a = s[i];
a = tonestack.process (a + normal);
F (d, i, a, adding_gain);
}

View File

@@ -8,6 +8,8 @@
an oversampled triangle/saw/square oscillator, and a combination of two
such oscillators with hard sync.
TODO: optimize for phase clamping like this:
phi -= floor (phi);
*/
/*
This program is free software; you can redistribute it and/or
@@ -63,7 +65,7 @@ VCOs::one_cycle (int frames)
double g = (gain == *ports[3]) ?
1 : pow (getport(3) / gain, 1. / (double) frames);
d_sample * d = ports[4];
sample_t * d = ports[4];
for (int i = 0; i < frames; ++i)
{
@@ -160,7 +162,7 @@ VCOd::one_cycle (int frames)
double g = (gain == *ports[8]) ?
1 : pow (getport(8) / gain, 1. / (double) frames);
d_sample * d = ports[9];
sample_t * d = ports[9];
for (int i = 0; i < frames; ++i)
{

View File

@@ -40,7 +40,7 @@ class VCOs
: public Plugin
{
public:
d_sample f, gain;
sample_t f, gain;
/* ok to just change these as you please, 4/32 works ok, sortof. */
enum {
@@ -89,7 +89,7 @@ class VCOd
{
public:
double fs;
d_sample f, gain;
sample_t f, gain;
/* ok to just change these as you please, 4/32 works ok, sortof. */
enum {

View File

@@ -37,7 +37,7 @@ White::one_cycle (int frames)
double g = (gain == *ports[0]) ?
1 : pow (getport(0) / gain, 1. / (double) frames);
d_sample * d = ports[1];
sample_t * d = ports[1];
for (int i = 0; i < frames; ++i)
{

View File

@@ -34,7 +34,7 @@ class White
: public Plugin
{
public:
d_sample gain;
sample_t gain;
DSP::White white;
@@ -46,9 +46,7 @@ class White
void init() {}
void activate()
{
gain = .5;
}
{ gain = getport(0); }
void run (int n)
{

View File

@@ -94,21 +94,20 @@ typedef struct {
LADSPA_PortRangeHint range;
} PortInfo;
typedef LADSPA_Data d_sample;
typedef double d_float;
typedef LADSPA_Data sample_t;
typedef unsigned long ulong;
/* flavours for sample store functions run() and run_adding() */
typedef void (*sample_func_t) (d_sample *, int, d_sample, d_sample);
typedef void (*sample_func_t) (sample_t *, int, sample_t, sample_t);
inline void
store_func (d_sample * s, int i, d_sample x, d_sample gain)
store_func (sample_t * s, int i, sample_t x, sample_t gain)
{
s[i] = x;
}
inline void
adding_func (d_sample * s, int i, d_sample x, d_sample gain)
adding_func (sample_t * s, int i, sample_t x, sample_t gain)
{
s[i] += gain * x;
}
@@ -175,24 +174,24 @@ class Plugin {
double adding_gain; /* for run_adding() */
int first_run; /* 1st block after activate(), do no parameter smoothing */
d_sample normal; /* renormal constant */
sample_t normal; /* renormal constant */
d_sample ** ports;
sample_t ** ports;
LADSPA_PortRangeHint * ranges; /* for getport() below */
public:
/* get port value, mapping inf or nan to 0 */
inline d_sample getport_unclamped (int i)
inline sample_t getport_unclamped (int i)
{
d_sample v = *ports[i];
sample_t v = *ports[i];
return (isinf (v) || isnan(v)) ? 0 : v;
}
/* get port value and clamp to port range */
inline d_sample getport (int i)
inline sample_t getport (int i)
{
LADSPA_PortRangeHint & r = ranges[i];
d_sample v = getport_unclamped (i);
sample_t v = getport_unclamped (i);
return clamp (v, r.LowerBound, r.UpperBound);
}
};

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,447 @@
<?xml version='1.0' encoding='ISO-8859-1'?>
<!--
caps.rdf
Metadata for the CAPS Audio Plugin Suite
Automatically generated based on work done by
Paul Winkler,
Pete Leigh and
Tim Goetze.
Welcome to the Dept. of Redundancy Dept. Dept. Dept.
-->
<!DOCTYPE rdf:RDF
[
<!ENTITY rdf 'http://www.w3.org/1999/02/22-rdf-syntax-ns#'>
<!ENTITY rdfs 'http://www.w3.org/2000/01/rdf-schema#'>
<!ENTITY dc 'http://purl.org/dc/elements/1.1/'>
<!ENTITY ladspa 'http://ladspa.org/ontology#'>
]
>
<rdf:RDF
xmlns:rdf="&rdf;"
xmlns:rdfs="&rdfs;"
xmlns:dc="&dc;"
xmlns:ladspa="&ladspa;"
>
<!-- CabinetI -->
<ladspa:SimulatorPlugin
rdf:about='http://ladspa.org/ontology#1766'>
<ladspa:hasPort>
<ladspa:InputControlPort
rdf:about="&ladspa;1766.1"
ladspa:hasLabel="model">
<ladspa:hasScale>
<ladspa:Scale>
<ladspa:hasPoint>
<ladspa:Point
rdf:value="0"
ladspa:hasLabel="none" />
</ladspa:hasPoint>
<ladspa:hasPoint>
<ladspa:Point
rdf:value="1"
ladspa:hasLabel="Unmatched off-axis" />
</ladspa:hasPoint>
<ladspa:hasPoint>
<ladspa:Point
rdf:value="2"
ladspa:hasLabel="Unmatched on-axis" />
</ladspa:hasPoint>
<ladspa:hasPoint>
<ladspa:Point
rdf:value="3"
ladspa:hasLabel="Supertramp" />
</ladspa:hasPoint>
<ladspa:hasPoint>
<ladspa:Point
rdf:value="4"
ladspa:hasLabel="Little Wing 68" />
</ladspa:hasPoint>
<ladspa:hasPoint>
<ladspa:Point
rdf:value="5"
ladspa:hasLabel="Martial" />
</ladspa:hasPoint>
<ladspa:hasPoint>
<ladspa:Point
rdf:value="6"
ladspa:hasLabel="Mesa" />
</ladspa:hasPoint>
<ladspa:hasPoint>
<ladspa:Point
rdf:value="7"
ladspa:hasLabel="Pro Jr" />
</ladspa:hasPoint>
</ladspa:Scale>
</ladspa:hasScale>
</ladspa:InputControlPort>
</ladspa:hasPort>
</ladspa:SimulatorPlugin>
<!-- ChorusI -->
<ladspa:ChorusPlugin
rdf:about='http://ladspa.org/ontology#1767'>
</ladspa:ChorusPlugin>
<!-- StereoChorusI -->
<ladspa:ChorusPlugin
rdf:about='http://ladspa.org/ontology#1768'>
</ladspa:ChorusPlugin>
<!-- Click -->
<ladspa:TimePlugin
rdf:about='http://ladspa.org/ontology#1769'>
</ladspa:TimePlugin>
<!-- CEO -->
<ladspa:OscillatorPlugin
rdf:about='http://ladspa.org/ontology#1770'>
</ladspa:OscillatorPlugin>
<!-- Clip -->
<ladspa:DistortionPlugin
rdf:about='http://ladspa.org/ontology#1771'>
</ladspa:DistortionPlugin>
<!-- Compress -->
<ladspa:CompressorPlugin
rdf:about='http://ladspa.org/ontology#1772'>
</ladspa:CompressorPlugin>
<!-- Eq -->
<ladspa:EQPlugin
rdf:about='http://ladspa.org/ontology#1773'>
</ladspa:EQPlugin>
<!-- Lorenz -->
<ladspa:GeneratorPlugin
rdf:about='http://ladspa.org/ontology#1774'>
</ladspa:GeneratorPlugin>
<!-- PhaserI -->
<ladspa:PhaserPlugin
rdf:about='http://ladspa.org/ontology#1775'>
</ladspa:PhaserPlugin>
<!-- PreampIII -->
<ladspa:SimulatorPlugin
rdf:about='http://ladspa.org/ontology#1776'>
</ladspa:SimulatorPlugin>
<!-- PreampIV -->
<ladspa:SimulatorPlugin
rdf:about='http://ladspa.org/ontology#1777'>
</ladspa:SimulatorPlugin>
<!-- JVRev -->
<ladspa:ReverbPlugin
rdf:about='http://ladspa.org/ontology#1778'>
</ladspa:ReverbPlugin>
<!-- Plate -->
<ladspa:ReverbPlugin
rdf:about='http://ladspa.org/ontology#1779'>
</ladspa:ReverbPlugin>
<!-- Roessler -->
<ladspa:GeneratorPlugin
rdf:about='http://ladspa.org/ontology#1780'>
</ladspa:GeneratorPlugin>
<!-- Sin -->
<ladspa:OscillatorPlugin
rdf:about='http://ladspa.org/ontology#1781'>
</ladspa:OscillatorPlugin>
<!-- SweepVFI -->
<ladspa:FilterPlugin
rdf:about='http://ladspa.org/ontology#1782'>
<ladspa:hasPort>
<ladspa:InputControlPort
rdf:about="&ladspa;1782.3"
ladspa:hasLabel="model">
<ladspa:hasScale>
<ladspa:Scale>
<ladspa:hasPoint>
<ladspa:Point
rdf:value="0"
ladspa:hasLabel="low pass" />
</ladspa:hasPoint>
<ladspa:hasPoint>
<ladspa:Point
rdf:value="1"
ladspa:hasLabel="band pass" />
</ladspa:hasPoint>
</ladspa:Scale>
</ladspa:hasScale>
</ladspa:InputControlPort>
</ladspa:hasPort>
</ladspa:FilterPlugin>
<!-- VCOs -->
<ladspa:OscillatorPlugin
rdf:about='http://ladspa.org/ontology#1783'>
</ladspa:OscillatorPlugin>
<!-- VCOd -->
<ladspa:OscillatorPlugin
rdf:about='http://ladspa.org/ontology#1784'>
</ladspa:OscillatorPlugin>
<!-- White -->
<ladspa:GeneratorPlugin
rdf:about='http://ladspa.org/ontology#1785'>
</ladspa:GeneratorPlugin>
<!-- AmpIII -->
<ladspa:SimulatorPlugin
rdf:about='http://ladspa.org/ontology#1786'>
</ladspa:SimulatorPlugin>
<!-- HRTF -->
<ladspa:SimulatorPlugin
rdf:about='http://ladspa.org/ontology#1787'>
</ladspa:SimulatorPlugin>
<!-- Pan -->
<ladspa:DelayPlugin
rdf:about='http://ladspa.org/ontology#1788'>
</ladspa:DelayPlugin>
<!-- AmpIV -->
<ladspa:SimulatorPlugin
rdf:about='http://ladspa.org/ontology#1794'>
</ladspa:SimulatorPlugin>
<!-- Plate2x2 -->
<ladspa:ReverbPlugin
rdf:about='http://ladspa.org/ontology#1795'>
</ladspa:ReverbPlugin>
<!-- CabinetII -->
<ladspa:SimulatorPlugin
rdf:about='http://ladspa.org/ontology#2581'>
<ladspa:hasPort>
<ladspa:InputControlPort
rdf:about="&ladspa;2581.1"
ladspa:hasLabel="model">
<ladspa:hasScale>
<ladspa:Scale>
<ladspa:hasPoint>
<ladspa:Point
rdf:value="0"
ladspa:hasLabel="none" />
</ladspa:hasPoint>
<ladspa:hasPoint>
<ladspa:Point
rdf:value="1"
ladspa:hasLabel="Unmatched off-axis" />
</ladspa:hasPoint>
<ladspa:hasPoint>
<ladspa:Point
rdf:value="2"
ladspa:hasLabel="Unmatched on-axis" />
</ladspa:hasPoint>
<ladspa:hasPoint>
<ladspa:Point
rdf:value="3"
ladspa:hasLabel="Supertramp" />
</ladspa:hasPoint>
<ladspa:hasPoint>
<ladspa:Point
rdf:value="4"
ladspa:hasLabel="Little Wing 68" />
</ladspa:hasPoint>
<ladspa:hasPoint>
<ladspa:Point
rdf:value="5"
ladspa:hasLabel="Martial" />
</ladspa:hasPoint>
<ladspa:hasPoint>
<ladspa:Point
rdf:value="6"
ladspa:hasLabel="Mesa" />
</ladspa:hasPoint>
<ladspa:hasPoint>
<ladspa:Point
rdf:value="7"
ladspa:hasLabel="Pro Jr" />
</ladspa:hasPoint>
</ladspa:Scale>
</ladspa:hasScale>
</ladspa:InputControlPort>
</ladspa:hasPort>
</ladspa:SimulatorPlugin>
<!-- SweepVFII -->
<ladspa:FilterPlugin
rdf:about='http://ladspa.org/ontology#2582'>
<ladspa:hasPort>
<ladspa:InputControlPort
rdf:about="&ladspa;2582.3"
ladspa:hasLabel="model">
<ladspa:hasScale>
<ladspa:Scale>
<ladspa:hasPoint>
<ladspa:Point
rdf:value="0"
ladspa:hasLabel="low pass" />
</ladspa:hasPoint>
<ladspa:hasPoint>
<ladspa:Point
rdf:value="1"
ladspa:hasLabel="band pass" />
</ladspa:hasPoint>
</ladspa:Scale>
</ladspa:hasScale>
</ladspa:InputControlPort>
</ladspa:hasPort>
</ladspa:FilterPlugin>
<!-- ChorusII -->
<ladspa:ChorusPlugin
rdf:about='http://ladspa.org/ontology#2583'>
</ladspa:ChorusPlugin>
<!-- StereoChorusII -->
<ladspa:ChorusPlugin
rdf:about='http://ladspa.org/ontology#2584'>
</ladspa:ChorusPlugin>
<!-- Dirac -->
<ladspa:GeneratorPlugin
rdf:about='http://ladspa.org/ontology#2585'>
</ladspa:GeneratorPlugin>
<!-- PhaserII -->
<ladspa:PhaserPlugin
rdf:about='http://ladspa.org/ontology#2586'>
</ladspa:PhaserPlugin>
<!-- AmpV -->
<ladspa:SimulatorPlugin
rdf:about='http://ladspa.org/ontology#2587'>
</ladspa:SimulatorPlugin>
<!-- Scape -->
<ladspa:DelayPlugin
rdf:about='http://ladspa.org/ontology#2588'>
</ladspa:DelayPlugin>
<!-- ToneStack -->
<ladspa:SimulatorPlugin
rdf:about='http://ladspa.org/ontology#2589'>
<ladspa:hasPort>
<ladspa:InputControlPort
rdf:about="&ladspa;2589.1"
ladspa:hasLabel="model">
<ladspa:hasScale>
<ladspa:Scale>
<ladspa:hasPoint>
<ladspa:Point
rdf:value="0"
ladspa:hasLabel="'59 Bassman" />
</ladspa:hasPoint>
<ladspa:hasPoint>
<ladspa:Point
rdf:value="1"
ladspa:hasLabel="'69 Twin Reverb" />
</ladspa:hasPoint>
<ladspa:hasPoint>
<ladspa:Point
rdf:value="2"
ladspa:hasLabel="'64 Princeton" />
</ladspa:hasPoint>
<ladspa:hasPoint>
<ladspa:Point
rdf:value="3"
ladspa:hasLabel="'59/'81 JCM 800" />
</ladspa:hasPoint>
<ladspa:hasPoint>
<ladspa:Point
rdf:value="4"
ladspa:hasLabel="'78 Club &amp; Country" />
</ladspa:hasPoint>
<ladspa:hasPoint>
<ladspa:Point
rdf:value="5"
ladspa:hasLabel="'59/'86 AC-30 of sorts" />
</ladspa:hasPoint>
</ladspa:Scale>
</ladspa:hasScale>
</ladspa:InputControlPort>
</ladspa:hasPort>
</ladspa:SimulatorPlugin>
<!-- ToneStackLT -->
<ladspa:SimulatorPlugin
rdf:about='http://ladspa.org/ontology#2590'>
</ladspa:SimulatorPlugin>
<!-- AmpVTS -->
<ladspa:SimulatorPlugin
rdf:about='http://ladspa.org/ontology#2592'>
<ladspa:hasPort>
<ladspa:InputControlPort
rdf:about="&ladspa;2592.1"
ladspa:hasLabel="model">
<ladspa:hasScale>
<ladspa:Scale>
<ladspa:hasPoint>
<ladspa:Point
rdf:value="0"
ladspa:hasLabel="'59 Bassman" />
</ladspa:hasPoint>
<ladspa:hasPoint>
<ladspa:Point
rdf:value="1"
ladspa:hasLabel="'69 Twin Reverb" />
</ladspa:hasPoint>
<ladspa:hasPoint>
<ladspa:Point
rdf:value="2"
ladspa:hasLabel="'64 Princeton" />
</ladspa:hasPoint>
<ladspa:hasPoint>
<ladspa:Point
rdf:value="3"
ladspa:hasLabel="'59/'81 JCM 800" />
</ladspa:hasPoint>
<ladspa:hasPoint>
<ladspa:Point
rdf:value="4"
ladspa:hasLabel="'78 Club &amp; Country" />
</ladspa:hasPoint>
<ladspa:hasPoint>
<ladspa:Point
rdf:value="5"
ladspa:hasLabel="'59/'86 AC-30 of sorts" />
</ladspa:hasPoint>
</ladspa:Scale>
</ladspa:hasScale>
</ladspa:InputControlPort>
</ladspa:hasPort>
</ladspa:SimulatorPlugin>
<!-- AutoWah -->
<ladspa:FilterPlugin
rdf:about='http://ladspa.org/ontology#2593'>
</ladspa:FilterPlugin>
<!-- Eq2x2 -->
<ladspa:EQPlugin
rdf:about='http://ladspa.org/ontology#2594'>
</ladspa:EQPlugin>
<!-- Narrower -->
<ladspa:FilterPlugin
rdf:about='http://ladspa.org/ontology#2595'>
</ladspa:FilterPlugin>
<!-- Goodbye, Dept. of Redundancy Dept. Dept. Dept. -->
</rdf:RDF>

View File

@@ -0,0 +1,30 @@
#! /usr/bin/env python
import os
CFLAGS = []
OSX_LDFLAGS = "-bundle -undefined suppress -flat_namespace"
def we_have_sse():
try: return 'sse' in open ('/proc/cpuinfo').read().split()
except: return 0
def we_have_ssse3():
try: return 'ssse3' in open ('/proc/cpuinfo').read().split()
except: return 0
def we_think_so_different_dude():
try: return 'Darwin' == os.popen ('uname -s').read().strip()
except: return 0
def store():
f = open ('defines.make', 'w')
f.write ("_CFLAGS=" + ' '.join (CFLAGS) + "\n")
if we_think_so_different_dude():
f.write ("_LDFLAGS=" + OSX_LDFLAGS + "\n")
f.write ("STRIP = echo\n")
if __name__ == '__main__':
if we_have_sse():
CFLAGS += ('-msse', '-mfpmath=sse')
if we_have_ssse3():
CFLAGS += ('-msse3',)
store()

View File

@@ -34,21 +34,24 @@ class BiQuad
{
public:
/* coefficients */
d_sample a[3], b[3];
sample_t a[3], b[3];
/* history */
int h;
d_sample x[2], y[2];
sample_t x[2], y[2];
BiQuad()
{
/* initialize to unity */
a[0] = 1;
a[1] = a[2] = b[0] = b[1] = b[2] = 0;
unity();
reset();
}
void unity()
{
a[0] = 1;
a[1] = a[2] = b[0] = b[1] = b[2] = 0;
}
void copy (BiQuad & bq)
{
for (int i = 0; i < 3; ++i)
@@ -72,11 +75,11 @@ class BiQuad
y[i] = 0;
}
inline d_sample process (d_sample s)
inline sample_t process (sample_t s)
{
register int z = h;
register d_sample r = s * a[0];
register sample_t r = s * a[0];
r += a[1] * x[z];
r += b[1] * y[z];
@@ -96,11 +99,11 @@ class BiQuad
/* Following are additional methods for using the biquad to filter an
* upsampled signal with 0 padding -- some terms reduce to 0 in this
* case */
inline d_sample process_0_1()
inline sample_t process_0_1()
{
register int z = h;
register d_sample r = 0;
register sample_t r = 0;
r += a[1] * x[z];
r += b[1] * y[z];
@@ -117,11 +120,11 @@ class BiQuad
return r;
}
inline d_sample process_0_2()
inline sample_t process_0_2()
{
register int z = h;
register d_sample r = 0;
register sample_t r = 0;
r += b[1] * y[z];
@@ -137,11 +140,11 @@ class BiQuad
return r;
}
inline d_sample process_0_3()
inline sample_t process_0_3()
{
register int z = h;
register d_sample r = 0;
register sample_t r = 0;
r += b[1] * y[z];

View File

@@ -1,11 +1,11 @@
/*
dsp/Delay.h
Copyright 2003-4 Tim Goetze <tim@quitte.de>
Copyright 2003-4, 2010 Tim Goetze <tim@quitte.de>
http://quitte.de/dsp/
delay lines with fractional (linear or cubica interpolation) lookup
delay lines with fractional (linear or cubic interpolation) lookup
and an allpass interpolating tap (which needs more work).
delay line storage is aligned to powers of two for simplified wrapping
@@ -41,7 +41,7 @@ class Delay
{
public:
int size;
d_sample * data;
sample_t * data;
int read, write;
Delay()
@@ -58,46 +58,46 @@ class Delay
void init (int n)
{
size = next_power_of_2 (n);
data = (d_sample *) calloc (sizeof (d_sample), size);
data = (sample_t *) calloc (sizeof (sample_t), size);
size -= 1;
write = n;
}
void reset()
{
memset (data, 0, (size + 1) * sizeof (d_sample));
memset (data, 0, (size + 1) * sizeof (sample_t));
}
d_sample &
sample_t &
operator [] (int i)
{
return data [(write - i) & size];
}
inline void
put (d_sample x)
put (sample_t x)
{
data [write] = x;
write = (write + 1) & size;
}
inline d_sample
inline sample_t
get()
{
d_sample x = data [read];
sample_t x = data [read];
read = (read + 1) & size;
return x;
}
inline d_sample
putget (d_sample x)
inline sample_t
putget (sample_t x)
{
put (x);
return get();
}
/* fractional lookup, linear interpolation */
inline d_sample
inline sample_t
get_at (float f)
{
int n;
@@ -108,24 +108,24 @@ class Delay
}
/* fractional lookup, cubic interpolation */
inline d_sample
inline sample_t
get_cubic (float f)
{
int n;
fistp (f, n); /* see FPTruncateMode */
f -= n;
d_sample x_1 = (*this) [n - 1];
d_sample x0 = (*this) [n];
d_sample x1 = (*this) [n + 1];
d_sample x2 = (*this) [n + 2];
sample_t x_1 = (*this) [n - 1];
sample_t x0 = (*this) [n];
sample_t x1 = (*this) [n + 1];
sample_t x2 = (*this) [n + 2];
/* d_sample (32bit) quicker than double here */
register d_sample a =
/* sample_t (32bit) quicker than double here */
register sample_t a =
(3 * (x0 - x1) - x_1 + x2) * .5;
register d_sample b =
register sample_t b =
2 * x1 + x_1 - (5 * x0 + x2) * .5;
register d_sample c =
register sample_t c =
(x1 - x_1) * .5;
return x0 + (((a * f) + b) * f + c) * f;
@@ -137,7 +137,7 @@ class Delay
class DelayTapA
{
public:
d_sample x1, y1;
sample_t x1, y1;
DelayTapA()
{
@@ -149,16 +149,16 @@ class DelayTapA
x1 = y1 = 0;
}
d_sample get (Delay & d, float f)
sample_t get (Delay & d, float f)
{
int n;
fistp (f, n); /* read: i = (int) f; relies on FPTruncateMode */
fistp (f, n); /* read: n = (int) f; relies on FPTruncateMode */
f -= n;
if (0 && f < .5)
f += 1,
n -= 1;
d_sample x = d[n];
sample_t x = d[n];
f = (1 - f) / (1 + f);
y1 = x1 + f * x - f * y1;
x1 = x;

View File

@@ -1,7 +1,7 @@
/*
dsp/FIR.h
Copyright 2003-4 Tim Goetze <tim@quitte.de>
Copyright 2003-10 Tim Goetze <tim@quitte.de>
http://quitte.de/dsp/
@@ -32,9 +32,9 @@
namespace DSP {
/* brute-force FIR filter with downsampling method.
/* brute-force FIR filter with downsampling method (decimating).
*
* CAVEAT: constructing it from another FIR makes the filter use that very
* CAVEAT: constructing it from another FIR makes the filter share the other's
* kernel data set. IOW, the other FIR must be valid throughout the lifetime
* of this instance.
*/
@@ -45,7 +45,7 @@ class FIR
int n, m;
/* coefficients, history */
d_sample * c, * x;
sample_t * c, * x;
bool borrowed_kernel;
/* history index */
@@ -63,7 +63,7 @@ class FIR
init (fir.n);
}
FIR (int n, d_sample * kernel)
FIR (int n, sample_t * kernel)
{
c = 0;
init (n);
@@ -82,18 +82,16 @@ class FIR
n = N;
/* keeping history size a power of 2 makes it possible to wrap the
* history pointer by binary & instead of %, saving huge amounts of
* cpu cycles.
*/
* history pointer by & instead of %, saving a few cpu cycles. */
m = next_power_of_2 (n);
if (c)
borrowed_kernel = true;
else
borrowed_kernel = false,
c = (d_sample *) malloc (n * sizeof (d_sample));
c = (sample_t *) malloc (n * sizeof (sample_t));
x = (d_sample *) malloc (m * sizeof (d_sample));
x = (sample_t *) malloc (m * sizeof (sample_t));
m -= 1;
@@ -103,11 +101,11 @@ class FIR
void reset()
{
h = 0;
memset (x, 0, n * sizeof (d_sample));
memset (x, 0, n * sizeof (sample_t));
}
/* TODO: write an SSE-enabled version */
inline d_sample process (d_sample s)
inline sample_t process (sample_t s)
{
x[h] = s;
@@ -126,7 +124,7 @@ class FIR
* a FIRUpsampler instead.
*/
template <int Z, int OVER>
inline d_sample upsample (d_sample s)
inline sample_t upsample (sample_t s)
{
x[h] = s;
@@ -144,7 +142,7 @@ class FIR
}
/* used in downsampling */
inline void store (d_sample s)
inline void store (sample_t s)
{
x[h] = s;
h = (h + 1) & m;
@@ -169,7 +167,7 @@ class FIRUpsampler
int over;
/* coefficients, history */
d_sample * c, * x;
sample_t * c, * x;
/* history index */
int h;
@@ -184,7 +182,7 @@ class FIRUpsampler
{
c = x = 0;
init (fir.n, _over);
memcpy (c, fir.c, n * sizeof (d_sample));
memcpy (c, fir.c, n * sizeof (sample_t));
}
~FIRUpsampler()
@@ -206,8 +204,8 @@ class FIRUpsampler
*/
m = next_power_of_2 ((n + over - 1) / over);
c = (d_sample *) malloc (n * sizeof (d_sample));
x = (d_sample *) malloc (m * sizeof (d_sample));
c = (sample_t *) malloc (n * sizeof (sample_t));
x = (sample_t *) malloc (m * sizeof (sample_t));
m -= 1;
@@ -217,11 +215,11 @@ class FIRUpsampler
void reset()
{
h = 0;
memset (x, 0, (m + 1) * sizeof (d_sample));
memset (x, 0, (m + 1) * sizeof (sample_t));
}
/* upsample the given sample */
inline d_sample upsample (d_sample s)
inline sample_t upsample (sample_t s)
{
x[h] = s;
@@ -236,11 +234,10 @@ class FIRUpsampler
}
/* upsample a zero sample (interleaving), Z being the time, in samples,
* since the last non-0 sample.
*/
inline d_sample pad (int Z)
* since the last non-0 sample. */
inline sample_t pad (int Z)
{
d_sample s = 0;
sample_t s = 0;
for (int z = h - 1; Z < n; --z, Z += over)
s += c[Z] * x[z & m];

View File

@@ -70,7 +70,7 @@ class LatFilt
vcoef[ORDER] = 0;
}
d_sample process (d_sample s) {
sample_t process (sample_t s) {
double tmp;
int i = ORDER-1;
@@ -85,7 +85,7 @@ class LatFilt
state[0] = tmp;
y = y + vcoef[0]*tmp;
return (d_sample) y;
return (sample_t) y;
}
inline void set_vi(double coef, int i) {

View File

@@ -70,7 +70,7 @@ class Lorenz
h = _h;
}
d_sample get()
sample_t get()
{
step();
return .5 * get_y() + get_z();

View File

@@ -33,7 +33,7 @@ namespace DSP {
class OnePoleLP
{
public:
d_sample a0, b1, y1;
sample_t a0, b1, y1;
OnePoleLP (double d = 1.)
{
@@ -53,11 +53,11 @@ class OnePoleLP
inline void set (double d)
{
a0 = (d_sample) d;
b1 = (d_sample) 1. - d;
a0 = (sample_t) d;
b1 = (sample_t) 1. - d;
}
inline d_sample process (d_sample x)
inline sample_t process (sample_t x)
{
return y1 = a0 * x + b1 * y1;
}
@@ -79,7 +79,7 @@ class OnePoleLP
class OnePoleHP
{
public:
d_sample a0, a1, b1, x1, y1;
sample_t a0, a1, b1, x1, y1;
OnePoleHP (double d = 1.)
{
@@ -94,12 +94,12 @@ class OnePoleHP
inline void set (double d)
{
a0 = (d_sample) ((1. + d) / 2.);
a1 = (d_sample) ((1. + d) / -2.);
a0 = (sample_t) ((1. + d) / 2.);
a1 = (sample_t) ((1. + d) / -2.);
b1 = d;
}
inline d_sample process (d_sample x)
inline sample_t process (sample_t x)
{
y1 = a0 * x + a1 * x1 + b1 * y1;
x1 = x;

View File

@@ -1,7 +1,9 @@
/*
dsp/RBJ.h
Copyright 2004 Tim Goetze <tim@quitte.de>, 1998 Robert Bristow-Johnson
Copyright
1998 Robert Bristow-Johnson
2004-10 Tim Goetze <tim@quitte.de>
biquad prototypes according to the eq cookbook. easy-to-use, nice,
predictable filters. thanks rbj!
@@ -26,6 +28,8 @@
#ifndef _DSP_RBJ_H_
#define _DSP_RBJ_H_
#include "BiQuad.h"
namespace DSP {
namespace RBJ {
@@ -33,12 +37,14 @@ namespace RBJ {
class RBJ
{
public:
double alpha, sin, cos;
double Q, alpha, sin, cos;
double a[3], b[3];
public:
RBJ (double f, double Q)
RBJ (double f, double _Q)
{
Q = _Q;
double w = 2 * M_PI * f;
sin = ::sin (w);
@@ -74,9 +80,15 @@ class LP
: public RBJ
{
public:
LP (double f, double Q, BiQuad & bq) : RBJ (f, Q)
{ ab (bq.a, bq.b); }
template <class T>
LP (double f, double Q, T * ca, T * cb)
: RBJ (f, Q)
LP (double f, double Q, T * ca, T * cb) : RBJ (f, Q)
{ ab (ca, cb); }
template <class T>
void ab (T * ca, T * cb)
{
b[0] = (1 - cos) * .5;
b[1] = (1 - cos);
@@ -94,9 +106,15 @@ class BP
: public RBJ
{
public:
BP (double f, double Q, BiQuad & bq) : RBJ (f, Q)
{ ab (bq.a, bq.b); }
template <class T>
BP (double f, double Q, T * ca, T * cb)
: RBJ (f, Q)
BP (double f, double Q, T * ca, T * cb) : RBJ (f, Q)
{ ab (ca, cb); }
template <class T>
void ab (T * ca, T * cb)
{
b[0] = Q * alpha;
b[1] = 0;
@@ -114,9 +132,15 @@ class HP
: public RBJ
{
public:
HP (double f, double Q, BiQuad & bq) : RBJ (f, Q)
{ ab (bq.a, bq.b); }
template <class T>
HP (double f, double Q, T * ca, T * cb)
: RBJ (f, Q)
HP (double f, double Q, T * ca, T * cb) : RBJ (f, Q)
{ ab (ca, cb); }
template <class T>
void ab (T * ca, T * cb)
{
b[0] = (1 + cos) * .5;
b[1] = -(1 + cos);
@@ -134,9 +158,15 @@ class Notch
: public RBJ
{
public:
Notch (double f, double Q, BiQuad & bq) : RBJ (f, Q)
{ ab (bq.a, bq.b); }
template <class T>
Notch (double f, double Q, T * ca, T * cb)
: RBJ (f, Q)
Notch (double f, double Q, T * ca, T * cb) : RBJ (f, Q)
{ ab (ca, cb); }
template <class T>
void ab (T * ca, T * cb)
{
b[0] = 1;
b[1] = -2 * cos;
@@ -150,7 +180,7 @@ class Notch
}
};
/* shelving and peaking dept. */
/* shelving and peaking dept. ////////////////////////////////////////////// */
class PeakShelve
: public RBJ
@@ -172,9 +202,17 @@ class LoShelve
: public PeakShelve
{
public:
LoShelve (double f, double Q, double dB, BiQuad & bq)
: PeakShelve (f, Q, dB)
{ ab (bq.a, bq.b); }
template <class T>
LoShelve (double f, double Q, double dB, T * ca, T * cb)
: PeakShelve (f, Q, dB)
{ ab (ca, cb); }
template <class T>
void ab (T * ca, T * cb)
{
double Ap1 = A + 1, Am1 = A - 1;
double beta_sin = beta * sin;
@@ -195,9 +233,17 @@ class PeakingEQ
: public PeakShelve
{
public:
PeakingEQ (double f, double Q, double dB, BiQuad & bq)
: PeakShelve (f, Q, dB)
{ ab (bq.a, bq.b); }
template <class T>
PeakingEQ (double f, double Q, double dB, T * ca, T * cb)
: PeakShelve (f, Q, dB)
{ ab (ca, cb); }
template <class T>
void ab (T * ca, T * cb)
{
b[0] = 1 + alpha * A;
b[1] = -2 * cos;
@@ -215,9 +261,17 @@ class HiShelve
: public PeakShelve
{
public:
HiShelve (double f, double Q, double dB, BiQuad & bq)
: PeakShelve (f, Q, dB)
{ ab (bq.a, bq.b); }
template <class T>
HiShelve (double f, double Q, double dB, T * ca, T * cb)
: PeakShelve (f, Q, dB)
{ ab (ca, cb); }
template <class T>
void ab (T * ca, T * cb)
{
double Ap1 = A + 1, Am1 = A - 1;
double beta_sin = beta * sin;

View File

@@ -33,7 +33,7 @@ namespace DSP {
class RMS
{
protected:
d_sample buffer[64];
sample_t buffer[64];
int write;
public:
@@ -52,20 +52,20 @@ class RMS
}
/* caution: pass in the *squared* sample value */
void store (d_sample x)
void store (sample_t x)
{
sum -= buffer[write];
sum += (buffer[write] = x);
write = (write + 1) & 63;
}
d_sample process (d_sample x)
sample_t process (sample_t x)
{
store (x);
return rms();
}
d_sample rms()
sample_t rms()
{
/* fabs it before sqrt, just in case ... */
return sqrt (fabs (sum) / 64);

View File

@@ -66,7 +66,7 @@ class Roessler
get();
}
d_sample get()
sample_t get()
{
int J = I ^ 1;

View File

@@ -80,11 +80,11 @@ class SVF
{
protected:
/* loop parameters */
d_sample f, q, qnorm;
sample_t f, q, qnorm;
/* outputs (peak and notch left out) */
d_sample lo, band, hi;
d_sample * out;
sample_t lo, band, hi;
sample_t * out;
public:
/* the type of filtering to do. */
@@ -125,13 +125,13 @@ class SVF
out = &hi;
}
void one_cycle (d_sample * s, int frames)
void one_cycle (sample_t * s, int frames)
{
for (int i = 0; i < frames; ++i)
s[i] = process (s[i]);
}
d_sample process (d_sample x)
sample_t process (sample_t x)
{
x = qnorm * x;
@@ -176,7 +176,7 @@ class StackedSVF
svf[i].set_f_Q (f, Q);
}
d_sample process (d_sample x)
sample_t process (sample_t x)
{
for (int i = 0; i < STACKED; ++i)
x = svf[i].process (x);

View File

@@ -34,8 +34,8 @@ class Sine
{
protected:
int z;
d_float y[2];
d_float b;
double y[2];
double b;
public:
Sine()

View File

@@ -62,7 +62,7 @@ class TDFII
/* per-band recursion:
* y = 2 * (a * (x - x[-2]) + c * y[-1] - b * y[-2])
*/
d_sample process (d_sample s)
sample_t process (sample_t s)
{
double y = h[0] + b[0] * s;
@@ -71,7 +71,7 @@ class TDFII
h[Order - 1] = b[Order] * s - a[Order] * y;
return (d_sample) y;
return (sample_t) y;
}
};

View File

@@ -92,13 +92,13 @@ class ToneStack
c = 2 * _fs;
}
void activate (d_sample ** ports)
void activate (sample_t ** ports)
{
filter.reset();
}
/* pass in pointer to ports and relative index of first eq band control */
void start_cycle (d_sample ** ports, int bassindex = 1)
void start_cycle (sample_t ** ports, int bassindex = 1)
{
int m = clamp<int> ((int) *ports[0], 0, n_presets - 1);
if (m != model)
@@ -151,7 +151,7 @@ class ToneStack
filter.reset();
}
inline void updatecoefs (d_sample ** ports)
inline void updatecoefs (sample_t ** ports)
{
/* range checks on input */
double b = clamp<double> (*ports[0], 0, 1);
@@ -185,7 +185,7 @@ class ToneStack
}
// actualy do the DFII filtering, one sample at a time
inline d_sample process (d_sample x)
inline sample_t process (sample_t x)
{
return filter.process (x);
}
@@ -224,7 +224,7 @@ class ToneStackLT
void init (double _fs)
{ }
void activate (d_sample ** ports)
void activate (sample_t ** ports)
{
filter.reset();
}
@@ -237,7 +237,7 @@ class ToneStackLT
bp = blah;
}
void updatecoefs (d_sample ** ports)
void updatecoefs (sample_t ** ports)
{
double b = min (Steps - 1, max (*ports[0] * (Steps - 1), 0));
double m = min (Steps - 1, max (*ports[1] * (Steps - 1), 0));
@@ -258,7 +258,7 @@ class ToneStackLT
}
// actualy do the DFII filtering, one sample at a time
inline d_sample process (d_sample x)
inline sample_t process (sample_t x)
{
return filter.process (x);
}

View File

@@ -31,7 +31,7 @@ namespace DSP {
#include "r12ax7.h"
typedef d_sample tube_sample;
typedef sample_t tube_sample;
/* this is the original tube model from caps < 0.1.9 or preamp.so, put
* back into use in 0.1.11; the replacement (below) is too strong in

View File

@@ -1,7 +1,7 @@
/*
dsp/VCO.h
Copyright 2004 Tim Goetze <tim@quitte.de>
Copyright 2004, 2010 Tim Goetze <tim@quitte.de>
oscillators for triangle/sawtooth/square waves, and a combination
for detuning and hard sync.
@@ -74,7 +74,7 @@ class TriSaw
inline float get()
{
phase += inc;
/* the good thing is that tri is always > .5, which implies
* that this first conditional is true more often than not. */
if (phase <= tri)
@@ -151,13 +151,14 @@ class TriSawSquare
st2 = s * tri;
}
/* advance and return 1 sample. a pity we need so many conditionals,
* seeing that this is run at 352 k.
/* advance and return 1 sample.
* many branching instructions but on this intel chip faster than
* a version using floor() to keep the phase within [0..1].
*/
inline float get()
{
phase += inc;
if (phase <= tri)
first_half:
/* raw version:

View File

@@ -48,30 +48,30 @@ class White
b = (uint32) (f * (float) 0x1fff7777);
}
d_sample abs()
sample_t abs()
{
return fabs (get());
}
/* 32-bit version */
d_sample get()
sample_t get()
{
# define BIT(y) ((b << (31 - y)) & 0x80000000)
b = ((BIT (28) ^ BIT (27) ^ BIT (1) ^ BIT (0))) | (b >> 1);
return (4.6566128730773926e-10 * (d_sample) b) - 1;
return (4.6566128730773926e-10 * (sample_t) b) - 1;
# undef BIT
}
/* 31-bit version, at least 6 instructions less / sample. probably only
* pays off on a processor not providing a decent binary shift. */
d_sample get_31()
sample_t get_31()
{
# define BIT(y) ((b << (30 - y)) & 0x40000000)
b = ((BIT (3) ^ BIT (0))) | (b >> 1);
return (9.3132257461547852e-10 * (d_sample) b) - 1;
return (9.3132257461547852e-10 * (sample_t) b) - 1;
# undef BIT
}

View File

@@ -35,7 +35,7 @@ namespace DSP {
/* sample sinc() with step size omega into s[], centered around s + n / 2 */
inline void
sinc (double omega, d_sample * s, int n)
sinc (double omega, sample_t * s, int n)
{
/* initial phase */
double phi = (n / 2) * -omega;

View File

@@ -1,7 +1,7 @@
/*
dsp/windows.h
Copyright 2004-9 Tim Goetze <tim@quitte.de>
Copyright 2004-11 Tim Goetze <tim@quitte.de>
http://quitte.de/dsp/
@@ -31,27 +31,26 @@
namespace DSP {
/* prototypes for window value application ... */
typedef void (*window_sample_func_t) (d_sample &, d_sample);
typedef void (*window_sample_func_t) (sample_t &, sample_t);
/* ... which go as template parameters for the window calculation below */
inline void
store_sample (d_sample & d, d_sample s)
store_sample (sample_t & d, sample_t s)
{
d = s;
}
inline void
apply_window (d_sample &d, d_sample s)
apply_window (sample_t &d, sample_t s)
{
d *= s;
}
template <window_sample_func_t F>
void
hanning (d_sample * s, int n)
hanning (sample_t * s, int n)
{
/* TODO: speed up by using DSP::Sine */
/* could speed up by using DSP::Sine but we rarely use this window */
for (int i = 0; i < n; ++i)
{
register double f = (double) i / n - 1;
@@ -61,7 +60,7 @@ hanning (d_sample * s, int n)
template <window_sample_func_t F>
void
blackman (d_sample * s, int n)
blackman (sample_t * s, int n)
{
register float w = n;
@@ -79,7 +78,7 @@ blackman (d_sample * s, int n)
template <window_sample_func_t F>
void
blackman_harris (d_sample * s, int n)
blackman_harris (sample_t * s, int n)
{
register double w1 = 2.f * M_PI / (n - 1);
register double w2 = 2.f * w1;
@@ -138,7 +137,7 @@ besseli (double x)
template <window_sample_func_t F>
void
kaiser (d_sample * s, int n, double beta)
kaiser (sample_t * s, int n, double beta)
{
double bb = besseli (beta);
int si = 0;

View File

@@ -1,13 +1,13 @@
/*
interface.cc
Copyright 2004-9 Tim Goetze <tim@quitte.de>
Copyright 2004-11 Tim Goetze <tim@quitte.de>
http://quitte.de/dsp/
LADSPA descriptor factory, host interface.
*/
*/
/*
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
@@ -24,6 +24,10 @@
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
02111-1307, USA or point your web browser to http://www.gnu.org.
*/
/*
LADSPA ID ranges 1761 - 1800 and 2581 - 2660
(2541 - 2580 donated to artemio@kdemail.net)
*/
#include <sys/time.h>
@@ -51,7 +55,7 @@
#include "Descriptor.h"
#define N 38
#define N 39
static DescriptorStub * descriptors [N];
/*static inline void
@@ -74,6 +78,7 @@ void _init()
*d++ = new Descriptor<Eq2x2>();
*d++ = new Descriptor<Compress>();
*d++ = new Descriptor<Pan>();
*d++ = new Descriptor<Narrower>();
*d++ = new Descriptor<PreampIII>();
*d++ = new Descriptor<PreampIV>();