aboutsummaryrefslogtreecommitdiffstats
path: root/plugins/MacVST/Golem
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/Golem
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/Golem')
-rwxr-xr-xplugins/MacVST/Golem/Golem.xcodeproj/christopherjohnson.pbxuser40
-rwxr-xr-xplugins/MacVST/Golem/Golem.xcodeproj/christopherjohnson.perspectivev332
-rwxr-xr-xplugins/MacVST/Golem/source/Golem.cpp6
-rwxr-xr-xplugins/MacVST/Golem/source/Golem.h6
-rwxr-xr-xplugins/MacVST/Golem/source/GolemProc.cpp62
5 files changed, 58 insertions, 88 deletions
diff --git a/plugins/MacVST/Golem/Golem.xcodeproj/christopherjohnson.pbxuser b/plugins/MacVST/Golem/Golem.xcodeproj/christopherjohnson.pbxuser
index 795dec3..92a9864 100755
--- a/plugins/MacVST/Golem/Golem.xcodeproj/christopherjohnson.pbxuser
+++ b/plugins/MacVST/Golem/Golem.xcodeproj/christopherjohnson.pbxuser
@@ -49,12 +49,12 @@
PBXFileDataSource_Warnings_ColumnID,
);
};
- PBXPerProjectTemplateStateSaveDate = 546574396;
- PBXWorkspaceStateSaveDate = 546574396;
+ PBXPerProjectTemplateStateSaveDate = 569735514;
+ PBXWorkspaceStateSaveDate = 569735514;
};
perUserProjectItems = {
- 8BC5D0B1209410C30058B257 /* PBXTextBookmark */ = 8BC5D0B1209410C30058B257 /* PBXTextBookmark */;
- 8BC5D0B2209410C30058B257 /* PBXTextBookmark */ = 8BC5D0B2209410C30058B257 /* PBXTextBookmark */;
+ 8B793AE021F57961006E9731 /* PBXTextBookmark */ = 8B793AE021F57961006E9731 /* PBXTextBookmark */;
+ 8B793AF221F579C4006E9731 /* PBXTextBookmark */ = 8B793AF221F579C4006E9731 /* PBXTextBookmark */;
};
sourceControlManager = 8B02375E1D42B1C400E1E8C8 /* Source Control */;
userBuildSettings = {
@@ -62,17 +62,17 @@
};
2407DEB6089929BA00EB68BF /* Golem.cpp */ = {
uiCtxt = {
- sepNavIntBoundsRect = "{{0, 0}, {848, 1963}}";
- sepNavSelRange = "{3822, 11}";
- sepNavVisRange = "{2936, 2411}";
+ sepNavIntBoundsRect = "{{0, 0}, {848, 1989}}";
+ sepNavSelRange = "{558, 0}";
+ sepNavVisRange = "{0, 1950}";
sepNavWindowFrame = "{{12, 47}, {895, 831}}";
};
};
245463B80991757100464AD3 /* Golem.h */ = {
uiCtxt = {
- sepNavIntBoundsRect = "{{0, 0}, {866, 897}}";
- sepNavSelRange = "{2496, 0}";
- sepNavVisRange = "{2414, 147}";
+ sepNavIntBoundsRect = "{{0, 0}, {817, 923}}";
+ sepNavSelRange = "{2444, 0}";
+ sepNavVisRange = "{2413, 96}";
sepNavWindowFrame = "{{20, 47}, {895, 831}}";
};
};
@@ -86,9 +86,9 @@
};
24D8286F09A914000093AEF8 /* GolemProc.cpp */ = {
uiCtxt = {
- sepNavIntBoundsRect = "{{0, 0}, {848, 3653}}";
+ sepNavIntBoundsRect = "{{0, 0}, {848, 3354}}";
sepNavSelRange = "{5207, 0}";
- sepNavVisRange = "{4697, 1871}";
+ sepNavVisRange = "{6969, 1540}";
sepNavWindowFrame = "{{54, 47}, {895, 831}}";
};
};
@@ -106,25 +106,25 @@
isa = PBXCodeSenseManager;
indexTemplatePath = "";
};
- 8BC5D0B1209410C30058B257 /* PBXTextBookmark */ = {
+ 8B793AE021F57961006E9731 /* PBXTextBookmark */ = {
isa = PBXTextBookmark;
fRef = 245463B80991757100464AD3 /* Golem.h */;
name = "Golem.h: 61";
rLen = 0;
- rLoc = 2496;
+ rLoc = 2444;
rType = 0;
- vrLen = 147;
+ vrLen = 133;
vrLoc = 2414;
};
- 8BC5D0B2209410C30058B257 /* PBXTextBookmark */ = {
+ 8B793AF221F579C4006E9731 /* PBXTextBookmark */ = {
isa = PBXTextBookmark;
fRef = 245463B80991757100464AD3 /* Golem.h */;
- name = "Golem.h: 61";
+ name = "Golem.h: 59";
rLen = 0;
- rLoc = 2496;
+ rLoc = 2444;
rType = 0;
- vrLen = 147;
- vrLoc = 2414;
+ vrLen = 96;
+ vrLoc = 2413;
};
8D01CCC60486CAD60068D4B7 /* Golem */ = {
activeExec = 0;
diff --git a/plugins/MacVST/Golem/Golem.xcodeproj/christopherjohnson.perspectivev3 b/plugins/MacVST/Golem/Golem.xcodeproj/christopherjohnson.perspectivev3
index 62ce38b..0726bc5 100755
--- a/plugins/MacVST/Golem/Golem.xcodeproj/christopherjohnson.perspectivev3
+++ b/plugins/MacVST/Golem/Golem.xcodeproj/christopherjohnson.perspectivev3
@@ -323,7 +323,7 @@
<real>185</real>
</array>
<key>RubberWindowFrame</key>
- <string>23 322 810 487 0 0 1440 878 </string>
+ <string>504 266 810 487 0 0 1440 878 </string>
</dict>
<key>Module</key>
<string>PBXSmartGroupTreeModule</string>
@@ -351,10 +351,10 @@
<key>_historyCapacity</key>
<integer>0</integer>
<key>bookmark</key>
- <string>8BC5D0B2209410C30058B257</string>
+ <string>8B793AF221F579C4006E9731</string>
<key>history</key>
<array>
- <string>8BC5D0B1209410C30058B257</string>
+ <string>8B793AE021F57961006E9731</string>
</array>
</dict>
<key>SplitCount</key>
@@ -368,18 +368,18 @@
<key>GeometryConfiguration</key>
<dict>
<key>Frame</key>
- <string>{{0, 0}, {603, 132}}</string>
+ <string>{{0, 0}, {603, 117}}</string>
<key>RubberWindowFrame</key>
- <string>23 322 810 487 0 0 1440 878 </string>
+ <string>504 266 810 487 0 0 1440 878 </string>
</dict>
<key>Module</key>
<string>PBXNavigatorGroup</string>
<key>Proportion</key>
- <string>132pt</string>
+ <string>117pt</string>
</dict>
<dict>
<key>Proportion</key>
- <string>309pt</string>
+ <string>324pt</string>
<key>Tabs</key>
<array>
<dict>
@@ -393,9 +393,7 @@
<key>GeometryConfiguration</key>
<dict>
<key>Frame</key>
- <string>{{10, 27}, {603, 282}}</string>
- <key>RubberWindowFrame</key>
- <string>23 322 810 487 0 0 1440 878 </string>
+ <string>{{10, 27}, {603, 297}}</string>
</dict>
<key>Module</key>
<string>XCDetailModule</string>
@@ -449,7 +447,9 @@
<key>GeometryConfiguration</key>
<dict>
<key>Frame</key>
- <string>{{10, 27}, {603, 414}}</string>
+ <string>{{10, 27}, {603, 297}}</string>
+ <key>RubberWindowFrame</key>
+ <string>504 266 810 487 0 0 1440 878 </string>
</dict>
<key>Module</key>
<string>PBXBuildResultsModule</string>
@@ -477,11 +477,11 @@
</array>
<key>TableOfContents</key>
<array>
- <string>8BC5D0B3209410C30058B257</string>
+ <string>8B793AF321F579C4006E9731</string>
<string>1CA23ED40692098700951B8B</string>
- <string>8BC5D0B4209410C30058B257</string>
+ <string>8B793AF421F579C4006E9731</string>
<string>8B0237581D42B1C400E1E8C8</string>
- <string>8BC5D0B5209410C30058B257</string>
+ <string>8B793AF521F579C4006E9731</string>
<string>1CA23EDF0692099D00951B8B</string>
<string>1CA23EE00692099D00951B8B</string>
<string>1CA23EE10692099D00951B8B</string>
@@ -634,7 +634,7 @@
<key>StatusbarIsVisible</key>
<true/>
<key>TimeStamp</key>
- <real>546574531.81958306</real>
+ <real>569735620.885432</real>
<key>ToolbarConfigUserDefaultsMinorVersion</key>
<string>2</string>
<key>ToolbarDisplayMode</key>
@@ -654,7 +654,7 @@
<string>/Users/christopherjohnson/Desktop/MacVST/Golem/Golem.xcodeproj</string>
</array>
<key>WindowString</key>
- <string>23 322 810 487 0 0 1440 878 </string>
+ <string>504 266 810 487 0 0 1440 878 </string>
<key>WindowToolsV3</key>
<array>
<dict>
diff --git a/plugins/MacVST/Golem/source/Golem.cpp b/plugins/MacVST/Golem/source/Golem.cpp
index 8f63b48..c99c5cd 100755
--- a/plugins/MacVST/Golem/source/Golem.cpp
+++ b/plugins/MacVST/Golem/source/Golem.cpp
@@ -17,10 +17,8 @@ Golem::Golem(audioMasterCallback audioMaster) :
C = 0.0;
for(count = 0; count < 4098; count++) {p[count] = 0.0;}
count = 0;
- fpNShapeLA = 0.0;
- fpNShapeLB = 0.0;
- fpNShapeRA = 0.0;
- fpNShapeRB = 0.0;
+ fpNShapeL = 0.0;
+ fpNShapeR = 0.0;
flip = true;
//this is reset: values being initialized only once. Startup values, whatever they are.
diff --git a/plugins/MacVST/Golem/source/Golem.h b/plugins/MacVST/Golem/source/Golem.h
index 8bb81d8..e02ab78 100755
--- a/plugins/MacVST/Golem/source/Golem.h
+++ b/plugins/MacVST/Golem/source/Golem.h
@@ -54,10 +54,8 @@ private:
char _programName[kVstMaxProgNameLen + 1];
std::set< std::string > _canDo;
- long double fpNShapeLA;
- long double fpNShapeLB;
- long double fpNShapeRA;
- long double fpNShapeRB;
+ long double fpNShapeL;
+ long double fpNShapeR;
bool flip;
//default stuff
double p[4099];
diff --git a/plugins/MacVST/Golem/source/GolemProc.cpp b/plugins/MacVST/Golem/source/GolemProc.cpp
index 9235869..1d7e9f5 100755
--- a/plugins/MacVST/Golem/source/GolemProc.cpp
+++ b/plugins/MacVST/Golem/source/GolemProc.cpp
@@ -14,9 +14,6 @@ void Golem::processReplacing(float **inputs, float **outputs, VstInt32 sampleFra
float* out1 = outputs[0];
float* out2 = outputs[1];
- float fpTemp;
- long double fpOld = 0.618033988749894848204586; //golden ratio!
- long double fpNew = 1.0 - fpOld;
int phase = (int)((C * 5.999)+1);
double balance = ((A*2.0)-1.0) / 2.0;
double gainL = 0.5 - balance;
@@ -115,25 +112,14 @@ void Golem::processReplacing(float **inputs, float **outputs, VstInt32 sampleFra
inputSampleR = inputSampleL;
//the output is totally mono
- //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;
@@ -152,9 +138,6 @@ void Golem::processDoubleReplacing(double **inputs, double **outputs, VstInt32 s
double* out1 = outputs[0];
double* out2 = outputs[1];
- double fpTemp;
- long double fpOld = 0.618033988749894848204586; //golden ratio!
- long double fpNew = 1.0 - fpOld;
int phase = (int)((C * 5.999)+1);
double balance = ((A*2.0)-1.0) / 2.0;
double gainL = 0.5 - balance;
@@ -253,25 +236,16 @@ void Golem::processDoubleReplacing(double **inputs, double **outputs, VstInt32 s
inputSampleR = inputSampleL;
//the output is totally mono
- //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;