aboutsummaryrefslogtreecommitdiffstats
path: root/plugins/MacAU/StarChild
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/StarChild
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/StarChild')
-rwxr-xr-xplugins/MacAU/StarChild/StarChild.cpp44
-rwxr-xr-xplugins/MacAU/StarChild/StarChild.h13
-rwxr-xr-xplugins/MacAU/StarChild/StarChild.xcodeproj/christopherjohnson.pbxuser59
-rwxr-xr-xplugins/MacAU/StarChild/StarChild.xcodeproj/christopherjohnson.perspectivev352
4 files changed, 73 insertions, 95 deletions
diff --git a/plugins/MacAU/StarChild/StarChild.cpp b/plugins/MacAU/StarChild/StarChild.cpp
index 7a434e9..61959c8 100755
--- a/plugins/MacAU/StarChild/StarChild.cpp
+++ b/plugins/MacAU/StarChild/StarChild.cpp
@@ -237,13 +237,8 @@ ComponentResult StarChild::Reset(AudioUnitScope inScope, AudioUnitElement inEle
increment = 1;
dutyCycle = 1;
- demotimer = 0;
-
- fpNShapeAL = 0.0;
- fpNShapeBL = 0.0;
- fpNShapeAR = 0.0;
- fpNShapeBR = 0.0;
- fpFlip = true;
+ fpNShapeL = 0.0;
+ fpNShapeR = 0.0;
return noErr;
}
@@ -262,9 +257,6 @@ OSStatus StarChild::ProcessBufferLists(AudioUnitRenderActionFlags & ioActionFla
Float32 * outputL = (Float32*)(outBuffer.mBuffers[0].mData);
Float32 * outputR = (Float32*)(outBuffer.mBuffers[1].mData);
- Float32 fpTemp;
- Float64 fpOld = 0.618033988749894848204586; //golden ratio!
- Float64 fpNew = 1.0 - fpOld;
UInt32 nSampleFrames = inFramesToProcess;
Float32 drySampleL;
@@ -283,8 +275,6 @@ OSStatus StarChild::ProcessBufferLists(AudioUnitRenderActionFlags & ioActionFla
//let's try making it always be the max delay: smaller range forces scale to be longer
Float32 outputPad = 4 * rangeDirect * sqrt(rangeDirect);
-
-
Float32 overallscale = ((1.0-GetParameter( kParam_Two ))*9.0)+1.0;
//apply the singlestage groove wear strongest when bits are heavily crushed
Float32 gain = overallscale;
@@ -314,9 +304,6 @@ OSStatus StarChild::ProcessBufferLists(AudioUnitRenderActionFlags & ioActionFla
//and now it's neatly scaled, too
Float32 accumulatorSample;
Float32 correction;
-
-
-
Float32 wetness = GetParameter( kParam_Three );
Float32 dryness = 1.0 - wetness; //reverb setup
@@ -644,25 +631,14 @@ OSStatus StarChild::ProcessBufferLists(AudioUnitRenderActionFlags & ioActionFla
drySampleR += inputSampleR;
//here we combine the tanks with the dry signal
- //noise shaping to 32-bit floating point
- if (fpFlip) {
- fpTemp = drySampleL;
- fpNShapeAL = (fpNShapeAL*fpOld)+((drySampleL-fpTemp)*fpNew);
- drySampleL += fpNShapeAL;
- fpTemp = drySampleR;
- fpNShapeAR = (fpNShapeAR*fpOld)+((drySampleR-fpTemp)*fpNew);
- drySampleR += fpNShapeAR;
- }
- else {
- fpTemp = drySampleL;
- fpNShapeBL = (fpNShapeBL*fpOld)+((drySampleL-fpTemp)*fpNew);
- drySampleL += fpNShapeBL;
- fpTemp = drySampleR;
- fpNShapeBR = (fpNShapeBR*fpOld)+((drySampleR-fpTemp)*fpNew);
- drySampleR += fpNShapeBR;
- }
- fpFlip = not fpFlip;
- //end noise shaping on 32 bit output
+ //stereo 32 bit dither, made small and tidy.
+ int expon; frexpf((Float32)drySampleL, &expon);
+ long double dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62);
+ drySampleL += (dither-fpNShapeL); fpNShapeL = dither;
+ frexpf((Float32)drySampleR, &expon);
+ dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62);
+ drySampleR += (dither-fpNShapeR); fpNShapeR = dither;
+ //end 32 bit dither
*outputL = drySampleL;
*outputR = drySampleR;
diff --git a/plugins/MacAU/StarChild/StarChild.h b/plugins/MacAU/StarChild/StarChild.h
index 75df690..239daef 100755
--- a/plugins/MacAU/StarChild/StarChild.h
+++ b/plugins/MacAU/StarChild/StarChild.h
@@ -116,9 +116,6 @@ public:
virtual ComponentResult Version() { return kStarChildVersion; }
private:
-
- int demotimer;
-
Float32 d[45102];
UInt32 dCount;
@@ -136,14 +133,8 @@ private:
Float64 wearLPrev;
Float64 wearRPrev;
- Float64 fpNShapeAL;
- Float64 fpNShapeAR;
- Float64 fpNShapeBL;
- Float64 fpNShapeBR;
- // Float64 fpNShapeA;
- // Float64 fpNShapeB;
- bool fpFlip;
-
+ long double fpNShapeR;
+ long double fpNShapeL;
};
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
diff --git a/plugins/MacAU/StarChild/StarChild.xcodeproj/christopherjohnson.pbxuser b/plugins/MacAU/StarChild/StarChild.xcodeproj/christopherjohnson.pbxuser
index 7cefddd..479a352 100755
--- a/plugins/MacAU/StarChild/StarChild.xcodeproj/christopherjohnson.pbxuser
+++ b/plugins/MacAU/StarChild/StarChild.xcodeproj/christopherjohnson.pbxuser
@@ -10,7 +10,7 @@
PBXFileTableDataSourceColumnSortingKey = PBXFileDataSource_Filename_ColumnID;
PBXFileTableDataSourceColumnWidthsKey = (
20,
- 364,
+ 430,
20,
48,
43,
@@ -49,42 +49,53 @@
PBXFileDataSource_Warnings_ColumnID,
);
};
- PBXPerProjectTemplateStateSaveDate = 528458151;
- PBXWorkspaceStateSaveDate = 528458151;
+ PBXPerProjectTemplateStateSaveDate = 569680704;
+ PBXWorkspaceStateSaveDate = 569680704;
};
perUserProjectItems = {
- 8B9D67441F7C8F7E007AB60F /* PBXTextBookmark */ = 8B9D67441F7C8F7E007AB60F /* PBXTextBookmark */;
- 8B9D76381F7FA215007AB60F /* PBXTextBookmark */ = 8B9D76381F7FA215007AB60F /* PBXTextBookmark */;
+ 8B79307721F4A440006E9731 /* PBXTextBookmark */ = 8B79307721F4A440006E9731 /* PBXTextBookmark */;
+ 8B79307921F4A440006E9731 /* PBXTextBookmark */ = 8B79307921F4A440006E9731 /* PBXTextBookmark */;
+ 8B79307E21F4A491006E9731 /* PBXTextBookmark */ = 8B79307E21F4A491006E9731 /* PBXTextBookmark */;
};
sourceControlManager = 8BD3CCB8148830B20062E48C /* Source Control */;
userBuildSettings = {
};
};
- 8B9D67441F7C8F7E007AB60F /* PBXTextBookmark */ = {
+ 8B79307721F4A440006E9731 /* PBXTextBookmark */ = {
isa = PBXTextBookmark;
fRef = 8BC6025B073B072D006C4272 /* StarChild.h */;
- name = "StarChild.h: 122";
- rLen = 35;
- rLoc = 5120;
+ name = "StarChild.h: 119";
+ rLen = 0;
+ rLoc = 5101;
rType = 0;
- vrLen = 71;
- vrLoc = 5102;
+ vrLen = 1029;
+ vrLoc = 4501;
};
- 8B9D76381F7FA215007AB60F /* PBXTextBookmark */ = {
+ 8B79307921F4A440006E9731 /* PBXTextBookmark */ = {
isa = PBXTextBookmark;
- fRef = 8BC6025B073B072D006C4272 /* StarChild.h */;
- name = "StarChild.h: 122";
- rLen = 35;
- rLoc = 5120;
+ fRef = 8BA05A660720730100365D66 /* StarChild.cpp */;
+ name = "StarChild.cpp: 650";
+ rLen = 0;
+ rLoc = 38428;
+ rType = 0;
+ vrLen = 1146;
+ vrLoc = 37584;
+ };
+ 8B79307E21F4A491006E9731 /* PBXTextBookmark */ = {
+ isa = PBXTextBookmark;
+ fRef = 8BA05A660720730100365D66 /* StarChild.cpp */;
+ name = "StarChild.cpp: 260";
+ rLen = 0;
+ rLoc = 12080;
rType = 0;
- vrLen = 55;
- vrLoc = 5118;
+ vrLen = 1508;
+ vrLoc = 11340;
};
8BA05A660720730100365D66 /* StarChild.cpp */ = {
uiCtxt = {
- sepNavIntBoundsRect = "{{0, 0}, {1156, 9516}}";
- sepNavSelRange = "{14734, 0}";
- sepNavVisRange = "{14520, 2363}";
+ sepNavIntBoundsRect = "{{0, 0}, {1013, 8762}}";
+ sepNavSelRange = "{12080, 0}";
+ sepNavVisRange = "{11340, 1508}";
sepNavWindowFrame = "{{237, 42}, {1203, 836}}";
};
};
@@ -98,9 +109,9 @@
};
8BC6025B073B072D006C4272 /* StarChild.h */ = {
uiCtxt = {
- sepNavIntBoundsRect = "{{0, 0}, {922, 2080}}";
- sepNavSelRange = "{5120, 35}";
- sepNavVisRange = "{5118, 55}";
+ sepNavIntBoundsRect = "{{0, 0}, {922, 2106}}";
+ sepNavSelRange = "{5101, 0}";
+ sepNavVisRange = "{4501, 1029}";
sepNavWindowFrame = "{{652, 63}, {932, 815}}";
};
};
diff --git a/plugins/MacAU/StarChild/StarChild.xcodeproj/christopherjohnson.perspectivev3 b/plugins/MacAU/StarChild/StarChild.xcodeproj/christopherjohnson.perspectivev3
index 0d2abd0..3349044 100755
--- a/plugins/MacAU/StarChild/StarChild.xcodeproj/christopherjohnson.perspectivev3
+++ b/plugins/MacAU/StarChild/StarChild.xcodeproj/christopherjohnson.perspectivev3
@@ -225,8 +225,8 @@
<array/>
<key>PerspectiveWidths</key>
<array>
- <integer>-1</integer>
- <integer>-1</integer>
+ <integer>876</integer>
+ <integer>876</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>
@@ -307,7 +305,7 @@
</array>
</array>
<key>PBXSmartGroupTreeModuleOutlineStateVisibleRectKey</key>
- <string>{{0, 0}, {185, 428}}</string>
+ <string>{{0, 0}, {185, 661}}</string>
</dict>
<key>PBXTopSmartGroupGIDs</key>
<array/>
@@ -317,14 +315,14 @@
<key>GeometryConfiguration</key>
<dict>
<key>Frame</key>
- <string>{{0, 0}, {202, 446}}</string>
+ <string>{{0, 0}, {202, 679}}</string>
<key>GroupTreeTableConfiguration</key>
<array>
<string>MainColumn</string>
<real>185</real>
</array>
<key>RubberWindowFrame</key>
- <string>630 293 810 487 0 0 1440 878 </string>
+ <string>447 102 876 720 0 0 1440 878 </string>
</dict>
<key>Module</key>
<string>PBXSmartGroupTreeModule</string>
@@ -335,12 +333,14 @@
<key>Dock</key>
<array>
<dict>
+ <key>BecomeActive</key>
+ <true/>
<key>ContentConfiguration</key>
<dict>
<key>PBXProjectModuleGUID</key>
<string>8BAC22EC1F1EA26E009C635C</string>
<key>PBXProjectModuleLabel</key>
- <string>StarChild.h</string>
+ <string>StarChild.cpp</string>
<key>PBXSplitModuleInNavigatorKey</key>
<dict>
<key>Split0</key>
@@ -348,14 +348,15 @@
<key>PBXProjectModuleGUID</key>
<string>8BAC22ED1F1EA26E009C635C</string>
<key>PBXProjectModuleLabel</key>
- <string>StarChild.h</string>
+ <string>StarChild.cpp</string>
<key>_historyCapacity</key>
<integer>0</integer>
<key>bookmark</key>
- <string>8B9D76381F7FA215007AB60F</string>
+ <string>8B79307E21F4A491006E9731</string>
<key>history</key>
<array>
- <string>8B9D67441F7C8F7E007AB60F</string>
+ <string>8B79307721F4A440006E9731</string>
+ <string>8B79307921F4A440006E9731</string>
</array>
</dict>
<key>SplitCount</key>
@@ -369,18 +370,18 @@
<key>GeometryConfiguration</key>
<dict>
<key>Frame</key>
- <string>{{0, 0}, {603, 86}}</string>
+ <string>{{0, 0}, {669, 542}}</string>
<key>RubberWindowFrame</key>
- <string>630 293 810 487 0 0 1440 878 </string>
+ <string>447 102 876 720 0 0 1440 878 </string>
</dict>
<key>Module</key>
<string>PBXNavigatorGroup</string>
<key>Proportion</key>
- <string>86pt</string>
+ <string>542pt</string>
</dict>
<dict>
<key>Proportion</key>
- <string>355pt</string>
+ <string>132pt</string>
<key>Tabs</key>
<array>
<dict>
@@ -394,9 +395,7 @@
<key>GeometryConfiguration</key>
<dict>
<key>Frame</key>
- <string>{{10, 27}, {603, 328}}</string>
- <key>RubberWindowFrame</key>
- <string>630 293 810 487 0 0 1440 878 </string>
+ <string>{{10, 27}, {669, 105}}</string>
</dict>
<key>Module</key>
<string>XCDetailModule</string>
@@ -450,7 +449,9 @@
<key>GeometryConfiguration</key>
<dict>
<key>Frame</key>
- <string>{{10, 31}, {603, 297}}</string>
+ <string>{{10, 27}, {669, 105}}</string>
+ <key>RubberWindowFrame</key>
+ <string>447 102 876 720 0 0 1440 878 </string>
</dict>
<key>Module</key>
<string>PBXBuildResultsModule</string>
@@ -459,7 +460,7 @@
</dict>
</array>
<key>Proportion</key>
- <string>603pt</string>
+ <string>669pt</string>
</dict>
</array>
<key>Name</key>
@@ -478,11 +479,11 @@
</array>
<key>TableOfContents</key>
<array>
- <string>8B9D76391F7FA215007AB60F</string>
+ <string>8B79307F21F4A491006E9731</string>
<string>1CA23ED40692098700951B8B</string>
- <string>8B9D763A1F7FA215007AB60F</string>
+ <string>8B79308021F4A491006E9731</string>
<string>8BAC22EC1F1EA26E009C635C</string>
- <string>8B9D763B1F7FA215007AB60F</string>
+ <string>8B79308121F4A491006E9731</string>
<string>1CA23EDF0692099D00951B8B</string>
<string>1CA23EE00692099D00951B8B</string>
<string>1CA23EE10692099D00951B8B</string>
@@ -635,7 +636,7 @@
<key>StatusbarIsVisible</key>
<true/>
<key>TimeStamp</key>
- <real>528458261.212134</real>
+ <real>569681041.62753606</real>
<key>ToolbarConfigUserDefaultsMinorVersion</key>
<string>2</string>
<key>ToolbarDisplayMode</key>
@@ -652,11 +653,10 @@
<integer>5</integer>
<key>WindowOrderList</key>
<array>
- <string>8B9D763C1F7FA215007AB60F</string>
<string>/Users/christopherjohnson/Desktop/MacAU/StarChild/StarChild.xcodeproj</string>
</array>
<key>WindowString</key>
- <string>630 293 810 487 0 0 1440 878 </string>
+ <string>447 102 876 720 0 0 1440 878 </string>
<key>WindowToolsV3</key>
<array>
<dict>