aboutsummaryrefslogtreecommitdiffstats
path: root/plugins/LV2/src/IronOxide5/IronOxide5.cpp
blob: 77a9424eb804069312b2f1bfaae4bcfad1951c74 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
#include "IronOxide5.h"
#include <iostream>
#include <lv2wrapper.h>

IronOxide5::IronOxide5(double rate)
    : LV2Plugin(rate)
{
}

void IronOxide5::activate()
{
	A = 0.5; //0.0 input trim in dB -18 to +18, default 0 ((A*36.0)-18.0)
	B = 0.562341325190349; //15.0 ips 1.5 to 150.0 logarithmic. B*B
	C = 0.562341325190349; // (C*C) * (C*C) * 150 gives 15 ips (clamp to 1.5 minimum)
	//15.0  (0.316227766016838)squared * 150 gives 15 ips
	D = 0.5; //0.5 flutter 0 to 1
	E = 0.5; //0.5 noise 0 to 1
	F = 0.5; //0.0 output trim in dB -18 to +18, default 0 ((E*36.0)-18.0)
	G = 1.0; //1.0 inv/dry/wet -1 0 1 ((F*2.0)-1.0)
	//needs very fussy defaults to comply with unusual defaults
	
	for (int temp = 0; temp < 263; temp++) {dL[temp] = 0.0; dR[temp] = 0.0;}
	gcount = 0;
	
	fastIIRAL = fastIIRBL = slowIIRAL = slowIIRBL = 0.0;
	fastIIHAL = fastIIHBL = slowIIHAL = slowIIHBL = 0.0;
	iirSamplehAL = iirSamplehBL = 0.0;
	iirSampleAL = iirSampleBL = 0.0;
	prevInputSampleL = 0.0;
	
	fastIIRAR = fastIIRBR = slowIIRAR = slowIIRBR = 0.0;
	fastIIHAR = fastIIHBR = slowIIHAR = slowIIHBR = 0.0;
	iirSamplehAR = iirSamplehBR = 0.0;
	iirSampleAR = iirSampleBR = 0.0;
	prevInputSampleR = 0.0;
		
	flip = false;
	for (int temp = 0; temp < 99; temp++) {flL[temp] = 0.0; flR[temp] = 0.0;}
	
	fstoredcount = 0;	
	sweep = 0.0;
	rateof = 0.5;
	nextmax = 0.5;
	
	fpNShapeL = 0.0;
	fpNShapeR = 0.0;
	//this is reset: values being initialized only once. Startup values, whatever they are.
	
}

void IronOxide5::run(uint32_t num_samples)
{
    A = *params[0];
    B = *params[1];
    C = *params[2];
    D = *params[3];
    E = *params[4];
    F = *params[5];
    G = *params[6];

    processReplacing(const_cast<float **>(in), out, num_samples);
}

//
// Include the processing code from the VST version.
//
#include <cmath>
#include "../../../LinuxVST/src/IronOxide5/IronOxide5Proc.cpp"

// Create the LV2Wrapper and register the plugin
LV2Wrapper<IronOxide5> plugin;