aboutsummaryrefslogtreecommitdiffstats
path: root/plugins/MacAU/Pressure4
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/Pressure4
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/Pressure4')
-rwxr-xr-xplugins/MacAU/Pressure4/Pressure4.cpp38
-rwxr-xr-xplugins/MacAU/Pressure4/Pressure4.h6
-rwxr-xr-xplugins/MacAU/Pressure4/Pressure4.xcodeproj/christopherjohnson.pbxuser64
-rwxr-xr-xplugins/MacAU/Pressure4/Pressure4.xcodeproj/christopherjohnson.perspectivev340
4 files changed, 65 insertions, 83 deletions
diff --git a/plugins/MacAU/Pressure4/Pressure4.cpp b/plugins/MacAU/Pressure4/Pressure4.cpp
index 4780f45..9fbbe85 100755
--- a/plugins/MacAU/Pressure4/Pressure4.cpp
+++ b/plugins/MacAU/Pressure4/Pressure4.cpp
@@ -198,10 +198,8 @@ ComponentResult Pressure4::Initialize()
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
ComponentResult Pressure4::Reset(AudioUnitScope inScope, AudioUnitElement inElement)
{
- fpNShapeAL = 0.0;
- fpNShapeBL = 0.0;
- fpNShapeAR = 0.0;
- fpNShapeBR = 0.0;
+ fpNShapeL = 0.0;
+ fpNShapeR = 0.0;
muSpeedA = 10000;
muSpeedB = 10000;
muCoefficientA = 1;
@@ -257,9 +255,6 @@ OSStatus Pressure4::ProcessBufferLists(AudioUnitRenderActionFlags & ioActionFla
unmewiness = 1.0-mewiness;
}
// µ µ µ µ µ µ µ µ µ µ µ µ is the kitten song o/~
- Float32 fpTemp;
- Float64 fpOld = 0.618033988749894848204586; //golden ratio!
- Float64 fpNew = 1.0 - fpOld;
long double inputSampleL;
long double inputSampleR;
@@ -407,27 +402,16 @@ OSStatus Pressure4::ProcessBufferLists(AudioUnitRenderActionFlags & ioActionFla
else {inputSampleR = -bridgerectifier;}
//second stage of overdrive to prevent overs and allow bloody loud extremeness
- //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/Pressure4/Pressure4.h b/plugins/MacAU/Pressure4/Pressure4.h
index a6926ee..6534c46 100755
--- a/plugins/MacAU/Pressure4/Pressure4.h
+++ b/plugins/MacAU/Pressure4/Pressure4.h
@@ -125,10 +125,8 @@ public:
Float64 muSpeedB;
Float64 muCoefficientA;
Float64 muCoefficientB;
- long double fpNShapeAL;
- long double fpNShapeBL;
- long double fpNShapeAR;
- long double fpNShapeBR;
+ long double fpNShapeL;
+ long double fpNShapeR;
bool flip;
};
diff --git a/plugins/MacAU/Pressure4/Pressure4.xcodeproj/christopherjohnson.pbxuser b/plugins/MacAU/Pressure4/Pressure4.xcodeproj/christopherjohnson.pbxuser
index 99a6c24..3758f60 100755
--- a/plugins/MacAU/Pressure4/Pressure4.xcodeproj/christopherjohnson.pbxuser
+++ b/plugins/MacAU/Pressure4/Pressure4.xcodeproj/christopherjohnson.pbxuser
@@ -49,13 +49,13 @@
PBXFileDataSource_Warnings_ColumnID,
);
};
- PBXPerProjectTemplateStateSaveDate = 553809064;
- PBXWorkspaceStateSaveDate = 553809064;
+ PBXPerProjectTemplateStateSaveDate = 569677045;
+ PBXWorkspaceStateSaveDate = 569677045;
};
perUserProjectItems = {
- 8B050BBA2064897B00700365 /* PBXTextBookmark */ = 8B050BBA2064897B00700365 /* PBXTextBookmark */;
- 8B8D6983207ABA4C0029B7B0 /* PBXTextBookmark */ = 8B8D6983207ABA4C0029B7B0 /* PBXTextBookmark */;
- 8BB8B6702102844E00751000 /* PBXTextBookmark */ = 8BB8B6702102844E00751000 /* PBXTextBookmark */;
+ 8B792F5421F495A9006E9731 /* PBXTextBookmark */ = 8B792F5421F495A9006E9731 /* PBXTextBookmark */;
+ 8B792F5521F495A9006E9731 /* PBXTextBookmark */ = 8B792F5521F495A9006E9731 /* PBXTextBookmark */;
+ 8B792F5621F495A9006E9731 /* PBXTextBookmark */ = 8B792F5621F495A9006E9731 /* PBXTextBookmark */;
8BEF33C81D81F6D7008B0B7F /* PlistBookmark */ = 8BEF33C81D81F6D7008B0B7F /* PlistBookmark */;
8BEF33C91D81F6D7008B0B7F /* PBXTextBookmark */ = 8BEF33C91D81F6D7008B0B7F /* PBXTextBookmark */;
};
@@ -63,31 +63,41 @@
userBuildSettings = {
};
};
- 8B050BBA2064897B00700365 /* PBXTextBookmark */ = {
+ 8B792F5421F495A9006E9731 /* PBXTextBookmark */ = {
isa = PBXTextBookmark;
fRef = 8BC6025B073B072D006C4272 /* Pressure4.h */;
- name = "Pressure4.h: 128";
- rLen = 117;
- rLoc = 5265;
+ name = "Pressure4.h: 129";
+ rLen = 0;
+ rLoc = 5292;
+ rType = 0;
+ vrLen = 1148;
+ vrLoc = 4280;
+ };
+ 8B792F5521F495A9006E9731 /* PBXTextBookmark */ = {
+ isa = PBXTextBookmark;
+ fRef = 8BA05A660720730100365D66 /* Pressure4.cpp */;
+ name = "Pressure4.cpp: 201";
+ rLen = 0;
+ rLoc = 8945;
rType = 0;
- vrLen = 1019;
- vrLoc = 4469;
+ vrLen = 1378;
+ vrLoc = 15227;
};
- 8B8D6983207ABA4C0029B7B0 /* PBXTextBookmark */ = {
+ 8B792F5621F495A9006E9731 /* PBXTextBookmark */ = {
isa = PBXTextBookmark;
fRef = 8BA05A660720730100365D66 /* Pressure4.cpp */;
- name = "Pressure4.cpp: 210";
+ name = "Pressure4.cpp: 202";
rLen = 0;
- rLoc = 9108;
+ rLoc = 8956;
rType = 0;
- vrLen = 1508;
- vrLoc = 8385;
+ vrLen = 1347;
+ vrLoc = 15277;
};
8BA05A660720730100365D66 /* Pressure4.cpp */ = {
uiCtxt = {
- sepNavIntBoundsRect = "{{0, 0}, {693, 6006}}";
- sepNavSelRange = "{9108, 0}";
- sepNavVisRange = "{12471, 1500}";
+ sepNavIntBoundsRect = "{{0, 0}, {754, 5876}}";
+ sepNavSelRange = "{8956, 0}";
+ sepNavVisRange = "{15277, 1347}";
sepNavWindowFrame = "{{479, 48}, {895, 819}}";
};
};
@@ -99,21 +109,11 @@
sepNavWindowFrame = "{{15, 54}, {895, 819}}";
};
};
- 8BB8B6702102844E00751000 /* PBXTextBookmark */ = {
- isa = PBXTextBookmark;
- fRef = 8BA05A660720730100365D66 /* Pressure4.cpp */;
- name = "Pressure4.cpp: 210";
- rLen = 0;
- rLoc = 9108;
- rType = 0;
- vrLen = 1500;
- vrLoc = 12471;
- };
8BC6025B073B072D006C4272 /* Pressure4.h */ = {
uiCtxt = {
- sepNavIntBoundsRect = "{{0, 0}, {894, 1807}}";
- sepNavSelRange = "{5265, 117}";
- sepNavVisRange = "{3662, 1826}";
+ sepNavIntBoundsRect = "{{0, 0}, {894, 1976}}";
+ sepNavSelRange = "{5292, 0}";
+ sepNavVisRange = "{4280, 1148}";
sepNavWindowFrame = "{{28, 51}, {895, 819}}";
};
};
diff --git a/plugins/MacAU/Pressure4/Pressure4.xcodeproj/christopherjohnson.perspectivev3 b/plugins/MacAU/Pressure4/Pressure4.xcodeproj/christopherjohnson.perspectivev3
index 6e47c82..e9da12e 100755
--- a/plugins/MacAU/Pressure4/Pressure4.xcodeproj/christopherjohnson.perspectivev3
+++ b/plugins/MacAU/Pressure4/Pressure4.xcodeproj/christopherjohnson.perspectivev3
@@ -225,8 +225,8 @@
<array/>
<key>PerspectiveWidths</key>
<array>
- <integer>841</integer>
- <integer>841</integer>
+ <integer>1052</integer>
+ <integer>1052</integer>
</array>
<key>Perspectives</key>
<array>
@@ -299,7 +299,7 @@
<key>PBXSmartGroupTreeModuleOutlineStateSelectionKey</key>
<array>
<array>
- <integer>3</integer>
+ <integer>4</integer>
<integer>2</integer>
<integer>1</integer>
<integer>0</integer>
@@ -323,7 +323,7 @@
<real>288</real>
</array>
<key>RubberWindowFrame</key>
- <string>526 89 1052 789 0 0 1440 878 </string>
+ <string>259 89 1052 789 0 0 1440 878 </string>
</dict>
<key>Module</key>
<string>PBXSmartGroupTreeModule</string>
@@ -353,13 +353,13 @@
<key>_historyCapacity</key>
<integer>0</integer>
<key>bookmark</key>
- <string>8BB8B6702102844E00751000</string>
+ <string>8B792F5621F495A9006E9731</string>
<key>history</key>
<array>
<string>8BEF33C81D81F6D7008B0B7F</string>
<string>8BEF33C91D81F6D7008B0B7F</string>
- <string>8B050BBA2064897B00700365</string>
- <string>8B8D6983207ABA4C0029B7B0</string>
+ <string>8B792F5421F495A9006E9731</string>
+ <string>8B792F5521F495A9006E9731</string>
</array>
</dict>
<key>SplitCount</key>
@@ -373,18 +373,18 @@
<key>GeometryConfiguration</key>
<dict>
<key>Frame</key>
- <string>{{0, 0}, {742, 617}}</string>
+ <string>{{0, 0}, {742, 515}}</string>
<key>RubberWindowFrame</key>
- <string>526 89 1052 789 0 0 1440 878 </string>
+ <string>259 89 1052 789 0 0 1440 878 </string>
</dict>
<key>Module</key>
<string>PBXNavigatorGroup</string>
<key>Proportion</key>
- <string>617pt</string>
+ <string>515pt</string>
</dict>
<dict>
<key>Proportion</key>
- <string>126pt</string>
+ <string>228pt</string>
<key>Tabs</key>
<array>
<dict>
@@ -398,9 +398,7 @@
<key>GeometryConfiguration</key>
<dict>
<key>Frame</key>
- <string>{{10, 27}, {742, 99}}</string>
- <key>RubberWindowFrame</key>
- <string>526 89 1052 789 0 0 1440 878 </string>
+ <string>{{10, 27}, {742, 201}}</string>
</dict>
<key>Module</key>
<string>XCDetailModule</string>
@@ -454,7 +452,9 @@
<key>GeometryConfiguration</key>
<dict>
<key>Frame</key>
- <string>{{10, 27}, {531, 327}}</string>
+ <string>{{10, 27}, {742, 201}}</string>
+ <key>RubberWindowFrame</key>
+ <string>259 89 1052 789 0 0 1440 878 </string>
</dict>
<key>Module</key>
<string>PBXBuildResultsModule</string>
@@ -482,11 +482,11 @@
</array>
<key>TableOfContents</key>
<array>
- <string>8BB8B6712102844E00751000</string>
+ <string>8B792F5721F495A9006E9731</string>
<string>1CA23ED40692098700951B8B</string>
- <string>8BB8B6722102844E00751000</string>
+ <string>8B792F5821F495A9006E9731</string>
<string>8BD7274A1D46E5A5000176F0</string>
- <string>8BB8B6732102844E00751000</string>
+ <string>8B792F5921F495A9006E9731</string>
<string>1CA23EDF0692099D00951B8B</string>
<string>1CA23EE00692099D00951B8B</string>
<string>1CA23EE10692099D00951B8B</string>
@@ -659,7 +659,7 @@
<key>StatusbarIsVisible</key>
<true/>
<key>TimeStamp</key>
- <real>553813070.00637698</real>
+ <real>569677225.40901196</real>
<key>ToolbarConfigUserDefaultsMinorVersion</key>
<string>2</string>
<key>ToolbarDisplayMode</key>
@@ -679,7 +679,7 @@
<string>/Users/christopherjohnson/Desktop/MacAU/Pressure4/Pressure4.xcodeproj</string>
</array>
<key>WindowString</key>
- <string>526 89 1052 789 0 0 1440 878 </string>
+ <string>259 89 1052 789 0 0 1440 878 </string>
<key>WindowToolsV3</key>
<array>
<dict>