aboutsummaryrefslogtreecommitdiffstats
path: root/plugins/MacAU/EdIsDim
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/EdIsDim
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/EdIsDim')
-rwxr-xr-xplugins/MacAU/EdIsDim/EdIsDim.cpp38
-rwxr-xr-xplugins/MacAU/EdIsDim/EdIsDim.h7
-rwxr-xr-xplugins/MacAU/EdIsDim/EdIsDim.xcodeproj/christopherjohnson.pbxuser46
-rwxr-xr-xplugins/MacAU/EdIsDim/EdIsDim.xcodeproj/christopherjohnson.perspectivev339
4 files changed, 53 insertions, 77 deletions
diff --git a/plugins/MacAU/EdIsDim/EdIsDim.cpp b/plugins/MacAU/EdIsDim/EdIsDim.cpp
index 164f8df..e9d2e23 100755
--- a/plugins/MacAU/EdIsDim/EdIsDim.cpp
+++ b/plugins/MacAU/EdIsDim/EdIsDim.cpp
@@ -171,11 +171,8 @@ ComponentResult EdIsDim::Initialize()
// this is called the reset the DSP state (clear buffers, reset counters, etc.)
ComponentResult EdIsDim::Reset(AudioUnitScope inScope, AudioUnitElement inElement)
{
- fpNShapeLA = 0.0;
- fpNShapeLB = 0.0;
- fpNShapeRA = 0.0;
- fpNShapeRB = 0.0;
- fpFlip = true;
+ fpNShapeL = 0.0;
+ fpNShapeR = 0.0;
return noErr;
}
@@ -194,10 +191,6 @@ OSStatus EdIsDim::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;
long double inputSampleL;
long double inputSampleR;
@@ -256,25 +249,14 @@ OSStatus EdIsDim::ProcessBufferLists(AudioUnitRenderActionFlags & ioActionFlags
mid = (inputSampleL+inputSampleR)/2.0;
side = (inputSampleL-inputSampleR)/2.0;
- //noise shaping to 32-bit floating point
- if (fpFlip) {
- fpTemp = mid;
- fpNShapeLA = (fpNShapeLA*fpOld)+((mid-fpTemp)*fpNew);
- mid += fpNShapeLA;
- fpTemp = side;
- fpNShapeRA = (fpNShapeRA*fpOld)+((side-fpTemp)*fpNew);
- side += fpNShapeRA;
- }
- else {
- fpTemp = mid;
- fpNShapeLB = (fpNShapeLB*fpOld)+((mid-fpTemp)*fpNew);
- mid += fpNShapeLB;
- fpTemp = side;
- fpNShapeRB = (fpNShapeRB*fpOld)+((side-fpTemp)*fpNew);
- side += fpNShapeRB;
- }
- fpFlip = !fpFlip;
- //end noise shaping on 32 bit output
+ //stereo 32 bit dither, made small and tidy.
+ int expon; frexpf((Float32)mid, &expon);
+ long double dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62);
+ mid += (dither-fpNShapeL); fpNShapeL = dither;
+ frexpf((Float32)side, &expon);
+ dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62);
+ side += (dither-fpNShapeR); fpNShapeR = dither;
+ //end 32 bit dither
*outputL = mid;
*outputR = side;
diff --git a/plugins/MacAU/EdIsDim/EdIsDim.h b/plugins/MacAU/EdIsDim/EdIsDim.h
index 6646778..e5d5e46 100755
--- a/plugins/MacAU/EdIsDim/EdIsDim.h
+++ b/plugins/MacAU/EdIsDim/EdIsDim.h
@@ -111,11 +111,8 @@ public:
virtual ComponentResult Version() { return kEdIsDimVersion; }
private:
- long double fpNShapeLA;
- long double fpNShapeLB;
- long double fpNShapeRA;
- long double fpNShapeRB;
- bool fpFlip;
+ long double fpNShapeL;
+ long double fpNShapeR;
//default stuff
};
diff --git a/plugins/MacAU/EdIsDim/EdIsDim.xcodeproj/christopherjohnson.pbxuser b/plugins/MacAU/EdIsDim/EdIsDim.xcodeproj/christopherjohnson.pbxuser
index dd54e22..0eaeffc 100755
--- a/plugins/MacAU/EdIsDim/EdIsDim.xcodeproj/christopherjohnson.pbxuser
+++ b/plugins/MacAU/EdIsDim/EdIsDim.xcodeproj/christopherjohnson.pbxuser
@@ -49,43 +49,43 @@
PBXFileDataSource_Warnings_ColumnID,
);
};
- PBXPerProjectTemplateStateSaveDate = 528456036;
- PBXWorkspaceStateSaveDate = 528456036;
+ PBXPerProjectTemplateStateSaveDate = 569602369;
+ PBXWorkspaceStateSaveDate = 569602369;
};
perUserProjectItems = {
- 8B9D649D1F7C85BA007AB60F /* PBXTextBookmark */ = 8B9D649D1F7C85BA007AB60F /* PBXTextBookmark */;
- 8B9D740C1F7F99CD007AB60F /* PBXTextBookmark */ = 8B9D740C1F7F99CD007AB60F /* PBXTextBookmark */;
+ 8B792B9E21F371C6006E9731 /* PBXTextBookmark */ = 8B792B9E21F371C6006E9731 /* PBXTextBookmark */;
+ 8B792BA321F371D7006E9731 /* PBXTextBookmark */ = 8B792BA321F371D7006E9731 /* PBXTextBookmark */;
};
sourceControlManager = 8BD3CCB8148830B20062E48C /* Source Control */;
userBuildSettings = {
};
};
- 8B9D649D1F7C85BA007AB60F /* PBXTextBookmark */ = {
+ 8B792B9E21F371C6006E9731 /* PBXTextBookmark */ = {
isa = PBXTextBookmark;
fRef = 8BA05A660720730100365D66 /* EdIsDim.cpp */;
- name = "EdIsDim.cpp: 253";
- rLen = 710;
- rLoc = 10830;
+ name = "EdIsDim.cpp: 260";
+ rLen = 0;
+ rLoc = 11194;
rType = 0;
- vrLen = 437;
- vrLoc = 8933;
+ vrLen = 150;
+ vrLoc = 9250;
};
- 8B9D740C1F7F99CD007AB60F /* PBXTextBookmark */ = {
+ 8B792BA321F371D7006E9731 /* PBXTextBookmark */ = {
isa = PBXTextBookmark;
fRef = 8BA05A660720730100365D66 /* EdIsDim.cpp */;
- name = "EdIsDim.cpp: 253";
- rLen = 710;
- rLoc = 10830;
+ name = "EdIsDim.cpp: 260";
+ rLen = 0;
+ rLoc = 11194;
rType = 0;
- vrLen = 382;
- vrLoc = 8988;
+ vrLen = 150;
+ vrLoc = 9250;
};
8BA05A660720730100365D66 /* EdIsDim.cpp */ = {
uiCtxt = {
- sepNavIntBoundsRect = "{{0, 0}, {691, 3770}}";
- sepNavSelRange = "{10830, 710}";
- sepNavVisRange = "{8988, 382}";
- sepNavWindowFrame = "{{370, 39}, {1070, 811}}";
+ sepNavIntBoundsRect = "{{0, 0}, {691, 3640}}";
+ sepNavSelRange = "{11194, 0}";
+ sepNavVisRange = "{9250, 150}";
+ sepNavWindowFrame = "{{182, 67}, {1070, 811}}";
};
};
8BA05A670720730100365D66 /* EdIsDim.exp */ = {
@@ -106,9 +106,9 @@
};
8BC6025B073B072D006C4272 /* EdIsDim.h */ = {
uiCtxt = {
- sepNavIntBoundsRect = "{{0, 0}, {922, 1638}}";
- sepNavSelRange = "{2966, 8}";
- sepNavVisRange = "{3189, 1845}";
+ sepNavIntBoundsRect = "{{0, 0}, {922, 1599}}";
+ sepNavSelRange = "{4844, 0}";
+ sepNavVisRange = "{3126, 1842}";
sepNavWindowFrame = "{{376, 41}, {923, 837}}";
};
};
diff --git a/plugins/MacAU/EdIsDim/EdIsDim.xcodeproj/christopherjohnson.perspectivev3 b/plugins/MacAU/EdIsDim/EdIsDim.xcodeproj/christopherjohnson.perspectivev3
index 500b578..187be5c 100755
--- a/plugins/MacAU/EdIsDim/EdIsDim.xcodeproj/christopherjohnson.perspectivev3
+++ b/plugins/MacAU/EdIsDim/EdIsDim.xcodeproj/christopherjohnson.perspectivev3
@@ -225,8 +225,8 @@
<array/>
<key>PerspectiveWidths</key>
<array>
- <integer>-1</integer>
- <integer>-1</integer>
+ <integer>810</integer>
+ <integer>810</integer>
</array>
<key>Perspectives</key>
<array>
@@ -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>622 330 810 487 0 0 1440 878 </string>
+ <string>457 331 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>8B9D740C1F7F99CD007AB60F</string>
+ <string>8B792BA321F371D7006E9731</string>
<key>history</key>
<array>
- <string>8B9D649D1F7C85BA007AB60F</string>
+ <string>8B792B9E21F371C6006E9731</string>
</array>
</dict>
<key>SplitCount</key>
@@ -369,18 +367,18 @@
<key>GeometryConfiguration</key>
<dict>
<key>Frame</key>
- <string>{{0, 0}, {603, 86}}</string>
+ <string>{{0, 0}, {603, 69}}</string>
<key>RubberWindowFrame</key>
- <string>622 330 810 487 0 0 1440 878 </string>
+ <string>457 331 810 487 0 0 1440 878 </string>
</dict>
<key>Module</key>
<string>PBXNavigatorGroup</string>
<key>Proportion</key>
- <string>86pt</string>
+ <string>69pt</string>
</dict>
<dict>
<key>Proportion</key>
- <string>355pt</string>
+ <string>372pt</string>
<key>Tabs</key>
<array>
<dict>
@@ -394,9 +392,7 @@
<key>GeometryConfiguration</key>
<dict>
<key>Frame</key>
- <string>{{10, 27}, {603, 328}}</string>
- <key>RubberWindowFrame</key>
- <string>622 330 810 487 0 0 1440 878 </string>
+ <string>{{10, 27}, {603, 345}}</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, 345}}</string>
+ <key>RubberWindowFrame</key>
+ <string>457 331 810 487 0 0 1440 878 </string>
</dict>
<key>Module</key>
<string>PBXBuildResultsModule</string>
@@ -478,11 +476,11 @@
</array>
<key>TableOfContents</key>
<array>
- <string>8B9D740D1F7F99CD007AB60F</string>
+ <string>8B792BA421F371D7006E9731</string>
<string>1CA23ED40692098700951B8B</string>
- <string>8B9D740E1F7F99CD007AB60F</string>
+ <string>8B792BA521F371D7006E9731</string>
<string>8B753E4E1E40210F00347157</string>
- <string>8B9D740F1F7F99CD007AB60F</string>
+ <string>8B792BA621F371D7006E9731</string>
<string>1CA23EDF0692099D00951B8B</string>
<string>1CA23EE00692099D00951B8B</string>
<string>1CA23EE10692099D00951B8B</string>
@@ -635,7 +633,7 @@
<key>StatusbarIsVisible</key>
<true/>
<key>TimeStamp</key>
- <real>528456141.63520998</real>
+ <real>569602519.02649903</real>
<key>ToolbarConfigUserDefaultsMinorVersion</key>
<string>2</string>
<key>ToolbarDisplayMode</key>
@@ -652,11 +650,10 @@
<integer>5</integer>
<key>WindowOrderList</key>
<array>
- <string>8B9D74101F7F99CD007AB60F</string>
<string>/Users/christopherjohnson/Desktop/MacAU/EdIsDim/EdIsDim.xcodeproj</string>
</array>
<key>WindowString</key>
- <string>622 330 810 487 0 0 1440 878 </string>
+ <string>457 331 810 487 0 0 1440 878 </string>
<key>WindowToolsV3</key>
<array>
<dict>