aboutsummaryrefslogtreecommitdiffstats
path: root/plugins/MacVST/Lowpass
diff options
context:
space:
mode:
authorChris Johnson <jinx6568@sover.net>2019-01-27 21:13:54 -0500
committerChris Johnson <jinx6568@sover.net>2019-01-27 21:13:54 -0500
commit966f2d253cd2ee6ce140ad68095a20a9d2b63052 (patch)
treeb0400d95bd06512531ade6ddf55190a58b6a5623 /plugins/MacVST/Lowpass
parent0887543349dbbec0721a1fc8b1c7deba9afefa8b (diff)
downloadairwindows-lv2-port-966f2d253cd2ee6ce140ad68095a20a9d2b63052.tar.gz
airwindows-lv2-port-966f2d253cd2ee6ce140ad68095a20a9d2b63052.tar.bz2
airwindows-lv2-port-966f2d253cd2ee6ce140ad68095a20a9d2b63052.zip
Floating Point Dither For All
Diffstat (limited to 'plugins/MacVST/Lowpass')
-rwxr-xr-xplugins/MacVST/Lowpass/Lowpass.xcodeproj/christopherjohnson.pbxuser42
-rwxr-xr-xplugins/MacVST/Lowpass/Lowpass.xcodeproj/christopherjohnson.perspectivev330
-rwxr-xr-xplugins/MacVST/Lowpass/source/Lowpass.cpp6
-rwxr-xr-xplugins/MacVST/Lowpass/source/Lowpass.h9
-rwxr-xr-xplugins/MacVST/Lowpass/source/LowpassProc.cpp68
5 files changed, 61 insertions, 94 deletions
diff --git a/plugins/MacVST/Lowpass/Lowpass.xcodeproj/christopherjohnson.pbxuser b/plugins/MacVST/Lowpass/Lowpass.xcodeproj/christopherjohnson.pbxuser
index e5aba92..8c9ad70 100755
--- a/plugins/MacVST/Lowpass/Lowpass.xcodeproj/christopherjohnson.pbxuser
+++ b/plugins/MacVST/Lowpass/Lowpass.xcodeproj/christopherjohnson.pbxuser
@@ -49,14 +49,14 @@
PBXFileDataSource_Warnings_ColumnID,
);
};
- PBXPerProjectTemplateStateSaveDate = 528461025;
- PBXWorkspaceStateSaveDate = 528461025;
+ PBXPerProjectTemplateStateSaveDate = 569770101;
+ PBXWorkspaceStateSaveDate = 569770101;
};
perUserProjectItems = {
8B22B1231DB18F4A0075D7AA /* PBXTextBookmark */ = 8B22B1231DB18F4A0075D7AA /* PBXTextBookmark */;
8B22B1531DB190EA0075D7AA /* PBXTextBookmark */ = 8B22B1531DB190EA0075D7AA /* PBXTextBookmark */;
- 8B9D6DDA1F7EF2A5007AB60F /* PBXTextBookmark */ = 8B9D6DDA1F7EF2A5007AB60F /* PBXTextBookmark */;
- 8B9D7BAB1F7FACF3007AB60F /* PBXTextBookmark */ = 8B9D7BAB1F7FACF3007AB60F /* PBXTextBookmark */;
+ 8B793C9021F6007F006E9731 /* PBXTextBookmark */ = 8B793C9021F6007F006E9731 /* PBXTextBookmark */;
+ 8B793C9521F600A2006E9731 /* PBXTextBookmark */ = 8B793C9521F600A2006E9731 /* PBXTextBookmark */;
};
sourceControlManager = 8B02375E1D42B1C400E1E8C8 /* Source Control */;
userBuildSettings = {
@@ -64,17 +64,17 @@
};
2407DEB6089929BA00EB68BF /* Lowpass.cpp */ = {
uiCtxt = {
- sepNavIntBoundsRect = "{{0, 0}, {848, 1911}}";
- sepNavSelRange = "{455, 0}";
- sepNavVisRange = "{0, 1921}";
+ sepNavIntBoundsRect = "{{0, 0}, {848, 1898}}";
+ sepNavSelRange = "{598, 0}";
+ sepNavVisRange = "{0, 1951}";
sepNavWindowFrame = "{{330, 47}, {895, 831}}";
};
};
245463B80991757100464AD3 /* Lowpass.h */ = {
uiCtxt = {
- sepNavIntBoundsRect = "{{0, 0}, {859, 936}}";
- sepNavSelRange = "{2574, 84}";
- sepNavVisRange = "{2517, 153}";
+ sepNavIntBoundsRect = "{{0, 0}, {866, 767}}";
+ sepNavSelRange = "{2605, 0}";
+ sepNavVisRange = "{2427, 182}";
sepNavWindowFrame = "{{61, 47}, {895, 831}}";
};
};
@@ -113,7 +113,7 @@
fRef = 2407DEB6089929BA00EB68BF /* Lowpass.cpp */;
name = "Lowpass.cpp: 51";
rLen = 0;
- rLoc = 1842;
+ rLoc = 1858;
rType = 0;
vrLen = 71;
vrLoc = 1746;
@@ -128,25 +128,25 @@
vrLen = 707;
vrLoc = 10342;
};
- 8B9D6DDA1F7EF2A5007AB60F /* PBXTextBookmark */ = {
+ 8B793C9021F6007F006E9731 /* PBXTextBookmark */ = {
isa = PBXTextBookmark;
fRef = 245463B80991757100464AD3 /* Lowpass.h */;
name = "Lowpass.h: 67";
- rLen = 84;
+ rLen = 43;
rLoc = 2574;
rType = 0;
- vrLen = 167;
- vrLoc = 2503;
+ vrLen = 194;
+ vrLoc = 2398;
};
- 8B9D7BAB1F7FACF3007AB60F /* PBXTextBookmark */ = {
+ 8B793C9521F600A2006E9731 /* PBXTextBookmark */ = {
isa = PBXTextBookmark;
fRef = 245463B80991757100464AD3 /* Lowpass.h */;
- name = "Lowpass.h: 67";
- rLen = 84;
- rLoc = 2574;
+ name = "Lowpass.h: 68";
+ rLen = 0;
+ rLoc = 2605;
rType = 0;
- vrLen = 153;
- vrLoc = 2517;
+ vrLen = 182;
+ vrLoc = 2427;
};
8D01CCC60486CAD60068D4B7 /* Lowpass */ = {
activeExec = 0;
diff --git a/plugins/MacVST/Lowpass/Lowpass.xcodeproj/christopherjohnson.perspectivev3 b/plugins/MacVST/Lowpass/Lowpass.xcodeproj/christopherjohnson.perspectivev3
index fcf5254..bb86e03 100755
--- a/plugins/MacVST/Lowpass/Lowpass.xcodeproj/christopherjohnson.perspectivev3
+++ b/plugins/MacVST/Lowpass/Lowpass.xcodeproj/christopherjohnson.perspectivev3
@@ -300,7 +300,7 @@
<key>PBXSmartGroupTreeModuleOutlineStateSelectionKey</key>
<array>
<array>
- <integer>6</integer>
+ <integer>5</integer>
<integer>4</integer>
<integer>0</integer>
</array>
@@ -351,12 +351,12 @@
<key>_historyCapacity</key>
<integer>0</integer>
<key>bookmark</key>
- <string>8B9D7BAB1F7FACF3007AB60F</string>
+ <string>8B793C9521F600A2006E9731</string>
<key>history</key>
<array>
<string>8B22B1231DB18F4A0075D7AA</string>
<string>8B22B1531DB190EA0075D7AA</string>
- <string>8B9D6DDA1F7EF2A5007AB60F</string>
+ <string>8B793C9021F6007F006E9731</string>
</array>
</dict>
<key>SplitCount</key>
@@ -370,18 +370,18 @@
<key>GeometryConfiguration</key>
<dict>
<key>Frame</key>
- <string>{{0, 0}, {603, 194}}</string>
+ <string>{{0, 0}, {603, 182}}</string>
<key>RubberWindowFrame</key>
<string>355 287 810 487 0 0 1440 878 </string>
</dict>
<key>Module</key>
<string>PBXNavigatorGroup</string>
<key>Proportion</key>
- <string>194pt</string>
+ <string>182pt</string>
</dict>
<dict>
<key>Proportion</key>
- <string>247pt</string>
+ <string>259pt</string>
<key>Tabs</key>
<array>
<dict>
@@ -395,9 +395,7 @@
<key>GeometryConfiguration</key>
<dict>
<key>Frame</key>
- <string>{{10, 27}, {603, 220}}</string>
- <key>RubberWindowFrame</key>
- <string>355 287 810 487 0 0 1440 878 </string>
+ <string>{{10, 27}, {603, 232}}</string>
</dict>
<key>Module</key>
<string>XCDetailModule</string>
@@ -451,7 +449,9 @@
<key>GeometryConfiguration</key>
<dict>
<key>Frame</key>
- <string>{{10, 27}, {603, 178}}</string>
+ <string>{{10, 27}, {603, 232}}</string>
+ <key>RubberWindowFrame</key>
+ <string>355 287 810 487 0 0 1440 878 </string>
</dict>
<key>Module</key>
<string>PBXBuildResultsModule</string>
@@ -479,11 +479,11 @@
</array>
<key>TableOfContents</key>
<array>
- <string>8B9D7BAC1F7FACF3007AB60F</string>
+ <string>8B793C9621F600A2006E9731</string>
<string>1CA23ED40692098700951B8B</string>
- <string>8B9D7BAD1F7FACF3007AB60F</string>
+ <string>8B793C9721F600A2006E9731</string>
<string>8B0237581D42B1C400E1E8C8</string>
- <string>8B9D7BAE1F7FACF3007AB60F</string>
+ <string>8B793C9821F600A2006E9731</string>
<string>1CA23EDF0692099D00951B8B</string>
<string>1CA23EE00692099D00951B8B</string>
<string>1CA23EE10692099D00951B8B</string>
@@ -636,7 +636,7 @@
<key>StatusbarIsVisible</key>
<true/>
<key>TimeStamp</key>
- <real>528461043.96388102</real>
+ <real>569770146.430691</real>
<key>ToolbarConfigUserDefaultsMinorVersion</key>
<string>2</string>
<key>ToolbarDisplayMode</key>
@@ -653,7 +653,7 @@
<integer>5</integer>
<key>WindowOrderList</key>
<array>
- <string>8B9D7BAF1F7FACF3007AB60F</string>
+ <string>8B793C9921F600A2006E9731</string>
<string>/Users/christopherjohnson/Desktop/MacVST/Lowpass/Lowpass.xcodeproj</string>
</array>
<key>WindowString</key>
diff --git a/plugins/MacVST/Lowpass/source/Lowpass.cpp b/plugins/MacVST/Lowpass/source/Lowpass.cpp
index 8178799..18064fc 100755
--- a/plugins/MacVST/Lowpass/source/Lowpass.cpp
+++ b/plugins/MacVST/Lowpass/source/Lowpass.cpp
@@ -19,10 +19,8 @@ Lowpass::Lowpass(audioMasterCallback audioMaster) :
iirSampleBL = 0.0;
iirSampleAR = 0.0;
iirSampleBR = 0.0;
- fpNShapeLA = 0.0;
- fpNShapeLB = 0.0;
- fpNShapeRA = 0.0;
- fpNShapeRB = 0.0;
+ fpNShapeL = 0.0;
+ fpNShapeR = 0.0;
fpFlip = true;
//this is reset: values being initialized only once. Startup values, whatever they are.
diff --git a/plugins/MacVST/Lowpass/source/Lowpass.h b/plugins/MacVST/Lowpass/source/Lowpass.h
index 1b99c55..40ac456 100755
--- a/plugins/MacVST/Lowpass/source/Lowpass.h
+++ b/plugins/MacVST/Lowpass/source/Lowpass.h
@@ -54,11 +54,8 @@ private:
char _programName[kVstMaxProgNameLen + 1];
std::set< std::string > _canDo;
- long double fpNShapeLA;
- long double fpNShapeLB;
- long double fpNShapeRA;
- long double fpNShapeRB;
- bool fpFlip;
+ long double fpNShapeL;
+ long double fpNShapeR;
//default stuff
float A;
@@ -68,7 +65,7 @@ private:
double iirSampleBL;
double iirSampleAR;
double iirSampleBR;
-
+ bool fpFlip;
};
#endif
diff --git a/plugins/MacVST/Lowpass/source/LowpassProc.cpp b/plugins/MacVST/Lowpass/source/LowpassProc.cpp
index bcce714..bcc3690 100755
--- a/plugins/MacVST/Lowpass/source/LowpassProc.cpp
+++ b/plugins/MacVST/Lowpass/source/LowpassProc.cpp
@@ -27,9 +27,6 @@ void Lowpass::processReplacing(float **inputs, float **outputs, VstInt32 sampleF
double inputSampleR;
double outputSampleL;
double outputSampleR;
- float fpTemp;
- long double fpOld = 0.618033988749894848204586; //golden ratio!
- long double fpNew = 1.0 - fpOld;
iirAmount += (iirAmount * tight * tight);
if (tight > 0) tight /= 1.5;
@@ -116,33 +113,21 @@ void Lowpass::processReplacing(float **inputs, float **outputs, VstInt32 sampleF
iirSampleBR = (iirSampleBR * (1 - (offset * iirAmount))) + (inputSampleR * (offset * iirAmount));
outputSampleR = iirSampleBR;
}
+ fpFlip = !fpFlip;
if (wet < 1.0) outputSampleL = (outputSampleL * wet) + (inputSampleL * dry);
if (wet < 1.0) outputSampleR = (outputSampleR * wet) + (inputSampleR * dry);
- //noise shaping to 32-bit floating point
- if (fpFlip) {
- fpTemp = outputSampleL;
- fpNShapeLA = (fpNShapeLA*fpOld)+((outputSampleL-fpTemp)*fpNew);
- outputSampleL += fpNShapeLA;
-
- fpTemp = outputSampleR;
- fpNShapeRA = (fpNShapeRA*fpOld)+((outputSampleR-fpTemp)*fpNew);
- outputSampleR += fpNShapeRA;
- }
- else {
- fpTemp = outputSampleL;
- fpNShapeLB = (fpNShapeLB*fpOld)+((outputSampleL-fpTemp)*fpNew);
- outputSampleL += fpNShapeLB;
-
- fpTemp = outputSampleR;
- fpNShapeRB = (fpNShapeRB*fpOld)+((outputSampleR-fpTemp)*fpNew);
- outputSampleR += fpNShapeRB;
- }
- fpFlip = !fpFlip;
- //end noise shaping on 32 bit output
+ //stereo 32 bit dither, made small and tidy.
+ int expon; frexpf((float)inputSampleL, &expon);
+ long double dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62);
+ inputSampleL += (dither-fpNShapeL); fpNShapeL = dither;
+ frexpf((float)inputSampleR, &expon);
+ dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62);
+ inputSampleR += (dither-fpNShapeR); fpNShapeR = dither;
+ //end 32 bit dither
*out1 = outputSampleL;
*out2 = outputSampleR;
@@ -174,9 +159,6 @@ void Lowpass::processDoubleReplacing(double **inputs, double **outputs, VstInt32
double inputSampleR;
double outputSampleL;
double outputSampleR;
- double fpTemp;
- double fpOld = 0.618033988749894848204586; //golden ratio!
- double fpNew = 1.0 - fpOld;
iirAmount += (iirAmount * tight * tight);
if (tight > 0) tight /= 1.5;
@@ -263,33 +245,23 @@ void Lowpass::processDoubleReplacing(double **inputs, double **outputs, VstInt32
iirSampleBR = (iirSampleBR * (1 - (offset * iirAmount))) + (inputSampleR * (offset * iirAmount));
outputSampleR = iirSampleBR;
}
+ fpFlip = !fpFlip;
if (wet < 1.0) outputSampleL = (outputSampleL * wet) + (inputSampleL * dry);
if (wet < 1.0) outputSampleR = (outputSampleR * wet) + (inputSampleR * dry);
- //noise shaping to 64-bit floating point
- if (fpFlip) {
- fpTemp = outputSampleL;
- fpNShapeLA = (fpNShapeLA*fpOld)+((outputSampleL-fpTemp)*fpNew);
- outputSampleL += fpNShapeLA;
-
- fpTemp = outputSampleR;
- fpNShapeRA = (fpNShapeRA*fpOld)+((outputSampleR-fpTemp)*fpNew);
- outputSampleR += fpNShapeRA;
- }
- else {
- fpTemp = outputSampleL;
- fpNShapeLB = (fpNShapeLB*fpOld)+((outputSampleL-fpTemp)*fpNew);
- outputSampleL += fpNShapeLB;
-
- fpTemp = outputSampleR;
- fpNShapeRB = (fpNShapeRB*fpOld)+((outputSampleR-fpTemp)*fpNew);
- outputSampleR += fpNShapeRB;
- }
- fpFlip = !fpFlip;
- //end noise shaping on 32 bit output
+ //stereo 64 bit dither, made small and tidy.
+ int expon; frexp((double)inputSampleL, &expon);
+ long double dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62);
+ dither /= 536870912.0; //needs this to scale to 64 bit zone
+ inputSampleL += (dither-fpNShapeL); fpNShapeL = dither;
+ frexp((double)inputSampleR, &expon);
+ dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62);
+ dither /= 536870912.0; //needs this to scale to 64 bit zone
+ inputSampleR += (dither-fpNShapeR); fpNShapeR = dither;
+ //end 64 bit dither
*out1 = outputSampleL;
*out2 = outputSampleR;