aboutsummaryrefslogtreecommitdiffstats
path: root/plugins/MacVST/StereoFX
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/StereoFX
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/StereoFX')
-rwxr-xr-xplugins/MacVST/StereoFX/StereoFX.xcodeproj/christopherjohnson.pbxuser16
-rwxr-xr-xplugins/MacVST/StereoFX/StereoFX.xcodeproj/christopherjohnson.perspectivev324
-rwxr-xr-xplugins/MacVST/StereoFX/source/StereoFX.cpp6
-rwxr-xr-xplugins/MacVST/StereoFX/source/StereoFX.h6
-rwxr-xr-xplugins/MacVST/StereoFX/source/StereoFXProc.cpp62
5 files changed, 43 insertions, 71 deletions
diff --git a/plugins/MacVST/StereoFX/StereoFX.xcodeproj/christopherjohnson.pbxuser b/plugins/MacVST/StereoFX/StereoFX.xcodeproj/christopherjohnson.pbxuser
index 59f72aa..06f0165 100755
--- a/plugins/MacVST/StereoFX/StereoFX.xcodeproj/christopherjohnson.pbxuser
+++ b/plugins/MacVST/StereoFX/StereoFX.xcodeproj/christopherjohnson.pbxuser
@@ -49,8 +49,8 @@
PBXFileDataSource_Warnings_ColumnID,
);
};
- PBXPerProjectTemplateStateSaveDate = 546569458;
- PBXWorkspaceStateSaveDate = 546569458;
+ PBXPerProjectTemplateStateSaveDate = 569772631;
+ PBXWorkspaceStateSaveDate = 569772631;
};
sourceControlManager = 8B02375E1D42B1C400E1E8C8 /* Source Control */;
userBuildSettings = {
@@ -58,17 +58,17 @@
};
2407DEB6089929BA00EB68BF /* StereoFX.cpp */ = {
uiCtxt = {
- sepNavIntBoundsRect = "{{0, 0}, {848, 1833}}";
- sepNavSelRange = "{601, 0}";
- sepNavVisRange = "{2949, 2162}";
+ sepNavIntBoundsRect = "{{0, 0}, {848, 1846}}";
+ sepNavSelRange = "{548, 0}";
+ sepNavVisRange = "{0, 1959}";
sepNavWindowFrame = "{{12, 47}, {895, 831}}";
};
};
245463B80991757100464AD3 /* StereoFX.h */ = {
uiCtxt = {
- sepNavIntBoundsRect = "{{0, 0}, {866, 936}}";
- sepNavSelRange = "{2618, 0}";
- sepNavVisRange = "{0, 2405}";
+ sepNavIntBoundsRect = "{{0, 0}, {866, 910}}";
+ sepNavSelRange = "{2498, 0}";
+ sepNavVisRange = "{347, 2231}";
sepNavWindowFrame = "{{20, 47}, {895, 831}}";
};
};
diff --git a/plugins/MacVST/StereoFX/StereoFX.xcodeproj/christopherjohnson.perspectivev3 b/plugins/MacVST/StereoFX/StereoFX.xcodeproj/christopherjohnson.perspectivev3
index 2a5be24..1e8fb00 100755
--- a/plugins/MacVST/StereoFX/StereoFX.xcodeproj/christopherjohnson.perspectivev3
+++ b/plugins/MacVST/StereoFX/StereoFX.xcodeproj/christopherjohnson.perspectivev3
@@ -256,6 +256,8 @@
<key>Layout</key>
<array>
<dict>
+ <key>BecomeActive</key>
+ <true/>
<key>ContentConfiguration</key>
<dict>
<key>PBXBottomSmartGroupGIDs</key>
@@ -298,7 +300,7 @@
<key>PBXSmartGroupTreeModuleOutlineStateSelectionKey</key>
<array>
<array>
- <integer>6</integer>
+ <integer>5</integer>
<integer>4</integer>
<integer>0</integer>
</array>
@@ -321,7 +323,7 @@
<real>185</real>
</array>
<key>RubberWindowFrame</key>
- <string>19 357 810 487 0 0 1440 878 </string>
+ <string>326 318 810 487 0 0 1440 878 </string>
</dict>
<key>Module</key>
<string>PBXSmartGroupTreeModule</string>
@@ -360,7 +362,7 @@
<key>Frame</key>
<string>{{0, 0}, {603, 0}}</string>
<key>RubberWindowFrame</key>
- <string>19 357 810 487 0 0 1440 878 </string>
+ <string>326 318 810 487 0 0 1440 878 </string>
</dict>
<key>Module</key>
<string>PBXNavigatorGroup</string>
@@ -439,7 +441,7 @@
<key>Frame</key>
<string>{{10, 27}, {603, 414}}</string>
<key>RubberWindowFrame</key>
- <string>19 357 810 487 0 0 1440 878 </string>
+ <string>326 318 810 487 0 0 1440 878 </string>
</dict>
<key>Module</key>
<string>PBXBuildResultsModule</string>
@@ -467,11 +469,11 @@
</array>
<key>TableOfContents</key>
<array>
- <string>8BC5CFB52093FD050058B257</string>
+ <string>8B79408D21F60A83006E9731</string>
<string>1CA23ED40692098700951B8B</string>
- <string>8BC5CFB62093FD050058B257</string>
+ <string>8B79408E21F60A83006E9731</string>
<string>8B0237581D42B1C400E1E8C8</string>
- <string>8BC5CFB72093FD050058B257</string>
+ <string>8B79408F21F60A83006E9731</string>
<string>1CA23EDF0692099D00951B8B</string>
<string>1CA23EE00692099D00951B8B</string>
<string>1CA23EE10692099D00951B8B</string>
@@ -624,7 +626,7 @@
<key>StatusbarIsVisible</key>
<true/>
<key>TimeStamp</key>
- <real>546571504.84971404</real>
+ <real>569772675.65113199</real>
<key>ToolbarConfigUserDefaultsMinorVersion</key>
<string>2</string>
<key>ToolbarDisplayMode</key>
@@ -641,11 +643,11 @@
<integer>5</integer>
<key>WindowOrderList</key>
<array>
- <string>8BC5CFDD209404F00058B257</string>
- <string>/Users/christopherjohnson/Desktop/StereoFX/StereoFX.xcodeproj</string>
+ <string>8B79409021F60A83006E9731</string>
+ <string>/Users/christopherjohnson/Desktop/MacVST/StereoFX/StereoFX.xcodeproj</string>
</array>
<key>WindowString</key>
- <string>19 357 810 487 0 0 1440 878 </string>
+ <string>326 318 810 487 0 0 1440 878 </string>
<key>WindowToolsV3</key>
<array>
<dict>
diff --git a/plugins/MacVST/StereoFX/source/StereoFX.cpp b/plugins/MacVST/StereoFX/source/StereoFX.cpp
index 63c23db..704cbf3 100755
--- a/plugins/MacVST/StereoFX/source/StereoFX.cpp
+++ b/plugins/MacVST/StereoFX/source/StereoFX.cpp
@@ -17,10 +17,8 @@ StereoFX::StereoFX(audioMasterCallback audioMaster) :
C = 0.0;
iirSampleA = 0.0;
iirSampleB = 0.0;
- fpNShapeLA = 0.0;
- fpNShapeLB = 0.0;
- fpNShapeRA = 0.0;
- fpNShapeRB = 0.0;
+ fpNShapeL = 0.0;
+ fpNShapeR = 0.0;
flip = false;
//this is reset: values being initialized only once. Startup values, whatever they are.
diff --git a/plugins/MacVST/StereoFX/source/StereoFX.h b/plugins/MacVST/StereoFX/source/StereoFX.h
index 6748d1e..7a36059 100755
--- a/plugins/MacVST/StereoFX/source/StereoFX.h
+++ b/plugins/MacVST/StereoFX/source/StereoFX.h
@@ -56,10 +56,8 @@ private:
double iirSampleA;
double iirSampleB;
- long double fpNShapeLA;
- long double fpNShapeLB;
- long double fpNShapeRA;
- long double fpNShapeRB;
+ long double fpNShapeL;
+ long double fpNShapeR;
bool flip;
//default stuff
diff --git a/plugins/MacVST/StereoFX/source/StereoFXProc.cpp b/plugins/MacVST/StereoFX/source/StereoFXProc.cpp
index 49be44f..0e9de74 100755
--- a/plugins/MacVST/StereoFX/source/StereoFXProc.cpp
+++ b/plugins/MacVST/StereoFX/source/StereoFXProc.cpp
@@ -17,9 +17,6 @@ void StereoFX::processReplacing(float **inputs, float **outputs, VstInt32 sample
double overallscale = 1.0;
overallscale /= 44100.0;
overallscale *= getSampleRate();
- float fpTemp;
- long double fpOld = 0.618033988749894848204586; //golden ratio!
- long double fpNew = 1.0 - fpOld;
long double inputSampleL;
long double inputSampleR;
long double mid;
@@ -138,25 +135,14 @@ void StereoFX::processReplacing(float **inputs, float **outputs, VstInt32 sample
inputSampleL = (mid+side)/2.0;
inputSampleR = (mid-side)/2.0;
- //noise shaping to 32-bit floating point
- if (flip) {
- fpTemp = inputSampleL;
- fpNShapeLA = (fpNShapeLA*fpOld)+((inputSampleL-fpTemp)*fpNew);
- inputSampleL += fpNShapeLA;
- fpTemp = inputSampleR;
- fpNShapeRA = (fpNShapeRA*fpOld)+((inputSampleR-fpTemp)*fpNew);
- inputSampleR += fpNShapeRA;
- }
- else {
- fpTemp = inputSampleL;
- fpNShapeLB = (fpNShapeLB*fpOld)+((inputSampleL-fpTemp)*fpNew);
- inputSampleL += fpNShapeLB;
- fpTemp = inputSampleR;
- fpNShapeRB = (fpNShapeRB*fpOld)+((inputSampleR-fpTemp)*fpNew);
- inputSampleR += fpNShapeRB;
- }
- flip = !flip;
- //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 = inputSampleL;
*out2 = inputSampleR;
@@ -178,9 +164,6 @@ void StereoFX::processDoubleReplacing(double **inputs, double **outputs, VstInt3
double overallscale = 1.0;
overallscale /= 44100.0;
overallscale *= getSampleRate();
- double fpTemp;
- long double fpOld = 0.618033988749894848204586; //golden ratio!
- long double fpNew = 1.0 - fpOld;
long double inputSampleL;
long double inputSampleR;
long double mid;
@@ -299,25 +282,16 @@ void StereoFX::processDoubleReplacing(double **inputs, double **outputs, VstInt3
inputSampleL = (mid+side)/2.0;
inputSampleR = (mid-side)/2.0;
- //noise shaping to 64-bit floating point
- if (flip) {
- fpTemp = inputSampleL;
- fpNShapeLA = (fpNShapeLA*fpOld)+((inputSampleL-fpTemp)*fpNew);
- inputSampleL += fpNShapeLA;
- fpTemp = inputSampleR;
- fpNShapeRA = (fpNShapeRA*fpOld)+((inputSampleR-fpTemp)*fpNew);
- inputSampleR += fpNShapeRA;
- }
- else {
- fpTemp = inputSampleL;
- fpNShapeLB = (fpNShapeLB*fpOld)+((inputSampleL-fpTemp)*fpNew);
- inputSampleL += fpNShapeLB;
- fpTemp = inputSampleR;
- fpNShapeRB = (fpNShapeRB*fpOld)+((inputSampleR-fpTemp)*fpNew);
- inputSampleR += fpNShapeRB;
- }
- flip = !flip;
- //end noise shaping on 64 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 = inputSampleL;
*out2 = inputSampleR;