aboutsummaryrefslogtreecommitdiffstats
path: root/plugins/MacAU/EveryTrim
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/EveryTrim
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/EveryTrim')
-rwxr-xr-xplugins/MacAU/EveryTrim/EveryTrim.cpp40
-rwxr-xr-xplugins/MacAU/EveryTrim/EveryTrim.h8
-rwxr-xr-xplugins/MacAU/EveryTrim/EveryTrim.xcodeproj/christopherjohnson.pbxuser50
-rwxr-xr-xplugins/MacAU/EveryTrim/EveryTrim.xcodeproj/christopherjohnson.perspectivev337
4 files changed, 57 insertions, 78 deletions
diff --git a/plugins/MacAU/EveryTrim/EveryTrim.cpp b/plugins/MacAU/EveryTrim/EveryTrim.cpp
index 94f854e..550a23a 100755
--- a/plugins/MacAU/EveryTrim/EveryTrim.cpp
+++ b/plugins/MacAU/EveryTrim/EveryTrim.cpp
@@ -203,11 +203,8 @@ ComponentResult EveryTrim::Initialize()
// this is called the reset the DSP state (clear buffers, reset counters, etc.)
ComponentResult EveryTrim::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;
}
@@ -226,11 +223,7 @@ OSStatus EveryTrim::ProcessBufferLists(AudioUnitRenderActionFlags & ioActionFla
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;
@@ -296,25 +289,14 @@ OSStatus EveryTrim::ProcessBufferLists(AudioUnitRenderActionFlags & ioActionFla
inputSampleR = (mid-side) * rightgain;
//contains mastergain and the gain trim fixing the mid/side
- //noise shaping to 32-bit floating point
- if (fpFlip) {
- 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;
- }
- fpFlip = !fpFlip;
- //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/EveryTrim/EveryTrim.h b/plugins/MacAU/EveryTrim/EveryTrim.h
index dfb8b69..58ffc72 100755
--- a/plugins/MacAU/EveryTrim/EveryTrim.h
+++ b/plugins/MacAU/EveryTrim/EveryTrim.h
@@ -121,12 +121,8 @@ public:
virtual ComponentResult Version() { return kEveryTrimVersion; }
private:
- long double fpNShapeLA;
- long double fpNShapeLB;
- long double fpNShapeRA;
- long double fpNShapeRB;
- bool fpFlip;
- //default stuff
+ long double fpNShapeL;
+ long double fpNShapeR;
};
diff --git a/plugins/MacAU/EveryTrim/EveryTrim.xcodeproj/christopherjohnson.pbxuser b/plugins/MacAU/EveryTrim/EveryTrim.xcodeproj/christopherjohnson.pbxuser
index 9bc4e8a..bd0016f 100755
--- a/plugins/MacAU/EveryTrim/EveryTrim.xcodeproj/christopherjohnson.pbxuser
+++ b/plugins/MacAU/EveryTrim/EveryTrim.xcodeproj/christopherjohnson.pbxuser
@@ -49,32 +49,42 @@
PBXFileDataSource_Warnings_ColumnID,
);
};
- PBXPerProjectTemplateStateSaveDate = 557257719;
- PBXWorkspaceStateSaveDate = 557257719;
+ PBXPerProjectTemplateStateSaveDate = 569644212;
+ PBXWorkspaceStateSaveDate = 569644212;
};
perUserProjectItems = {
- 8B67C6D91FA1721B008C64D6 /* PBXTextBookmark */ = 8B67C6D91FA1721B008C64D6 /* PBXTextBookmark */;
- 8BFDAF84213714150079F90D /* PBXTextBookmark */ = 8BFDAF84213714150079F90D /* PBXTextBookmark */;
+ 8B792C1021F4152A006E9731 /* PBXTextBookmark */ = 8B792C1021F4152A006E9731 /* PBXTextBookmark */;
+ 8B792C1621F41559006E9731 /* PBXTextBookmark */ = 8B792C1621F41559006E9731 /* PBXTextBookmark */;
};
sourceControlManager = 8BD3CCB8148830B20062E48C /* Source Control */;
userBuildSettings = {
};
};
- 8B67C6D91FA1721B008C64D6 /* PBXTextBookmark */ = {
+ 8B792C1021F4152A006E9731 /* PBXTextBookmark */ = {
isa = PBXTextBookmark;
fRef = 8BA05A660720730100365D66 /* EveryTrim.cpp */;
- name = "EveryTrim.cpp: 208";
+ name = "EveryTrim.cpp: 207";
rLen = 0;
- rLoc = 9439;
+ rLoc = 9418;
rType = 0;
- vrLen = 105;
- vrLoc = 29;
+ vrLen = 69;
+ vrLoc = 65;
+ };
+ 8B792C1621F41559006E9731 /* PBXTextBookmark */ = {
+ isa = PBXTextBookmark;
+ fRef = 8BA05A660720730100365D66 /* EveryTrim.cpp */;
+ name = "EveryTrim.cpp: 207";
+ rLen = 0;
+ rLoc = 9418;
+ rType = 0;
+ vrLen = 69;
+ vrLoc = 65;
};
8BA05A660720730100365D66 /* EveryTrim.cpp */ = {
uiCtxt = {
- sepNavIntBoundsRect = "{{0, 0}, {803, 4407}}";
- sepNavSelRange = "{9439, 0}";
- sepNavVisRange = "{44, 90}";
+ sepNavIntBoundsRect = "{{0, 0}, {803, 4238}}";
+ sepNavSelRange = "{9418, 0}";
+ sepNavVisRange = "{65, 69}";
sepNavWindowFrame = "{{170, 67}, {1070, 811}}";
};
};
@@ -96,9 +106,9 @@
};
8BC6025B073B072D006C4272 /* EveryTrim.h */ = {
uiCtxt = {
- sepNavIntBoundsRect = "{{0, 0}, {1023, 1768}}";
- sepNavSelRange = "{5173, 131}";
- sepNavVisRange = "{3570, 1835}";
+ sepNavIntBoundsRect = "{{0, 0}, {1023, 1716}}";
+ sepNavSelRange = "{5221, 0}";
+ sepNavVisRange = "{3522, 1806}";
sepNavWindowFrame = "{{370, 67}, {1070, 811}}";
};
};
@@ -116,16 +126,6 @@
isa = PBXCodeSenseManager;
indexTemplatePath = "";
};
- 8BFDAF84213714150079F90D /* PBXTextBookmark */ = {
- isa = PBXTextBookmark;
- fRef = 8BA05A660720730100365D66 /* EveryTrim.cpp */;
- name = "EveryTrim.cpp: 208";
- rLen = 0;
- rLoc = 9439;
- rType = 0;
- vrLen = 90;
- vrLoc = 44;
- };
8D01CCC60486CAD60068D4B7 /* EveryTrim */ = {
activeExec = 0;
};
diff --git a/plugins/MacAU/EveryTrim/EveryTrim.xcodeproj/christopherjohnson.perspectivev3 b/plugins/MacAU/EveryTrim/EveryTrim.xcodeproj/christopherjohnson.perspectivev3
index 3937f74..afd4e1f 100755
--- a/plugins/MacAU/EveryTrim/EveryTrim.xcodeproj/christopherjohnson.perspectivev3
+++ b/plugins/MacAU/EveryTrim/EveryTrim.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>
@@ -325,7 +325,7 @@
<real>185</real>
</array>
<key>RubberWindowFrame</key>
- <string>610 324 810 487 0 0 1440 878 </string>
+ <string>507 328 810 487 0 0 1440 878 </string>
</dict>
<key>Module</key>
<string>PBXSmartGroupTreeModule</string>
@@ -353,10 +353,10 @@
<key>_historyCapacity</key>
<integer>0</integer>
<key>bookmark</key>
- <string>8BFDAF84213714150079F90D</string>
+ <string>8B792C1621F41559006E9731</string>
<key>history</key>
<array>
- <string>8B67C6D91FA1721B008C64D6</string>
+ <string>8B792C1021F4152A006E9731</string>
</array>
</dict>
<key>SplitCount</key>
@@ -370,18 +370,18 @@
<key>GeometryConfiguration</key>
<dict>
<key>Frame</key>
- <string>{{0, 0}, {603, 86}}</string>
+ <string>{{0, 0}, {603, 69}}</string>
<key>RubberWindowFrame</key>
- <string>610 324 810 487 0 0 1440 878 </string>
+ <string>507 328 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>
@@ -395,9 +395,7 @@
<key>GeometryConfiguration</key>
<dict>
<key>Frame</key>
- <string>{{10, 27}, {603, 328}}</string>
- <key>RubberWindowFrame</key>
- <string>610 324 810 487 0 0 1440 878 </string>
+ <string>{{10, 27}, {603, 345}}</string>
</dict>
<key>Module</key>
<string>XCDetailModule</string>
@@ -451,7 +449,9 @@
<key>GeometryConfiguration</key>
<dict>
<key>Frame</key>
- <string>{{10, 31}, {603, 297}}</string>
+ <string>{{10, 27}, {603, 345}}</string>
+ <key>RubberWindowFrame</key>
+ <string>507 328 810 487 0 0 1440 878 </string>
</dict>
<key>Module</key>
<string>PBXBuildResultsModule</string>
@@ -479,11 +479,11 @@
</array>
<key>TableOfContents</key>
<array>
- <string>8BFDAF85213714150079F90D</string>
+ <string>8B792C1721F41559006E9731</string>
<string>1CA23ED40692098700951B8B</string>
- <string>8BFDAF86213714150079F90D</string>
+ <string>8B792C1821F41559006E9731</string>
<string>8B753E6F1E40231800347157</string>
- <string>8BFDAF87213714150079F90D</string>
+ <string>8B792C1921F41559006E9731</string>
<string>1CA23EDF0692099D00951B8B</string>
<string>1CA23EE00692099D00951B8B</string>
<string>1CA23EE10692099D00951B8B</string>
@@ -636,7 +636,7 @@
<key>StatusbarIsVisible</key>
<true/>
<key>TimeStamp</key>
- <real>557257749.03621697</real>
+ <real>569644377.55946004</real>
<key>ToolbarConfigUserDefaultsMinorVersion</key>
<string>2</string>
<key>ToolbarDisplayMode</key>
@@ -653,10 +653,11 @@
<integer>5</integer>
<key>WindowOrderList</key>
<array>
+ <string>8B792C1A21F41559006E9731</string>
<string>/Users/christopherjohnson/Desktop/MacAU/EveryTrim/EveryTrim.xcodeproj</string>
</array>
<key>WindowString</key>
- <string>610 324 810 487 0 0 1440 878 </string>
+ <string>507 328 810 487 0 0 1440 878 </string>
<key>WindowToolsV3</key>
<array>
<dict>