Skip to content

Commit a376041

Browse files
committed
Remove dithers
1 parent 862419f commit a376041

File tree

14 files changed

+356
-78
lines changed

14 files changed

+356
-78
lines changed

CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -491,6 +491,7 @@ target_compile_definitions (${PLUGIN_NAME} PRIVATE
491491
JUCE_USE_MP3AUDIOFORMAT=0
492492
JUCE_USE_LAME_AUDIO_FORMAT=0
493493
JUCE_USE_WINDOWS_MEDIA_FORMAT=0
494+
JUCE_SILENCE_XCODE_15_LINKER_WARNING=1
494495
_CRT_SECURE_NO_WARNINGS
495496
)
496497

modules/juce

Submodule juce updated 559 files

plugin/Source/FX/DeRez2.cpp

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,29 @@ void DeRez2::getProgramName(char *name) {vst_strncpy (name, _programName, kVstMa
5252
//airwindows likes to ignore this stuff. Make your own programs, and make a different plugin rather than
5353
//trying to do versioning and preventing people from using older versions. Maybe they like the old one!
5454

55+
void DeRez2::reset()
56+
{
57+
A = 1.0;
58+
B = 1.0;
59+
C = 1.0;
60+
D = 1.0;
61+
lastSampleL = 0.0;
62+
heldSampleL = 0.0;
63+
lastDrySampleL = 0.0;
64+
lastOutputSampleL = 0.0;
65+
66+
lastSampleR = 0.0;
67+
heldSampleR = 0.0;
68+
lastDrySampleR = 0.0;
69+
lastOutputSampleR = 0.0;
70+
71+
position = 0.0;
72+
incrementA = 0.0;
73+
incrementB = 0.0;
74+
fpdL = 1.0; while (fpdL < 16386) fpdL = rand()*UINT32_MAX;
75+
fpdR = 1.0; while (fpdR < 16386) fpdR = rand()*UINT32_MAX;
76+
}
77+
5578
static float pinParameter(float data)
5679
{
5780
if (data < 0.0f) return 0.0f;

plugin/Source/FX/DeRez2.h

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,7 @@
1212
#include <string>
1313
#include <math.h>
1414

15-
class DeRez2 :
16-
public AudioEffectX
15+
class DeRez2 final : public AudioEffectX
1716
{
1817
public:
1918
enum {
@@ -31,23 +30,24 @@ class DeRez2 :
3130

3231
DeRez2(audioMasterCallback audioMaster);
3332
~DeRez2();
34-
virtual bool getEffectName(char* name); // The plug-in name
35-
virtual VstPlugCategory getPlugCategory(); // The general category for the plug-in
36-
virtual bool getProductString(char* text); // This is a unique plug-in string provided by Steinberg
37-
virtual bool getVendorString(char* text); // Vendor info
38-
virtual VstInt32 getVendorVersion(); // Version number
39-
virtual void processReplacing (float** inputs, float** outputs, VstInt32 sampleFrames);
40-
virtual void processDoubleReplacing (double** inputs, double** outputs, VstInt32 sampleFrames);
41-
virtual void getProgramName(char *name); // read the name from the host
42-
virtual void setProgramName(char *name); // changes the name of the preset displayed in the host
43-
virtual VstInt32 getChunk (void** data, bool isPreset);
44-
virtual VstInt32 setChunk (void* data, VstInt32 byteSize, bool isPreset);
45-
virtual float getParameter(VstInt32 index); // get the parameter value at the specified index
46-
virtual void setParameter(VstInt32 index, float value); // set the parameter at index to value
47-
virtual void getParameterLabel(VstInt32 index, char *text); // label for the parameter (eg dB)
48-
virtual void getParameterName(VstInt32 index, char *text); // name of the parameter
49-
virtual void getParameterDisplay(VstInt32 index, char *text); // text description of the current value
50-
virtual VstInt32 canDo(char *text);
33+
void reset();
34+
bool getEffectName(char* name); // The plug-in name
35+
VstPlugCategory getPlugCategory(); // The general category for the plug-in
36+
bool getProductString(char* text); // This is a unique plug-in string provided by Steinberg
37+
bool getVendorString(char* text); // Vendor info
38+
VstInt32 getVendorVersion(); // Version number
39+
void processReplacing (float** inputs, float** outputs, VstInt32 sampleFrames);
40+
void processDoubleReplacing (double** inputs, double** outputs, VstInt32 sampleFrames);
41+
void getProgramName(char *name); // read the name from the host
42+
void setProgramName(char *name); // changes the name of the preset displayed in the host
43+
VstInt32 getChunk (void** data, bool isPreset);
44+
VstInt32 setChunk (void* data, VstInt32 byteSize, bool isPreset);
45+
float getParameter(VstInt32 index); // get the parameter value at the specified index
46+
void setParameter(VstInt32 index, float value); // set the parameter at index to value
47+
void getParameterLabel(VstInt32 index, char *text); // label for the parameter (eg dB)
48+
void getParameterName(VstInt32 index, char *text); // name of the parameter
49+
void getParameterDisplay(VstInt32 index, char *text); // text description of the current value
50+
VstInt32 canDo(char *text);
5151
private:
5252
char _programName[kVstMaxProgNameLen + 1];
5353
std::set< std::string > _canDo;

plugin/Source/FX/DeRez2Proc.cpp

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,8 @@ void DeRez2::processReplacing(float **inputs, float **outputs, VstInt32 sampleFr
3232
{
3333
double inputSampleL = *in1;
3434
double inputSampleR = *in2;
35-
if (fabs(inputSampleL)<1.18e-23) inputSampleL = fpdL * 1.18e-17;
36-
if (fabs(inputSampleR)<1.18e-23) inputSampleR = fpdR * 1.18e-17;
35+
//if (fabs(inputSampleL)<1.18e-23) inputSampleL = fpdL * 1.18e-17;
36+
//if (fabs(inputSampleR)<1.18e-23) inputSampleR = fpdR * 1.18e-17;
3737
double drySampleL = inputSampleL;
3838
double drySampleR = inputSampleR;
3939

@@ -167,7 +167,7 @@ void DeRez2::processReplacing(float **inputs, float **outputs, VstInt32 sampleFr
167167

168168
lastSampleL = drySampleL;
169169
lastSampleR = drySampleR;
170-
170+
/*
171171
//begin 32 bit stereo floating point dither
172172
int expon; frexpf((float)inputSampleL, &expon);
173173
fpdL ^= fpdL << 13; fpdL ^= fpdL >> 17; fpdL ^= fpdL << 5;
@@ -176,7 +176,8 @@ void DeRez2::processReplacing(float **inputs, float **outputs, VstInt32 sampleFr
176176
fpdR ^= fpdR << 13; fpdR ^= fpdR >> 17; fpdR ^= fpdR << 5;
177177
inputSampleR += ((double(fpdR)-uint32_t(0x7fffffff)) * 5.5e-36l * pow(2,expon+62));
178178
//end 32 bit stereo floating point dither
179-
179+
*/
180+
180181
*out1 = inputSampleL;
181182
*out2 = inputSampleR;
182183

@@ -210,8 +211,8 @@ void DeRez2::processDoubleReplacing(double **inputs, double **outputs, VstInt32
210211
{
211212
double inputSampleL = *in1;
212213
double inputSampleR = *in2;
213-
if (fabs(inputSampleL)<1.18e-23) inputSampleL = fpdL * 1.18e-17;
214-
if (fabs(inputSampleR)<1.18e-23) inputSampleR = fpdR * 1.18e-17;
214+
//if (fabs(inputSampleL)<1.18e-23) inputSampleL = fpdL * 1.18e-17;
215+
//if (fabs(inputSampleR)<1.18e-23) inputSampleR = fpdR * 1.18e-17;
215216
double drySampleL = inputSampleL;
216217
double drySampleR = inputSampleR;
217218

@@ -347,14 +348,16 @@ void DeRez2::processDoubleReplacing(double **inputs, double **outputs, VstInt32
347348
lastSampleR = drySampleR;
348349

349350
//begin 64 bit stereo floating point dither
351+
/*
350352
//int expon; frexp((double)inputSampleL, &expon);
351353
fpdL ^= fpdL << 13; fpdL ^= fpdL >> 17; fpdL ^= fpdL << 5;
352354
//inputSampleL += ((double(fpdL)-uint32_t(0x7fffffff)) * 1.1e-44l * pow(2,expon+62));
353355
//frexp((double)inputSampleR, &expon);
354356
fpdR ^= fpdR << 13; fpdR ^= fpdR >> 17; fpdR ^= fpdR << 5;
355357
//inputSampleR += ((double(fpdR)-uint32_t(0x7fffffff)) * 1.1e-44l * pow(2,expon+62));
356358
//end 64 bit stereo floating point dither
357-
359+
*/
360+
358361
*out1 = inputSampleL;
359362
*out2 = inputSampleR;
360363

plugin/Source/FX/FireAmp.cpp

Lines changed: 106 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,112 @@ void FireAmp::getProgramName(char *name) {vst_strncpy (name, _programName, kVstM
134134
//airwindows likes to ignore this stuff. Make your own programs, and make a different plugin rather than
135135
//trying to do versioning and preventing people from using older versions. Maybe they like the old one!
136136

137+
void FireAmp::reset()
138+
{
139+
A = 0.5;
140+
B = 0.5;
141+
C = 0.8;
142+
D = 1.0;
143+
144+
lastSampleL = 0.0;
145+
storeSampleL = 0.0;
146+
smoothAL = 0.0;
147+
smoothBL = 0.0;
148+
smoothCL = 0.0;
149+
smoothDL = 0.0;
150+
smoothEL = 0.0;
151+
smoothFL = 0.0;
152+
smoothGL = 0.0;
153+
smoothHL = 0.0;
154+
smoothIL = 0.0;
155+
smoothJL = 0.0;
156+
smoothKL = 0.0;
157+
smoothLL = 0.0;
158+
iirSampleAL = 0.0;
159+
iirSampleBL = 0.0;
160+
iirSampleCL = 0.0;
161+
iirSampleDL = 0.0;
162+
iirSampleEL = 0.0;
163+
iirSampleFL = 0.0;
164+
iirSampleGL = 0.0;
165+
iirSampleHL = 0.0;
166+
iirSampleIL = 0.0;
167+
iirSampleJL = 0.0;
168+
iirSampleKL = 0.0;
169+
iirSampleLL = 0.0;
170+
iirLowpassL = 0.0;
171+
iirSpkAL = 0.0;
172+
iirSpkBL = 0.0;
173+
iirSubL = 0.0;
174+
175+
lastSampleR = 0.0;
176+
storeSampleR = 0.0;
177+
smoothAR = 0.0;
178+
smoothBR = 0.0;
179+
smoothCR = 0.0;
180+
smoothDR = 0.0;
181+
smoothER = 0.0;
182+
smoothFR = 0.0;
183+
smoothGR = 0.0;
184+
smoothHR = 0.0;
185+
smoothIR = 0.0;
186+
smoothJR = 0.0;
187+
smoothKR = 0.0;
188+
smoothLR = 0.0;
189+
iirSampleAR = 0.0;
190+
iirSampleBR = 0.0;
191+
iirSampleCR = 0.0;
192+
iirSampleDR = 0.0;
193+
iirSampleER = 0.0;
194+
iirSampleFR = 0.0;
195+
iirSampleGR = 0.0;
196+
iirSampleHR = 0.0;
197+
iirSampleIR = 0.0;
198+
iirSampleJR = 0.0;
199+
iirSampleKR = 0.0;
200+
iirSampleLR = 0.0;
201+
iirLowpassR = 0.0;
202+
iirSpkAR = 0.0;
203+
iirSpkBR = 0.0;
204+
iirSubR = 0.0;
205+
206+
for (int fcount = 0; fcount < 257; fcount++) {
207+
OddL[fcount] = 0.0;
208+
EvenL[fcount] = 0.0;
209+
OddR[fcount] = 0.0;
210+
EvenR[fcount] = 0.0;
211+
}
212+
213+
count = 0;
214+
flip = false; //amp
215+
216+
for(int fcount = 0; fcount < 90; fcount++) {
217+
bL[fcount] = 0;
218+
bR[fcount] = 0;
219+
}
220+
smoothCabAL = 0.0; smoothCabBL = 0.0; lastCabSampleL = 0.0; //cab
221+
smoothCabAR = 0.0; smoothCabBR = 0.0; lastCabSampleR = 0.0; //cab
222+
223+
for (int fcount = 0; fcount < 9; fcount++) {
224+
lastRefL[fcount] = 0.0;
225+
lastRefR[fcount] = 0.0;
226+
}
227+
cycle = 0; //undersampling
228+
229+
for (int x = 0; x < fix_total; x++) {
230+
fixA[x] = 0.0;
231+
fixB[x] = 0.0;
232+
fixC[x] = 0.0;
233+
fixD[x] = 0.0;
234+
fixE[x] = 0.0;
235+
fixF[x] = 0.0;
236+
} //filtering
237+
238+
fpdL = 1.0; while (fpdL < 16386) fpdL = rand()*UINT32_MAX;
239+
fpdR = 1.0; while (fpdR < 16386) fpdR = rand()*UINT32_MAX;
240+
//this is reset: values being initialized only once. Startup values, whatever they are.
241+
}
242+
137243
static float pinParameter(float data)
138244
{
139245
if (data < 0.0f) return 0.0f;

plugin/Source/FX/FireAmp.h

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,7 @@
1212
#include <string>
1313
#include <math.h>
1414

15-
class FireAmp :
16-
public AudioEffectX
15+
class FireAmp final : public AudioEffectX
1716
{
1817
public:
1918
enum {
@@ -31,23 +30,24 @@ class FireAmp :
3130

3231
FireAmp(audioMasterCallback audioMaster);
3332
~FireAmp();
34-
virtual bool getEffectName(char* name); // The plug-in name
35-
virtual VstPlugCategory getPlugCategory(); // The general category for the plug-in
36-
virtual bool getProductString(char* text); // This is a unique plug-in string provided by Steinberg
37-
virtual bool getVendorString(char* text); // Vendor info
38-
virtual VstInt32 getVendorVersion(); // Version number
39-
virtual void processReplacing (float** inputs, float** outputs, VstInt32 sampleFrames);
40-
virtual void processDoubleReplacing (double** inputs, double** outputs, VstInt32 sampleFrames);
41-
virtual void getProgramName(char *name); // read the name from the host
42-
virtual void setProgramName(char *name); // changes the name of the preset displayed in the host
43-
virtual VstInt32 getChunk (void** data, bool isPreset);
44-
virtual VstInt32 setChunk (void* data, VstInt32 byteSize, bool isPreset);
45-
virtual float getParameter(VstInt32 index); // get the parameter value at the specified index
46-
virtual void setParameter(VstInt32 index, float value); // set the parameter at index to value
47-
virtual void getParameterLabel(VstInt32 index, char *text); // label for the parameter (eg dB)
48-
virtual void getParameterName(VstInt32 index, char *text); // name of the parameter
49-
virtual void getParameterDisplay(VstInt32 index, char *text); // text description of the current value
50-
virtual VstInt32 canDo(char *text);
33+
void reset();
34+
bool getEffectName(char* name); // The plug-in name
35+
VstPlugCategory getPlugCategory(); // The general category for the plug-in
36+
bool getProductString(char* text); // This is a unique plug-in string provided by Steinberg
37+
bool getVendorString(char* text); // Vendor info
38+
VstInt32 getVendorVersion(); // Version number
39+
void processReplacing (float** inputs, float** outputs, VstInt32 sampleFrames);
40+
void processDoubleReplacing (double** inputs, double** outputs, VstInt32 sampleFrames);
41+
void getProgramName(char *name); // read the name from the host
42+
void setProgramName(char *name); // changes the name of the preset displayed in the host
43+
VstInt32 getChunk (void** data, bool isPreset);
44+
VstInt32 setChunk (void* data, VstInt32 byteSize, bool isPreset);
45+
float getParameter(VstInt32 index); // get the parameter value at the specified index
46+
void setParameter(VstInt32 index, float value); // set the parameter at index to value
47+
void getParameterLabel(VstInt32 index, char *text); // label for the parameter (eg dB)
48+
void getParameterName(VstInt32 index, char *text); // name of the parameter
49+
void getParameterDisplay(VstInt32 index, char *text); // text description of the current value
50+
VstInt32 canDo(char *text);
5151
private:
5252
char _programName[kVstMaxProgNameLen + 1];
5353
std::set< std::string > _canDo;

plugin/Source/FX/FireAmpProc.cpp

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -108,8 +108,8 @@ void FireAmp::processReplacing(float **inputs, float **outputs, VstInt32 sampleF
108108
{
109109
double inputSampleL = *in1;
110110
double inputSampleR = *in2;
111-
if (fabs(inputSampleL)<1.18e-23) inputSampleL = fpdL * 1.18e-17;
112-
if (fabs(inputSampleR)<1.18e-23) inputSampleR = fpdR * 1.18e-17;
111+
//if (fabs(inputSampleL)<1.18e-23) inputSampleL = fpdL * 1.18e-17;
112+
//if (fabs(inputSampleR)<1.18e-23) inputSampleR = fpdR * 1.18e-17;
113113
double drySampleL = inputSampleL;
114114
double drySampleR = inputSampleR;
115115

@@ -840,14 +840,16 @@ void FireAmp::processReplacing(float **inputs, float **outputs, VstInt32 sampleF
840840
}
841841

842842
//begin 32 bit stereo floating point dither
843+
/*
843844
int expon; frexpf((float)inputSampleL, &expon);
844845
fpdL ^= fpdL << 13; fpdL ^= fpdL >> 17; fpdL ^= fpdL << 5;
845846
inputSampleL += ((double(fpdL)-uint32_t(0x7fffffff)) * 5.5e-36l * pow(2,expon+62));
846847
frexpf((float)inputSampleR, &expon);
847848
fpdR ^= fpdR << 13; fpdR ^= fpdR >> 17; fpdR ^= fpdR << 5;
848849
inputSampleR += ((double(fpdR)-uint32_t(0x7fffffff)) * 5.5e-36l * pow(2,expon+62));
849850
//end 32 bit stereo floating point dither
850-
851+
*/
852+
851853
*out1 = inputSampleL;
852854
*out2 = inputSampleR;
853855

@@ -958,8 +960,8 @@ void FireAmp::processDoubleReplacing(double **inputs, double **outputs, VstInt32
958960
{
959961
double inputSampleL = *in1;
960962
double inputSampleR = *in2;
961-
if (fabs(inputSampleL)<1.18e-23) inputSampleL = fpdL * 1.18e-17;
962-
if (fabs(inputSampleR)<1.18e-23) inputSampleR = fpdR * 1.18e-17;
963+
//if (fabs(inputSampleL)<1.18e-23) inputSampleL = fpdL * 1.18e-17;
964+
//if (fabs(inputSampleR)<1.18e-23) inputSampleR = fpdR * 1.18e-17;
963965
double drySampleL = inputSampleL;
964966
double drySampleR = inputSampleR;
965967

@@ -1690,14 +1692,16 @@ void FireAmp::processDoubleReplacing(double **inputs, double **outputs, VstInt32
16901692
}
16911693

16921694
//begin 64 bit stereo floating point dither
1695+
/*
16931696
//int expon; frexp((double)inputSampleL, &expon);
16941697
fpdL ^= fpdL << 13; fpdL ^= fpdL >> 17; fpdL ^= fpdL << 5;
16951698
//inputSampleL += ((double(fpdL)-uint32_t(0x7fffffff)) * 1.1e-44l * pow(2,expon+62));
16961699
//frexp((double)inputSampleR, &expon);
16971700
fpdR ^= fpdR << 13; fpdR ^= fpdR >> 17; fpdR ^= fpdR << 5;
16981701
//inputSampleR += ((double(fpdR)-uint32_t(0x7fffffff)) * 1.1e-44l * pow(2,expon+62));
16991702
//end 64 bit stereo floating point dither
1700-
1703+
*/
1704+
17011705
*out1 = inputSampleL;
17021706
*out2 = inputSampleR;
17031707

0 commit comments

Comments
 (0)