aboutsummaryrefslogtreecommitdiffstats
path: root/plugins/MacAU/SideDull
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/SideDull
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/SideDull')
-rwxr-xr-xplugins/MacAU/SideDull/SideDull.cpp41
-rwxr-xr-xplugins/MacAU/SideDull/SideDull.h7
-rwxr-xr-xplugins/MacAU/SideDull/SideDull.xcodeproj/christopherjohnson.pbxuser70
-rwxr-xr-xplugins/MacAU/SideDull/SideDull.xcodeproj/christopherjohnson.perspectivev353
4 files changed, 73 insertions, 98 deletions
diff --git a/plugins/MacAU/SideDull/SideDull.cpp b/plugins/MacAU/SideDull/SideDull.cpp
index 72793e5..2b75d72 100755
--- a/plugins/MacAU/SideDull/SideDull.cpp
+++ b/plugins/MacAU/SideDull/SideDull.cpp
@@ -176,11 +176,8 @@ ComponentResult SideDull::Reset(AudioUnitScope inScope, AudioUnitElement inElem
iirSampleA = 0.0;
iirSampleB = 0.0;
flip = true;
- fpNShapeAL = 0.0;
- fpNShapeBL = 0.0;
- fpNShapeAR = 0.0;
- fpNShapeBR = 0.0;
-
+ fpNShapeL = 0.0;
+ fpNShapeR = 0.0;
return noErr;
}
@@ -209,10 +206,6 @@ OSStatus SideDull::ProcessBufferLists(AudioUnitRenderActionFlags & ioActionFlag
overallscale *= GetSampleRate();
Float64 iirAmount = pow(GetParameter( kParam_One ),3)/overallscale;
- Float32 fpTemp;
- Float64 fpOld = 0.618033988749894848204586; //golden ratio!
- Float64 fpNew = 1.0 - fpOld;
-
while (nSampleFrames-- > 0) {
inputSampleL = *inputL;
inputSampleR = *inputR;
@@ -273,28 +266,16 @@ OSStatus SideDull::ProcessBufferLists(AudioUnitRenderActionFlags & ioActionFlag
inputSampleL = (mid+side)/2.0;
inputSampleR = (mid-side)/2.0;
-
- //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
+
+ //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;
diff --git a/plugins/MacAU/SideDull/SideDull.h b/plugins/MacAU/SideDull/SideDull.h
index 450a5f3..85fd8d5 100755
--- a/plugins/MacAU/SideDull/SideDull.h
+++ b/plugins/MacAU/SideDull/SideDull.h
@@ -112,11 +112,8 @@ private:
Float64 iirSampleA;
Float64 iirSampleB;
bool flip;
- long double fpNShapeAL;
- long double fpNShapeBL;
- long double fpNShapeAR;
- long double fpNShapeBR;
-
+ long double fpNShapeL;
+ long double fpNShapeR;
};
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
diff --git a/plugins/MacAU/SideDull/SideDull.xcodeproj/christopherjohnson.pbxuser b/plugins/MacAU/SideDull/SideDull.xcodeproj/christopherjohnson.pbxuser
index 6bdc1d7..c5161bd 100755
--- a/plugins/MacAU/SideDull/SideDull.xcodeproj/christopherjohnson.pbxuser
+++ b/plugins/MacAU/SideDull/SideDull.xcodeproj/christopherjohnson.pbxuser
@@ -12,7 +12,7 @@
PBXFileTableDataSourceColumnSortingKey = PBXFileDataSource_Filename_ColumnID;
PBXFileTableDataSourceColumnWidthsKey = (
20,
- 292,
+ 417,
20,
48,
43,
@@ -51,45 +51,55 @@
PBXFileDataSource_Warnings_ColumnID,
);
};
- PBXPerProjectTemplateStateSaveDate = 528457832;
- PBXWorkspaceStateSaveDate = 528457832;
+ PBXPerProjectTemplateStateSaveDate = 569678436;
+ PBXWorkspaceStateSaveDate = 569678436;
};
perUserProjectItems = {
- 8B9D66D91F7C8E9B007AB60F /* PBXTextBookmark */ = 8B9D66D91F7C8E9B007AB60F /* PBXTextBookmark */;
- 8B9D75DC1F7FA07D007AB60F /* PBXTextBookmark */ = 8B9D75DC1F7FA07D007AB60F /* PBXTextBookmark */;
+ 8B792FB921F49AD2006E9731 /* PBXTextBookmark */ = 8B792FB921F49AD2006E9731 /* PBXTextBookmark */;
+ 8B792FBB21F49AD2006E9731 /* PBXTextBookmark */ = 8B792FBB21F49AD2006E9731 /* PBXTextBookmark */;
+ 8B792FC021F49AEA006E9731 /* PBXTextBookmark */ = 8B792FC021F49AEA006E9731 /* PBXTextBookmark */;
8BD4F5851E6E0EED00288155 /* PlistBookmark */ = 8BD4F5851E6E0EED00288155 /* PlistBookmark */;
8BD4F5861E6E0EED00288155 /* PBXTextBookmark */ = 8BD4F5861E6E0EED00288155 /* PBXTextBookmark */;
- 8BD4F5871E6E0EED00288155 /* PBXTextBookmark */ = 8BD4F5871E6E0EED00288155 /* PBXTextBookmark */;
};
sourceControlManager = 8BD3CCB8148830B20062E48C /* Source Control */;
userBuildSettings = {
};
};
- 8B9D66D91F7C8E9B007AB60F /* PBXTextBookmark */ = {
+ 8B792FB921F49AD2006E9731 /* PBXTextBookmark */ = {
isa = PBXTextBookmark;
fRef = 8BC6025B073B072D006C4272 /* SideDull.h */;
- name = "SideDull.h: 112";
- rLen = 156;
- rLoc = 4786;
+ name = "SideDull.h: 117";
+ rLen = 0;
+ rLoc = 4888;
rType = 0;
- vrLen = 353;
- vrLoc = 2712;
+ vrLen = 1036;
+ vrLoc = 3957;
};
- 8B9D75DC1F7FA07D007AB60F /* PBXTextBookmark */ = {
+ 8B792FBB21F49AD2006E9731 /* PBXTextBookmark */ = {
isa = PBXTextBookmark;
- fRef = 8BC6025B073B072D006C4272 /* SideDull.h */;
- name = "SideDull.h: 112";
- rLen = 156;
- rLoc = 4786;
+ fRef = 8BA05A660720730100365D66 /* SideDull.cpp */;
+ name = "SideDull.cpp: 279";
+ rLen = 0;
+ rLoc = 11462;
rType = 0;
- vrLen = 330;
- vrLoc = 2735;
+ vrLen = 843;
+ vrLoc = 10824;
+ };
+ 8B792FC021F49AEA006E9731 /* PBXTextBookmark */ = {
+ isa = PBXTextBookmark;
+ fRef = 8BA05A660720730100365D66 /* SideDull.cpp */;
+ name = "SideDull.cpp: 279";
+ rLen = 0;
+ rLoc = 11462;
+ rType = 0;
+ vrLen = 850;
+ vrLoc = 10817;
};
8BA05A660720730100365D66 /* SideDull.cpp */ = {
uiCtxt = {
- sepNavIntBoundsRect = "{{0, 0}, {977, 4225}}";
- sepNavSelRange = "{9554, 0}";
- sepNavVisRange = "{8740, 2240}";
+ sepNavIntBoundsRect = "{{0, 0}, {691, 3965}}";
+ sepNavSelRange = "{11462, 0}";
+ sepNavVisRange = "{10817, 850}";
sepNavWindowFrame = "{{416, 39}, {1024, 839}}";
};
};
@@ -103,9 +113,9 @@
};
8BC6025B073B072D006C4272 /* SideDull.h */ = {
uiCtxt = {
- sepNavIntBoundsRect = "{{0, 0}, {894, 1859}}";
- sepNavSelRange = "{4786, 156}";
- sepNavVisRange = "{2735, 330}";
+ sepNavIntBoundsRect = "{{0, 0}, {894, 1781}}";
+ sepNavSelRange = "{4888, 0}";
+ sepNavVisRange = "{3957, 1036}";
sepNavWindowFrame = "{{15, 39}, {1024, 839}}";
};
};
@@ -145,16 +155,6 @@
vrLen = 510;
vrLoc = 2430;
};
- 8BD4F5871E6E0EED00288155 /* PBXTextBookmark */ = {
- isa = PBXTextBookmark;
- fRef = 8BA05A660720730100365D66 /* SideDull.cpp */;
- name = "SideDull.cpp: 176";
- rLen = 128;
- rLoc = 7544;
- rType = 0;
- vrLen = 794;
- vrLoc = 7693;
- };
8D01CCC60486CAD60068D4B7 /* SideDull */ = {
activeExec = 0;
};
diff --git a/plugins/MacAU/SideDull/SideDull.xcodeproj/christopherjohnson.perspectivev3 b/plugins/MacAU/SideDull/SideDull.xcodeproj/christopherjohnson.perspectivev3
index 5e89369..dc70f61 100755
--- a/plugins/MacAU/SideDull/SideDull.xcodeproj/christopherjohnson.perspectivev3
+++ b/plugins/MacAU/SideDull/SideDull.xcodeproj/christopherjohnson.perspectivev3
@@ -256,8 +256,6 @@
<key>Layout</key>
<array>
<dict>
- <key>BecomeActive</key>
- <true/>
<key>ContentConfiguration</key>
<dict>
<key>PBXBottomSmartGroupGIDs</key>
@@ -282,7 +280,7 @@
<dict>
<key>PBXSmartGroupTreeModuleColumnWidthsKey</key>
<array>
- <real>288</real>
+ <real>163</real>
</array>
<key>PBXSmartGroupTreeModuleColumnsKey_v4</key>
<array>
@@ -308,7 +306,7 @@
</array>
</array>
<key>PBXSmartGroupTreeModuleOutlineStateVisibleRectKey</key>
- <string>{{0, 0}, {288, 595}}</string>
+ <string>{{0, 0}, {163, 595}}</string>
</dict>
<key>PBXTopSmartGroupGIDs</key>
<array/>
@@ -318,19 +316,19 @@
<key>GeometryConfiguration</key>
<dict>
<key>Frame</key>
- <string>{{0, 0}, {305, 613}}</string>
+ <string>{{0, 0}, {180, 613}}</string>
<key>GroupTreeTableConfiguration</key>
<array>
<string>MainColumn</string>
- <real>288</real>
+ <real>163</real>
</array>
<key>RubberWindowFrame</key>
- <string>599 124 841 654 0 0 1440 878 </string>
+ <string>430 195 841 654 0 0 1440 878 </string>
</dict>
<key>Module</key>
<string>PBXSmartGroupTreeModule</string>
<key>Proportion</key>
- <string>305pt</string>
+ <string>180pt</string>
</dict>
<dict>
<key>Dock</key>
@@ -341,7 +339,7 @@
<key>PBXProjectModuleGUID</key>
<string>8BD7274A1D46E5A5000176F0</string>
<key>PBXProjectModuleLabel</key>
- <string>SideDull.h</string>
+ <string>SideDull.cpp</string>
<key>PBXSplitModuleInNavigatorKey</key>
<dict>
<key>Split0</key>
@@ -349,17 +347,17 @@
<key>PBXProjectModuleGUID</key>
<string>8BD7274B1D46E5A5000176F0</string>
<key>PBXProjectModuleLabel</key>
- <string>SideDull.h</string>
+ <string>SideDull.cpp</string>
<key>_historyCapacity</key>
<integer>0</integer>
<key>bookmark</key>
- <string>8B9D75DC1F7FA07D007AB60F</string>
+ <string>8B792FC021F49AEA006E9731</string>
<key>history</key>
<array>
<string>8BD4F5851E6E0EED00288155</string>
<string>8BD4F5861E6E0EED00288155</string>
- <string>8BD4F5871E6E0EED00288155</string>
- <string>8B9D66D91F7C8E9B007AB60F</string>
+ <string>8B792FB921F49AD2006E9731</string>
+ <string>8B792FBB21F49AD2006E9731</string>
</array>
</dict>
<key>SplitCount</key>
@@ -373,18 +371,18 @@
<key>GeometryConfiguration</key>
<dict>
<key>Frame</key>
- <string>{{0, 0}, {531, 229}}</string>
+ <string>{{0, 0}, {656, 436}}</string>
<key>RubberWindowFrame</key>
- <string>599 124 841 654 0 0 1440 878 </string>
+ <string>430 195 841 654 0 0 1440 878 </string>
</dict>
<key>Module</key>
<string>PBXNavigatorGroup</string>
<key>Proportion</key>
- <string>229pt</string>
+ <string>436pt</string>
</dict>
<dict>
<key>Proportion</key>
- <string>379pt</string>
+ <string>172pt</string>
<key>Tabs</key>
<array>
<dict>
@@ -398,9 +396,7 @@
<key>GeometryConfiguration</key>
<dict>
<key>Frame</key>
- <string>{{10, 27}, {531, 352}}</string>
- <key>RubberWindowFrame</key>
- <string>599 124 841 654 0 0 1440 878 </string>
+ <string>{{10, 27}, {656, 365}}</string>
</dict>
<key>Module</key>
<string>XCDetailModule</string>
@@ -454,7 +450,9 @@
<key>GeometryConfiguration</key>
<dict>
<key>Frame</key>
- <string>{{10, 27}, {531, 315}}</string>
+ <string>{{10, 27}, {656, 145}}</string>
+ <key>RubberWindowFrame</key>
+ <string>430 195 841 654 0 0 1440 878 </string>
</dict>
<key>Module</key>
<string>PBXBuildResultsModule</string>
@@ -463,7 +461,7 @@
</dict>
</array>
<key>Proportion</key>
- <string>531pt</string>
+ <string>656pt</string>
</dict>
</array>
<key>Name</key>
@@ -482,11 +480,11 @@
</array>
<key>TableOfContents</key>
<array>
- <string>8B9D75DD1F7FA07D007AB60F</string>
+ <string>8B792FC121F49AEA006E9731</string>
<string>1CA23ED40692098700951B8B</string>
- <string>8B9D75DE1F7FA07D007AB60F</string>
+ <string>8B792FC221F49AEA006E9731</string>
<string>8BD7274A1D46E5A5000176F0</string>
- <string>8B9D75DF1F7FA07D007AB60F</string>
+ <string>8B792FC321F49AEA006E9731</string>
<string>1CA23EDF0692099D00951B8B</string>
<string>1CA23EE00692099D00951B8B</string>
<string>1CA23EE10692099D00951B8B</string>
@@ -659,7 +657,7 @@
<key>StatusbarIsVisible</key>
<true/>
<key>TimeStamp</key>
- <real>528457853.78940398</real>
+ <real>569678570.12103295</real>
<key>ToolbarConfigUserDefaultsMinorVersion</key>
<string>2</string>
<key>ToolbarDisplayMode</key>
@@ -676,11 +674,10 @@
<integer>5</integer>
<key>WindowOrderList</key>
<array>
- <string>8B9D75E01F7FA07D007AB60F</string>
<string>/Users/christopherjohnson/Desktop/MacAU/SideDull/SideDull.xcodeproj</string>
</array>
<key>WindowString</key>
- <string>599 124 841 654 0 0 1440 878 </string>
+ <string>430 195 841 654 0 0 1440 878 </string>
<key>WindowToolsV3</key>
<array>
<dict>