aboutsummaryrefslogtreecommitdiffstats
path: root/plugins/MacAU/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/MacAU/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/MacAU/Golem')
-rwxr-xr-xplugins/MacAU/Golem/Golem.cpp45
-rwxr-xr-xplugins/MacAU/Golem/Golem.h7
-rwxr-xr-xplugins/MacAU/Golem/Golem.xcodeproj/christopherjohnson.pbxuser64
-rwxr-xr-xplugins/MacAU/Golem/Golem.xcodeproj/christopherjohnson.perspectivev335
4 files changed, 61 insertions, 90 deletions
diff --git a/plugins/MacAU/Golem/Golem.cpp b/plugins/MacAU/Golem/Golem.cpp
index 25ac011..e6f1566 100755
--- a/plugins/MacAU/Golem/Golem.cpp
+++ b/plugins/MacAU/Golem/Golem.cpp
@@ -210,11 +210,8 @@ ComponentResult Golem::Reset(AudioUnitScope inScope, AudioUnitElement inElement
{
for(count = 0; count < 4098; count++) {p[count] = 0.0;}
count = 0;
- fpNShapeAL = 0.0;
- fpNShapeBL = 0.0;
- fpNShapeAR = 0.0;
- fpNShapeBR = 0.0;
- flip = false;
+ fpNShapeL = 0.0;
+ fpNShapeR = 0.0;
return noErr;
}
@@ -233,9 +230,6 @@ OSStatus Golem::ProcessBufferLists(AudioUnitRenderActionFlags & ioActionFlags,
Float32 * outputL = (Float32*)(outBuffer.mBuffers[0].mData);
Float32 * outputR = (Float32*)(outBuffer.mBuffers[1].mData);
UInt32 nSampleFrames = inFramesToProcess;
- Float32 fpTemp;
- long double fpOld = 0.618033988749894848204586; //golden ratio!
- long double fpNew = 1.0 - fpOld;
int phase = (int) GetParameter( kParam_Three );
Float64 balance = GetParameter( kParam_One ) / 2.0;
Float64 gainL = 0.5 - balance;
@@ -333,32 +327,15 @@ OSStatus Golem::ProcessBufferLists(AudioUnitRenderActionFlags & ioActionFlags,
inputSampleR = inputSampleL;
//the output is totally mono
- //noise shaping to 32-bit floating point
- if (flip) {
- fpTemp = inputSampleL;
- fpNShapeAL = (fpNShapeAL*fpOld)+((inputSampleL-fpTemp)*fpNew);
- inputSampleL += fpNShapeAL;
-
- fpTemp = inputSampleR;
- fpNShapeAR = (fpNShapeAR*fpOld)+((inputSampleR-fpTemp)*fpNew);
- inputSampleR += fpNShapeAR;
- }
- else {
- fpTemp = inputSampleL;
- fpNShapeBL = (fpNShapeBL*fpOld)+((inputSampleL-fpTemp)*fpNew);
- inputSampleL += fpNShapeBL;
-
- fpTemp = inputSampleR;
- fpNShapeBR = (fpNShapeBR*fpOld)+((inputSampleR-fpTemp)*fpNew);
- inputSampleR += fpNShapeBR;
- }
- flip = !flip;
- //end noise shaping on 32 bit output
-
- *outputL = inputSampleL;
- *outputR = inputSampleR;
- //don't know why we're getting a volume boost, cursed thing
-
+ //stereo 32 bit dither, made small and tidy.
+ int expon; frexpf((Float32)inputSampleL, &expon);
+ long double dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62);
+ inputSampleL += (dither-fpNShapeL); fpNShapeL = dither;
+ frexpf((Float32)inputSampleR, &expon);
+ dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62);
+ inputSampleR += (dither-fpNShapeR); fpNShapeR = dither;
+ //end 32 bit dither
+
*outputL = inputSampleL;
*outputR = inputSampleR;
//We have pointers to increment- every actual value reference has to be to a *value
diff --git a/plugins/MacAU/Golem/Golem.h b/plugins/MacAU/Golem/Golem.h
index ecaeea5..d66b91f 100755
--- a/plugins/MacAU/Golem/Golem.h
+++ b/plugins/MacAU/Golem/Golem.h
@@ -132,11 +132,8 @@ public:
private:
Float64 p[4099];
int count;
- long double fpNShapeAL;
- long double fpNShapeBL;
- long double fpNShapeAR;
- long double fpNShapeBR;
- bool flip;
+ long double fpNShapeL;
+ long double fpNShapeR;
};
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
diff --git a/plugins/MacAU/Golem/Golem.xcodeproj/christopherjohnson.pbxuser b/plugins/MacAU/Golem/Golem.xcodeproj/christopherjohnson.pbxuser
index 9e13ec7..91361ce 100755
--- a/plugins/MacAU/Golem/Golem.xcodeproj/christopherjohnson.pbxuser
+++ b/plugins/MacAU/Golem/Golem.xcodeproj/christopherjohnson.pbxuser
@@ -49,23 +49,43 @@
PBXFileDataSource_Warnings_ColumnID,
);
};
- PBXPerProjectTemplateStateSaveDate = 546574392;
- PBXWorkspaceStateSaveDate = 546574392;
+ PBXPerProjectTemplateStateSaveDate = 569647319;
+ PBXWorkspaceStateSaveDate = 569647319;
};
perUserProjectItems = {
- 8BC5D0B6209410C50058B257 /* PBXTextBookmark */ = 8BC5D0B6209410C50058B257 /* PBXTextBookmark */;
- 8BC5D0B7209410C50058B257 /* PBXTextBookmark */ = 8BC5D0B7209410C50058B257 /* PBXTextBookmark */;
+ 8B792CA721F42166006E9731 /* PBXTextBookmark */ = 8B792CA721F42166006E9731 /* PBXTextBookmark */;
+ 8B792CAC21F42187006E9731 /* PBXTextBookmark */ = 8B792CAC21F42187006E9731 /* PBXTextBookmark */;
};
sourceControlManager = 8BD3CCB8148830B20062E48C /* Source Control */;
userBuildSettings = {
};
};
+ 8B792CA721F42166006E9731 /* PBXTextBookmark */ = {
+ isa = PBXTextBookmark;
+ fRef = 8BA05A660720730100365D66 /* Golem.cpp */;
+ name = "Golem.cpp: 296";
+ rLen = 831;
+ rLoc = 12420;
+ rType = 0;
+ vrLen = 126;
+ vrLoc = 12547;
+ };
+ 8B792CAC21F42187006E9731 /* PBXTextBookmark */ = {
+ isa = PBXTextBookmark;
+ fRef = 8BA05A660720730100365D66 /* Golem.cpp */;
+ name = "Golem.cpp: 296";
+ rLen = 831;
+ rLoc = 12420;
+ rType = 0;
+ vrLen = 126;
+ vrLoc = 12547;
+ };
8BA05A660720730100365D66 /* Golem.cpp */ = {
uiCtxt = {
- sepNavIntBoundsRect = "{{0, 0}, {803, 4979}}";
- sepNavSelRange = "{12592, 831}";
- sepNavVisRange = "{12592, 178}";
- sepNavWindowFrame = "{{702, 65}, {714, 813}}";
+ sepNavIntBoundsRect = "{{0, 0}, {677, 4680}}";
+ sepNavSelRange = "{12420, 831}";
+ sepNavVisRange = "{12547, 126}";
+ sepNavWindowFrame = "{{548, 65}, {714, 813}}";
};
};
8BA05A670720730100365D66 /* Golem.exp */ = {
@@ -84,32 +104,12 @@
sepNavWindowFrame = "{{601, -12}, {877, 831}}";
};
};
- 8BC5D0B6209410C50058B257 /* PBXTextBookmark */ = {
- isa = PBXTextBookmark;
- fRef = 8BA05A660720730100365D66 /* Golem.cpp */;
- name = "Golem.cpp: 302";
- rLen = 831;
- rLoc = 12592;
- rType = 0;
- vrLen = 178;
- vrLoc = 12592;
- };
- 8BC5D0B7209410C50058B257 /* PBXTextBookmark */ = {
- isa = PBXTextBookmark;
- fRef = 8BA05A660720730100365D66 /* Golem.cpp */;
- name = "Golem.cpp: 302";
- rLen = 831;
- rLoc = 12592;
- rType = 0;
- vrLen = 178;
- vrLoc = 12592;
- };
8BC6025B073B072D006C4272 /* Golem.h */ = {
uiCtxt = {
- sepNavIntBoundsRect = "{{0, 0}, {974, 1885}}";
- sepNavSelRange = "{5566, 30}";
- sepNavVisRange = "{1674, 2178}";
- sepNavWindowFrame = "{{655, 43}, {1021, 800}}";
+ sepNavIntBoundsRect = "{{0, 0}, {974, 1833}}";
+ sepNavSelRange = "{5596, 0}";
+ sepNavVisRange = "{4025, 1724}";
+ sepNavWindowFrame = "{{419, 43}, {1021, 800}}";
};
};
8BD3CCB8148830B20062E48C /* Source Control */ = {
diff --git a/plugins/MacAU/Golem/Golem.xcodeproj/christopherjohnson.perspectivev3 b/plugins/MacAU/Golem/Golem.xcodeproj/christopherjohnson.perspectivev3
index c96e719..30ddbd9 100755
--- a/plugins/MacAU/Golem/Golem.xcodeproj/christopherjohnson.perspectivev3
+++ b/plugins/MacAU/Golem/Golem.xcodeproj/christopherjohnson.perspectivev3
@@ -256,8 +256,6 @@
<key>Layout</key>
<array>
<dict>
- <key>BecomeActive</key>
- <true/>
<key>ContentConfiguration</key>
<dict>
<key>PBXBottomSmartGroupGIDs</key>
@@ -324,7 +322,7 @@
<real>185</real>
</array>
<key>RubberWindowFrame</key>
- <string>619 304 810 487 0 0 1440 878 </string>
+ <string>478 304 810 487 0 0 1440 878 </string>
</dict>
<key>Module</key>
<string>PBXSmartGroupTreeModule</string>
@@ -352,10 +350,10 @@
<key>_historyCapacity</key>
<integer>0</integer>
<key>bookmark</key>
- <string>8BC5D0B7209410C50058B257</string>
+ <string>8B792CAC21F42187006E9731</string>
<key>history</key>
<array>
- <string>8BC5D0B6209410C50058B257</string>
+ <string>8B792CA721F42166006E9731</string>
</array>
</dict>
<key>SplitCount</key>
@@ -369,18 +367,18 @@
<key>GeometryConfiguration</key>
<dict>
<key>Frame</key>
- <string>{{0, 0}, {603, 132}}</string>
+ <string>{{0, 0}, {603, 117}}</string>
<key>RubberWindowFrame</key>
- <string>619 304 810 487 0 0 1440 878 </string>
+ <string>478 304 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>
@@ -394,9 +392,7 @@
<key>GeometryConfiguration</key>
<dict>
<key>Frame</key>
- <string>{{10, 27}, {603, 282}}</string>
- <key>RubberWindowFrame</key>
- <string>619 304 810 487 0 0 1440 878 </string>
+ <string>{{10, 27}, {603, 297}}</string>
</dict>
<key>Module</key>
<string>XCDetailModule</string>
@@ -450,7 +446,9 @@
<key>GeometryConfiguration</key>
<dict>
<key>Frame</key>
- <string>{{10, 27}, {603, 414}}</string>
+ <string>{{10, 27}, {603, 297}}</string>
+ <key>RubberWindowFrame</key>
+ <string>478 304 810 487 0 0 1440 878 </string>
</dict>
<key>Module</key>
<string>PBXBuildResultsModule</string>
@@ -478,11 +476,11 @@
</array>
<key>TableOfContents</key>
<array>
- <string>8BC5D0B8209410C50058B257</string>
+ <string>8B792CAD21F42187006E9731</string>
<string>1CA23ED40692098700951B8B</string>
- <string>8BC5D0B9209410C50058B257</string>
+ <string>8B792CAE21F42187006E9731</string>
<string>8B8D6996207ABA9A0029B7B0</string>
- <string>8BC5D0BA209410C50058B257</string>
+ <string>8B792CAF21F42187006E9731</string>
<string>1CA23EDF0692099D00951B8B</string>
<string>1CA23EE00692099D00951B8B</string>
<string>1CA23EE10692099D00951B8B</string>
@@ -635,7 +633,7 @@
<key>StatusbarIsVisible</key>
<true/>
<key>TimeStamp</key>
- <real>546574533.255705</real>
+ <real>569647495.88627398</real>
<key>ToolbarConfigUserDefaultsMinorVersion</key>
<string>2</string>
<key>ToolbarDisplayMode</key>
@@ -652,11 +650,10 @@
<integer>5</integer>
<key>WindowOrderList</key>
<array>
- <string>8BC5D0BB209410C50058B257</string>
<string>/Users/christopherjohnson/Desktop/MacAU/Golem/Golem.xcodeproj</string>
</array>
<key>WindowString</key>
- <string>619 304 810 487 0 0 1440 878 </string>
+ <string>478 304 810 487 0 0 1440 878 </string>
<key>WindowToolsV3</key>
<array>
<dict>