aboutsummaryrefslogtreecommitdiffstats
path: root/plugins/MacVST/Spiral
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/MacVST/Spiral
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/MacVST/Spiral')
-rwxr-xr-xplugins/MacVST/Spiral/Spiral.xcodeproj/christopherjohnson.pbxuser20
-rwxr-xr-xplugins/MacVST/Spiral/Spiral.xcodeproj/christopherjohnson.perspectivev333
-rwxr-xr-xplugins/MacVST/Spiral/source/SpiralProc.cpp54
3 files changed, 44 insertions, 63 deletions
diff --git a/plugins/MacVST/Spiral/Spiral.xcodeproj/christopherjohnson.pbxuser b/plugins/MacVST/Spiral/Spiral.xcodeproj/christopherjohnson.pbxuser
index af4c470..6e07b6a 100755
--- a/plugins/MacVST/Spiral/Spiral.xcodeproj/christopherjohnson.pbxuser
+++ b/plugins/MacVST/Spiral/Spiral.xcodeproj/christopherjohnson.pbxuser
@@ -49,12 +49,12 @@
PBXFileDataSource_Warnings_ColumnID,
);
};
- PBXPerProjectTemplateStateSaveDate = 548242309;
- PBXWorkspaceStateSaveDate = 548242309;
+ PBXPerProjectTemplateStateSaveDate = 569772524;
+ PBXWorkspaceStateSaveDate = 569772524;
};
perUserProjectItems = {
- 8BBFF88A20AD86E4005650EF /* XCBuildMessageTextBookmark */ = 8BBFF88A20AD86E4005650EF /* XCBuildMessageTextBookmark */;
- 8BBFF88B20AD86E4005650EF /* PBXTextBookmark */ = 8BBFF88B20AD86E4005650EF /* PBXTextBookmark */;
+ 8B79401F21F60A00006E9731 /* XCBuildMessageTextBookmark */ = 8B79401F21F60A00006E9731 /* XCBuildMessageTextBookmark */;
+ 8B79402021F60A00006E9731 /* PBXTextBookmark */ = 8B79402021F60A00006E9731 /* PBXTextBookmark */;
};
sourceControlManager = 8B02375E1D42B1C400E1E8C8 /* Source Control */;
userBuildSettings = {
@@ -62,9 +62,9 @@
};
2407DEB6089929BA00EB68BF /* Spiral.cpp */ = {
uiCtxt = {
- sepNavIntBoundsRect = "{{0, 0}, {712, 1560}}";
+ sepNavIntBoundsRect = "{{0, 0}, {663, 1469}}";
sepNavSelRange = "{2153, 0}";
- sepNavVisRange = "{2034, 288}";
+ sepNavVisRange = "{2076, 246}";
sepNavWindowFrame = "{{12, 47}, {895, 831}}";
};
};
@@ -106,7 +106,7 @@
isa = PBXCodeSenseManager;
indexTemplatePath = "";
};
- 8BBFF88A20AD86E4005650EF /* XCBuildMessageTextBookmark */ = {
+ 8B79401F21F60A00006E9731 /* XCBuildMessageTextBookmark */ = {
isa = PBXTextBookmark;
comments = "Unused variable 'chunkData'";
fRef = 2407DEB6089929BA00EB68BF /* Spiral.cpp */;
@@ -115,15 +115,15 @@
rLoc = 57;
rType = 1;
};
- 8BBFF88B20AD86E4005650EF /* PBXTextBookmark */ = {
+ 8B79402021F60A00006E9731 /* PBXTextBookmark */ = {
isa = PBXTextBookmark;
fRef = 2407DEB6089929BA00EB68BF /* Spiral.cpp */;
name = "Spiral.cpp: 58";
rLen = 0;
rLoc = 2153;
rType = 0;
- vrLen = 288;
- vrLoc = 2034;
+ vrLen = 246;
+ vrLoc = 2076;
};
8D01CCC60486CAD60068D4B7 /* Spiral */ = {
activeExec = 0;
diff --git a/plugins/MacVST/Spiral/Spiral.xcodeproj/christopherjohnson.perspectivev3 b/plugins/MacVST/Spiral/Spiral.xcodeproj/christopherjohnson.perspectivev3
index 77cc949..4c7e827 100755
--- a/plugins/MacVST/Spiral/Spiral.xcodeproj/christopherjohnson.perspectivev3
+++ b/plugins/MacVST/Spiral/Spiral.xcodeproj/christopherjohnson.perspectivev3
@@ -321,7 +321,7 @@
<real>185</real>
</array>
<key>RubberWindowFrame</key>
- <string>21 283 810 487 0 0 1440 878 </string>
+ <string>283 293 810 487 0 0 1440 878 </string>
</dict>
<key>Module</key>
<string>PBXSmartGroupTreeModule</string>
@@ -349,10 +349,10 @@
<key>_historyCapacity</key>
<integer>0</integer>
<key>bookmark</key>
- <string>8BBFF88B20AD86E4005650EF</string>
+ <string>8B79402021F60A00006E9731</string>
<key>history</key>
<array>
- <string>8BBFF88A20AD86E4005650EF</string>
+ <string>8B79401F21F60A00006E9731</string>
</array>
</dict>
<key>SplitCount</key>
@@ -366,18 +366,18 @@
<key>GeometryConfiguration</key>
<dict>
<key>Frame</key>
- <string>{{0, 0}, {603, 132}}</string>
+ <string>{{0, 0}, {603, 117}}</string>
<key>RubberWindowFrame</key>
- <string>21 283 810 487 0 0 1440 878 </string>
+ <string>283 293 810 487 0 0 1440 878 </string>
</dict>
<key>Module</key>
<string>PBXNavigatorGroup</string>
<key>Proportion</key>
- <string>132pt</string>
+ <string>117pt</string>
</dict>
<dict>
<key>Proportion</key>
- <string>309pt</string>
+ <string>324pt</string>
<key>Tabs</key>
<array>
<dict>
@@ -391,7 +391,7 @@
<key>GeometryConfiguration</key>
<dict>
<key>Frame</key>
- <string>{{10, 27}, {603, 414}}</string>
+ <string>{{10, 27}, {603, 297}}</string>
</dict>
<key>Module</key>
<string>XCDetailModule</string>
@@ -445,9 +445,9 @@
<key>GeometryConfiguration</key>
<dict>
<key>Frame</key>
- <string>{{10, 27}, {603, 282}}</string>
+ <string>{{10, 27}, {603, 297}}</string>
<key>RubberWindowFrame</key>
- <string>21 283 810 487 0 0 1440 878 </string>
+ <string>283 293 810 487 0 0 1440 878 </string>
</dict>
<key>Module</key>
<string>PBXBuildResultsModule</string>
@@ -475,11 +475,11 @@
</array>
<key>TableOfContents</key>
<array>
- <string>8BBFF88C20AD86E4005650EF</string>
+ <string>8B79402121F60A00006E9731</string>
<string>1CA23ED40692098700951B8B</string>
- <string>8BBFF88D20AD86E4005650EF</string>
+ <string>8B79402221F60A00006E9731</string>
<string>8B0237581D42B1C400E1E8C8</string>
- <string>8BBFF88E20AD86E4005650EF</string>
+ <string>8B79402321F60A00006E9731</string>
<string>1CA23EDF0692099D00951B8B</string>
<string>1CA23EE00692099D00951B8B</string>
<string>1CA23EE10692099D00951B8B</string>
@@ -632,7 +632,7 @@
<key>StatusbarIsVisible</key>
<true/>
<key>TimeStamp</key>
- <real>548243172.70111001</real>
+ <real>569772544.89690602</real>
<key>ToolbarConfigUserDefaultsMinorVersion</key>
<string>2</string>
<key>ToolbarDisplayMode</key>
@@ -649,11 +649,10 @@
<integer>5</integer>
<key>WindowOrderList</key>
<array>
- <string>8BBFF88F20AD86E4005650EF</string>
- <string>/Users/christopherjohnson/Desktop/Spiral/Spiral.xcodeproj</string>
+ <string>/Users/christopherjohnson/Desktop/MacVST/Spiral/Spiral.xcodeproj</string>
</array>
<key>WindowString</key>
- <string>21 283 810 487 0 0 1440 878 </string>
+ <string>283 293 810 487 0 0 1440 878 </string>
<key>WindowToolsV3</key>
<array>
<dict>
diff --git a/plugins/MacVST/Spiral/source/SpiralProc.cpp b/plugins/MacVST/Spiral/source/SpiralProc.cpp
index d43a93a..4aea5bc 100755
--- a/plugins/MacVST/Spiral/source/SpiralProc.cpp
+++ b/plugins/MacVST/Spiral/source/SpiralProc.cpp
@@ -60,18 +60,14 @@ void Spiral::processReplacing(float **inputs, float **outputs, VstInt32 sampleFr
inputSampleL = sin(inputSampleL * fabs(inputSampleL)) / ((inputSampleL == 0.0) ?1:fabs(inputSampleL));
inputSampleR = sin(inputSampleR * fabs(inputSampleR)) / ((inputSampleR == 0.0) ?1:fabs(inputSampleR));
- //noise shaping to 32-bit floating point
- float fpTemp = inputSampleL;
- fpNShapeL += (inputSampleL-fpTemp);
- inputSampleL += fpNShapeL;
- //if this confuses you look at the wordlength for fpTemp :)
- fpTemp = inputSampleR;
- fpNShapeR += (inputSampleR-fpTemp);
- inputSampleR += fpNShapeR;
- //for deeper space and warmth, we try a non-oscillating noise shaping
- //that is kind of ruthless: it will forever retain the rounding errors
- //except we'll dial it back a hair at the end of every buffer processed
- //end noise shaping on 32 bit output
+ //stereo 32 bit dither, made small and tidy.
+ int expon; frexpf((float)inputSampleL, &expon);
+ long double dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62);
+ inputSampleL += (dither-fpNShapeL); fpNShapeL = dither;
+ frexpf((float)inputSampleR, &expon);
+ dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62);
+ inputSampleR += (dither-fpNShapeR); fpNShapeR = dither;
+ //end 32 bit dither
*out1 = inputSampleL;
*out2 = inputSampleR;
@@ -81,12 +77,6 @@ void Spiral::processReplacing(float **inputs, float **outputs, VstInt32 sampleFr
*out1++;
*out2++;
}
- fpNShapeL *= 0.999999;
- fpNShapeR *= 0.999999;
- //we will just delicately dial back the FP noise shaping, not even every sample
- //this is a good place to put subtle 'no runaway' calculations, though bear in mind
- //that it will be called more often when you use shorter sample buffers in the DAW.
- //So, very low latency operation will call these calculations more often.
}
void Spiral::processDoubleReplacing(double **inputs, double **outputs, VstInt32 sampleFrames)
@@ -142,18 +132,16 @@ void Spiral::processDoubleReplacing(double **inputs, double **outputs, VstInt32
inputSampleL = sin(inputSampleL * fabs(inputSampleL)) / ((inputSampleL == 0.0) ?1:fabs(inputSampleL));
inputSampleR = sin(inputSampleR * fabs(inputSampleR)) / ((inputSampleR == 0.0) ?1:fabs(inputSampleR));
- //noise shaping to 64-bit floating point
- double fpTemp = inputSampleL;
- fpNShapeL += (inputSampleL-fpTemp);
- inputSampleL += fpNShapeL;
- //if this confuses you look at the wordlength for fpTemp :)
- fpTemp = inputSampleR;
- fpNShapeR += (inputSampleR-fpTemp);
- inputSampleR += fpNShapeR;
- //for deeper space and warmth, we try a non-oscillating noise shaping
- //that is kind of ruthless: it will forever retain the rounding errors
- //except we'll dial it back a hair at the end of every buffer processed
- //end noise shaping on 64 bit output
+ //stereo 64 bit dither, made small and tidy.
+ int expon; frexp((double)inputSampleL, &expon);
+ long double dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62);
+ dither /= 536870912.0; //needs this to scale to 64 bit zone
+ inputSampleL += (dither-fpNShapeL); fpNShapeL = dither;
+ frexp((double)inputSampleR, &expon);
+ dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62);
+ dither /= 536870912.0; //needs this to scale to 64 bit zone
+ inputSampleR += (dither-fpNShapeR); fpNShapeR = dither;
+ //end 64 bit dither
*out1 = inputSampleL;
*out2 = inputSampleR;
@@ -163,10 +151,4 @@ void Spiral::processDoubleReplacing(double **inputs, double **outputs, VstInt32
*out1++;
*out2++;
}
- fpNShapeL *= 0.999999;
- fpNShapeR *= 0.999999;
- //we will just delicately dial back the FP noise shaping, not even every sample
- //this is a good place to put subtle 'no runaway' calculations, though bear in mind
- //that it will be called more often when you use shorter sample buffers in the DAW.
- //So, very low latency operation will call these calculations more often.
}