aboutsummaryrefslogtreecommitdiffstats
path: root/plugins/MacVST/TapeDust
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/TapeDust
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/TapeDust')
-rwxr-xr-xplugins/MacVST/TapeDust/TapeDust.xcodeproj/christopherjohnson.pbxuser26
-rwxr-xr-xplugins/MacVST/TapeDust/TapeDust.xcodeproj/christopherjohnson.perspectivev323
-rwxr-xr-xplugins/MacVST/TapeDust/TapeDust.xcodeproj/project.pbxproj4
-rwxr-xr-xplugins/MacVST/TapeDust/source/TapeDust.cpp6
-rwxr-xr-xplugins/MacVST/TapeDust/source/TapeDust.h6
-rwxr-xr-xplugins/MacVST/TapeDust/source/TapeDustProc.cpp64
6 files changed, 50 insertions, 79 deletions
diff --git a/plugins/MacVST/TapeDust/TapeDust.xcodeproj/christopherjohnson.pbxuser b/plugins/MacVST/TapeDust/TapeDust.xcodeproj/christopherjohnson.pbxuser
index 3c2546d..db5f0e9 100755
--- a/plugins/MacVST/TapeDust/TapeDust.xcodeproj/christopherjohnson.pbxuser
+++ b/plugins/MacVST/TapeDust/TapeDust.xcodeproj/christopherjohnson.pbxuser
@@ -2,7 +2,7 @@
{
089C1669FE841209C02AAC07 /* Project object */ = {
activeBuildConfigurationName = Release;
- activeTarget = 8D01CCC60486CAD60068D4B7 /* AudioUnit */;
+ activeTarget = 8D01CCC60486CAD60068D4B7 /* TapeDust */;
codeSenseManager = 8B02375F1D42B1C400E1E8C8 /* Code sense */;
perUserDictionary = {
PBXConfiguration.PBXFileTableDataSource3.PBXFileTableDataSource = {
@@ -49,8 +49,8 @@
PBXFileDataSource_Warnings_ColumnID,
);
};
- PBXPerProjectTemplateStateSaveDate = 528463643;
- PBXWorkspaceStateSaveDate = 528463643;
+ PBXPerProjectTemplateStateSaveDate = 569772990;
+ PBXWorkspaceStateSaveDate = 569772990;
};
sourceControlManager = 8B02375E1D42B1C400E1E8C8 /* Source Control */;
userBuildSettings = {
@@ -58,18 +58,18 @@
};
2407DEB6089929BA00EB68BF /* TapeDust.cpp */ = {
uiCtxt = {
- sepNavIntBoundsRect = "{{0, 0}, {848, 1807}}";
- sepNavSelRange = "{4129, 0}";
- sepNavVisRange = "{0, 1910}";
+ sepNavIntBoundsRect = "{{0, 0}, {848, 1781}}";
+ sepNavSelRange = "{641, 0}";
+ sepNavVisRange = "{0, 1873}";
sepNavWindowFrame = "{{527, 47}, {895, 831}}";
};
};
245463B80991757100464AD3 /* TapeDust.h */ = {
uiCtxt = {
- sepNavIntBoundsRect = "{{0, 0}, {866, 832}}";
- sepNavSelRange = "{421, 0}";
- sepNavVisRange = "{0, 2396}";
- sepNavWindowFrame = "{{513, 34}, {895, 831}}";
+ sepNavIntBoundsRect = "{{0, 0}, {866, 936}}";
+ sepNavSelRange = "{2457, 0}";
+ sepNavVisRange = "{365, 2218}";
+ sepNavWindowFrame = "{{513, 39}, {895, 831}}";
};
};
24A2FFDB0F90D1DD003BB5A7 /* audioeffectx.cpp */ = {
@@ -82,9 +82,9 @@
};
24D8286F09A914000093AEF8 /* TapeDustProc.cpp */ = {
uiCtxt = {
- sepNavIntBoundsRect = "{{0, 0}, {848, 3653}}";
+ sepNavIntBoundsRect = "{{0, 0}, {848, 3484}}";
sepNavSelRange = "{5633, 1892}";
- sepNavVisRange = "{315, 2084}";
+ sepNavVisRange = "{1840, 1844}";
sepNavWindowFrame = "{{296, 47}, {895, 831}}";
};
};
@@ -102,7 +102,7 @@
isa = PBXCodeSenseManager;
indexTemplatePath = "";
};
- 8D01CCC60486CAD60068D4B7 /* AudioUnit */ = {
+ 8D01CCC60486CAD60068D4B7 /* TapeDust */ = {
activeExec = 0;
};
}
diff --git a/plugins/MacVST/TapeDust/TapeDust.xcodeproj/christopherjohnson.perspectivev3 b/plugins/MacVST/TapeDust/TapeDust.xcodeproj/christopherjohnson.perspectivev3
index 2985e5f..908494e 100755
--- a/plugins/MacVST/TapeDust/TapeDust.xcodeproj/christopherjohnson.perspectivev3
+++ b/plugins/MacVST/TapeDust/TapeDust.xcodeproj/christopherjohnson.perspectivev3
@@ -361,18 +361,18 @@
<key>GeometryConfiguration</key>
<dict>
<key>Frame</key>
- <string>{{0, 0}, {531, 202}}</string>
+ <string>{{0, 0}, {531, 188}}</string>
<key>RubberWindowFrame</key>
<string>280 175 841 654 0 0 1440 878 </string>
</dict>
<key>Module</key>
<string>PBXNavigatorGroup</string>
<key>Proportion</key>
- <string>202pt</string>
+ <string>188pt</string>
</dict>
<dict>
<key>Proportion</key>
- <string>406pt</string>
+ <string>420pt</string>
<key>Tabs</key>
<array>
<dict>
@@ -386,9 +386,7 @@
<key>GeometryConfiguration</key>
<dict>
<key>Frame</key>
- <string>{{10, 27}, {531, 379}}</string>
- <key>RubberWindowFrame</key>
- <string>280 175 841 654 0 0 1440 878 </string>
+ <string>{{10, 27}, {531, 393}}</string>
</dict>
<key>Module</key>
<string>XCDetailModule</string>
@@ -442,7 +440,9 @@
<key>GeometryConfiguration</key>
<dict>
<key>Frame</key>
- <string>{{10, 27}, {531, 339}}</string>
+ <string>{{10, 27}, {531, 393}}</string>
+ <key>RubberWindowFrame</key>
+ <string>280 175 841 654 0 0 1440 878 </string>
</dict>
<key>Module</key>
<string>PBXBuildResultsModule</string>
@@ -470,11 +470,11 @@
</array>
<key>TableOfContents</key>
<array>
- <string>8B9D7EE21F7FB727007AB60F</string>
+ <string>8B79415321F60BEB006E9731</string>
<string>1CA23ED40692098700951B8B</string>
- <string>8B9D7EE31F7FB727007AB60F</string>
+ <string>8B79415421F60BEB006E9731</string>
<string>8BD7274A1D46E5A5000176F0</string>
- <string>8B9D7EE41F7FB727007AB60F</string>
+ <string>8B79415521F60BEB006E9731</string>
<string>1CA23EDF0692099D00951B8B</string>
<string>1CA23EE00692099D00951B8B</string>
<string>1CA23EE10692099D00951B8B</string>
@@ -647,7 +647,7 @@
<key>StatusbarIsVisible</key>
<true/>
<key>TimeStamp</key>
- <real>528463655.50013697</real>
+ <real>569773035.93911803</real>
<key>ToolbarConfigUserDefaultsMinorVersion</key>
<string>2</string>
<key>ToolbarDisplayMode</key>
@@ -664,7 +664,6 @@
<integer>5</integer>
<key>WindowOrderList</key>
<array>
- <string>8B9D7EE51F7FB727007AB60F</string>
<string>/Users/christopherjohnson/Desktop/MacVST/TapeDust/TapeDust.xcodeproj</string>
</array>
<key>WindowString</key>
diff --git a/plugins/MacVST/TapeDust/TapeDust.xcodeproj/project.pbxproj b/plugins/MacVST/TapeDust/TapeDust.xcodeproj/project.pbxproj
index 2a33807..5d00f6e 100755
--- a/plugins/MacVST/TapeDust/TapeDust.xcodeproj/project.pbxproj
+++ b/plugins/MacVST/TapeDust/TapeDust.xcodeproj/project.pbxproj
@@ -1894,7 +1894,7 @@
/* End PBXHeadersBuildPhase section */
/* Begin PBXNativeTarget section */
- 8D01CCC60486CAD60068D4B7 /* AudioUnit */ = {
+ 8D01CCC60486CAD60068D4B7 /* TapeDust */ = {
isa = PBXNativeTarget;
buildConfigurationList = 24BEAAED08919AE700E695F9 /* Build configuration list for PBXNativeTarget "TapeDust" */;
buildPhases = (
@@ -1947,7 +1947,7 @@
);
projectRoot = "";
targets = (
- 8D01CCC60486CAD60068D4B7 /* AudioUnit */,
+ 8D01CCC60486CAD60068D4B7 /* TapeDust */,
);
};
/* End PBXProject section */
diff --git a/plugins/MacVST/TapeDust/source/TapeDust.cpp b/plugins/MacVST/TapeDust/source/TapeDust.cpp
index 9638c14..0ce16e0 100755
--- a/plugins/MacVST/TapeDust/source/TapeDust.cpp
+++ b/plugins/MacVST/TapeDust/source/TapeDust.cpp
@@ -22,10 +22,8 @@ TapeDust::TapeDust(audioMasterCallback audioMaster) :
fR[count] = 0.0;
}
- fpNShapeLA = 0.0;
- fpNShapeLB = 0.0;
- fpNShapeRA = 0.0;
- fpNShapeRB = 0.0;
+ fpNShapeL = 0.0;
+ fpNShapeR = 0.0;
fpFlip = true;
//this is reset: values being initialized only once. Startup values, whatever they are.
diff --git a/plugins/MacVST/TapeDust/source/TapeDust.h b/plugins/MacVST/TapeDust/source/TapeDust.h
index 7b3a7fd..facbf40 100755
--- a/plugins/MacVST/TapeDust/source/TapeDust.h
+++ b/plugins/MacVST/TapeDust/source/TapeDust.h
@@ -53,10 +53,8 @@ private:
char _programName[kVstMaxProgNameLen + 1];
std::set< std::string > _canDo;
- long double fpNShapeLA;
- long double fpNShapeLB;
- long double fpNShapeRA;
- long double fpNShapeRB;
+ long double fpNShapeL;
+ long double fpNShapeR;
bool fpFlip;
//default stuff
diff --git a/plugins/MacVST/TapeDust/source/TapeDustProc.cpp b/plugins/MacVST/TapeDust/source/TapeDustProc.cpp
index 3d6588d..429a366 100755
--- a/plugins/MacVST/TapeDust/source/TapeDustProc.cpp
+++ b/plugins/MacVST/TapeDust/source/TapeDustProc.cpp
@@ -13,9 +13,6 @@ void TapeDust::processReplacing(float **inputs, float **outputs, VstInt32 sample
float* in2 = inputs[1];
float* out1 = outputs[0];
float* out2 = outputs[1];
- float fpTemp;
- long double fpOld = 0.618033988749894848204586; //golden ratio!
- long double fpNew = 1.0 - fpOld;
long double inputSampleL;
long double inputSampleR;
@@ -93,6 +90,7 @@ void TapeDust::processReplacing(float **inputs, float **outputs, VstInt32 sample
inputSampleL = -inputSampleL;
inputSampleR = -inputSampleR;
}
+ fpFlip = !fpFlip;
for(int count = 0; count < 9; count++) {
if (gainL > 1.0) {
@@ -120,25 +118,14 @@ void TapeDust::processReplacing(float **inputs, float **outputs, VstInt32 sample
inputSampleR = (inputSampleR * wet) + (drySampleR * dry);
}
- //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((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;
@@ -156,9 +143,6 @@ void TapeDust::processDoubleReplacing(double **inputs, double **outputs, VstInt3
double* in2 = inputs[1];
double* out1 = outputs[0];
double* out2 = outputs[1];
- double fpTemp; //this is different from singlereplacing
- long double fpOld = 0.618033988749894848204586; //golden ratio!
- long double fpNew = 1.0 - fpOld;
long double inputSampleL;
long double inputSampleR;
@@ -236,6 +220,7 @@ void TapeDust::processDoubleReplacing(double **inputs, double **outputs, VstInt3
inputSampleL = -inputSampleL;
inputSampleR = -inputSampleR;
}
+ fpFlip = !fpFlip;
for(int count = 0; count < 9; count++) {
if (gainL > 1.0) {
@@ -263,25 +248,16 @@ void TapeDust::processDoubleReplacing(double **inputs, double **outputs, VstInt3
inputSampleR = (inputSampleR * wet) + (drySampleR * dry);
}
- //noise shaping to 64-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 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;