aboutsummaryrefslogtreecommitdiffstats
path: root/plugins/MacAU/MidSide
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/MidSide
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/MidSide')
-rwxr-xr-xplugins/MacAU/MidSide/MidSide.cpp40
-rwxr-xr-xplugins/MacAU/MidSide/MidSide.h7
-rwxr-xr-xplugins/MacAU/MidSide/MidSide.xcodeproj/christopherjohnson.pbxuser44
-rwxr-xr-xplugins/MacAU/MidSide/MidSide.xcodeproj/christopherjohnson.perspectivev339
4 files changed, 53 insertions, 77 deletions
diff --git a/plugins/MacAU/MidSide/MidSide.cpp b/plugins/MacAU/MidSide/MidSide.cpp
index 32dfa00..8330aa1 100755
--- a/plugins/MacAU/MidSide/MidSide.cpp
+++ b/plugins/MacAU/MidSide/MidSide.cpp
@@ -171,11 +171,8 @@ ComponentResult MidSide::Initialize()
// this is called the reset the DSP state (clear buffers, reset counters, etc.)
ComponentResult MidSide::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,11 +191,7 @@ OSStatus MidSide::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;
long double mid;
@@ -256,25 +249,14 @@ OSStatus MidSide::ProcessBufferLists(AudioUnitRenderActionFlags & ioActionFlags
mid *= midgain;
side *= sidegain;
- //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/MidSide/MidSide.h b/plugins/MacAU/MidSide/MidSide.h
index 9d78006..643457a 100755
--- a/plugins/MacAU/MidSide/MidSide.h
+++ b/plugins/MacAU/MidSide/MidSide.h
@@ -111,11 +111,8 @@ public:
virtual ComponentResult Version() { return kMidSideVersion; }
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/MidSide/MidSide.xcodeproj/christopherjohnson.pbxuser b/plugins/MacAU/MidSide/MidSide.xcodeproj/christopherjohnson.pbxuser
index 4bb0c76..854d5ed 100755
--- a/plugins/MacAU/MidSide/MidSide.xcodeproj/christopherjohnson.pbxuser
+++ b/plugins/MacAU/MidSide/MidSide.xcodeproj/christopherjohnson.pbxuser
@@ -49,43 +49,43 @@
PBXFileDataSource_Warnings_ColumnID,
);
};
- PBXPerProjectTemplateStateSaveDate = 528457068;
- PBXWorkspaceStateSaveDate = 528457068;
+ PBXPerProjectTemplateStateSaveDate = 569650825;
+ PBXWorkspaceStateSaveDate = 569650825;
};
perUserProjectItems = {
- 8B9D65B91F7C8B49007AB60F /* PBXTextBookmark */ = 8B9D65B91F7C8B49007AB60F /* PBXTextBookmark */;
- 8B9D74FF1F7F9D7C007AB60F /* PBXTextBookmark */ = 8B9D74FF1F7F9D7C007AB60F /* PBXTextBookmark */;
+ 8B792E1621F42F27006E9731 /* PBXTextBookmark */ = 8B792E1621F42F27006E9731 /* PBXTextBookmark */;
+ 8B792E1B21F42F3C006E9731 /* PBXTextBookmark */ = 8B792E1B21F42F3C006E9731 /* PBXTextBookmark */;
};
sourceControlManager = 8BD3CCB8148830B20062E48C /* Source Control */;
userBuildSettings = {
};
};
- 8B9D65B91F7C8B49007AB60F /* PBXTextBookmark */ = {
+ 8B792E1621F42F27006E9731 /* PBXTextBookmark */ = {
isa = PBXTextBookmark;
fRef = 8BA05A660720730100365D66 /* MidSide.cpp */;
- name = "MidSide.cpp: 179";
+ name = "MidSide.cpp: 176";
rLen = 0;
- rLoc = 7698;
+ rLoc = 7642;
rType = 0;
- vrLen = 71;
- vrLoc = 7644;
+ vrLen = 4;
+ vrLoc = 7657;
};
- 8B9D74FF1F7F9D7C007AB60F /* PBXTextBookmark */ = {
+ 8B792E1B21F42F3C006E9731 /* PBXTextBookmark */ = {
isa = PBXTextBookmark;
fRef = 8BA05A660720730100365D66 /* MidSide.cpp */;
- name = "MidSide.cpp: 179";
+ name = "MidSide.cpp: 176";
rLen = 0;
- rLoc = 7698;
+ rLoc = 7642;
rType = 0;
- vrLen = 33;
- vrLoc = 7682;
+ vrLen = 3;
+ vrLoc = 7657;
};
8BA05A660720730100365D66 /* MidSide.cpp */ = {
uiCtxt = {
- sepNavIntBoundsRect = "{{0, 0}, {656, 3848}}";
- sepNavSelRange = "{7698, 0}";
- sepNavVisRange = "{7682, 33}";
- sepNavWindowFrame = "{{370, 56}, {1070, 811}}";
+ sepNavIntBoundsRect = "{{0, 0}, {656, 3770}}";
+ sepNavSelRange = "{7642, 0}";
+ sepNavVisRange = "{7657, 3}";
+ sepNavWindowFrame = "{{199, 67}, {1070, 811}}";
};
};
8BA05A670720730100365D66 /* MidSide.exp */ = {
@@ -106,10 +106,10 @@
};
8BC6025B073B072D006C4272 /* MidSide.h */ = {
uiCtxt = {
- sepNavIntBoundsRect = "{{0, 0}, {1023, 1638}}";
- sepNavSelRange = "{4794, 131}";
- sepNavVisRange = "{3189, 1836}";
- sepNavWindowFrame = "{{612, 23}, {1070, 811}}";
+ sepNavIntBoundsRect = "{{0, 0}, {1023, 1599}}";
+ sepNavSelRange = "{4842, 0}";
+ sepNavVisRange = "{3187, 1779}";
+ sepNavWindowFrame = "{{370, 39}, {1070, 811}}";
};
};
8BD3CCB8148830B20062E48C /* Source Control */ = {
diff --git a/plugins/MacAU/MidSide/MidSide.xcodeproj/christopherjohnson.perspectivev3 b/plugins/MacAU/MidSide/MidSide.xcodeproj/christopherjohnson.perspectivev3
index 32ff114..3db9e85 100755
--- a/plugins/MacAU/MidSide/MidSide.xcodeproj/christopherjohnson.perspectivev3
+++ b/plugins/MacAU/MidSide/MidSide.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>612 261 810 487 0 0 1440 878 </string>
+ <string>444 290 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>8B9D74FF1F7F9D7C007AB60F</string>
+ <string>8B792E1B21F42F3C006E9731</string>
<key>history</key>
<array>
- <string>8B9D65B91F7C8B49007AB60F</string>
+ <string>8B792E1621F42F27006E9731</string>
</array>
</dict>
<key>SplitCount</key>
@@ -369,18 +367,18 @@
<key>GeometryConfiguration</key>
<dict>
<key>Frame</key>
- <string>{{0, 0}, {603, 69}}</string>
+ <string>{{0, 0}, {603, 51}}</string>
<key>RubberWindowFrame</key>
- <string>612 261 810 487 0 0 1440 878 </string>
+ <string>444 290 810 487 0 0 1440 878 </string>
</dict>
<key>Module</key>
<string>PBXNavigatorGroup</string>
<key>Proportion</key>
- <string>69pt</string>
+ <string>51pt</string>
</dict>
<dict>
<key>Proportion</key>
- <string>372pt</string>
+ <string>390pt</string>
<key>Tabs</key>
<array>
<dict>
@@ -394,9 +392,7 @@
<key>GeometryConfiguration</key>
<dict>
<key>Frame</key>
- <string>{{10, 27}, {603, 345}}</string>
- <key>RubberWindowFrame</key>
- <string>612 261 810 487 0 0 1440 878 </string>
+ <string>{{10, 27}, {603, 363}}</string>
</dict>
<key>Module</key>
<string>XCDetailModule</string>
@@ -450,7 +446,9 @@
<key>GeometryConfiguration</key>
<dict>
<key>Frame</key>
- <string>{{10, 31}, {603, 297}}</string>
+ <string>{{10, 27}, {603, 363}}</string>
+ <key>RubberWindowFrame</key>
+ <string>444 290 810 487 0 0 1440 878 </string>
</dict>
<key>Module</key>
<string>PBXBuildResultsModule</string>
@@ -478,11 +476,11 @@
</array>
<key>TableOfContents</key>
<array>
- <string>8B9D75001F7F9D7C007AB60F</string>
+ <string>8B792E1C21F42F3C006E9731</string>
<string>1CA23ED40692098700951B8B</string>
- <string>8B9D75011F7F9D7C007AB60F</string>
+ <string>8B792E1D21F42F3C006E9731</string>
<string>8B753E6F1E40231800347157</string>
- <string>8B9D75021F7F9D7C007AB60F</string>
+ <string>8B792E1E21F42F3C006E9731</string>
<string>1CA23EDF0692099D00951B8B</string>
<string>1CA23EE00692099D00951B8B</string>
<string>1CA23EE10692099D00951B8B</string>
@@ -635,7 +633,7 @@
<key>StatusbarIsVisible</key>
<true/>
<key>TimeStamp</key>
- <real>528457084.46547401</real>
+ <real>569651004.49607897</real>
<key>ToolbarConfigUserDefaultsMinorVersion</key>
<string>2</string>
<key>ToolbarDisplayMode</key>
@@ -652,11 +650,10 @@
<integer>5</integer>
<key>WindowOrderList</key>
<array>
- <string>8B9D75031F7F9D7C007AB60F</string>
<string>/Users/christopherjohnson/Desktop/MacAU/MidSide/MidSide.xcodeproj</string>
</array>
<key>WindowString</key>
- <string>612 261 810 487 0 0 1440 878 </string>
+ <string>444 290 810 487 0 0 1440 878 </string>
<key>WindowToolsV3</key>
<array>
<dict>