aboutsummaryrefslogtreecommitdiffstats
path: root/plugins/MacVST/FromTape
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/FromTape
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/FromTape')
-rwxr-xr-xplugins/MacVST/FromTape/FromTape.xcodeproj/christopherjohnson.pbxuser34
-rwxr-xr-xplugins/MacVST/FromTape/FromTape.xcodeproj/christopherjohnson.perspectivev352
-rwxr-xr-xplugins/MacVST/FromTape/FromTape.xcodeproj/project.pbxproj4
-rwxr-xr-xplugins/MacVST/FromTape/source/FromTape.cpp7
-rwxr-xr-xplugins/MacVST/FromTape/source/FromTape.h7
-rwxr-xr-xplugins/MacVST/FromTape/source/FromTapeProc.cpp62
6 files changed, 34 insertions, 132 deletions
diff --git a/plugins/MacVST/FromTape/FromTape.xcodeproj/christopherjohnson.pbxuser b/plugins/MacVST/FromTape/FromTape.xcodeproj/christopherjohnson.pbxuser
index c1ba3e0..dc3d1fa 100755
--- a/plugins/MacVST/FromTape/FromTape.xcodeproj/christopherjohnson.pbxuser
+++ b/plugins/MacVST/FromTape/FromTape.xcodeproj/christopherjohnson.pbxuser
@@ -2,7 +2,7 @@
{
089C1669FE841209C02AAC07 /* Project object */ = {
activeBuildConfigurationName = Release;
- activeTarget = 8D01CCC60486CAD60068D4B7 /* FromTape */;
+ activeTarget = 8D01CCC60486CAD60068D4B7 /* AudioUnit */;
breakpoints = (
);
codeSenseManager = 8B02375F1D42B1C400E1E8C8 /* Code sense */;
@@ -51,12 +51,8 @@
PBXFileDataSource_Warnings_ColumnID,
);
};
- PBXPerProjectTemplateStateSaveDate = 528460565;
- PBXWorkspaceStateSaveDate = 528460565;
- };
- perUserProjectItems = {
- 8B9D6C631F7EE5D4007AB60F /* PBXTextBookmark */ = 8B9D6C631F7EE5D4007AB60F /* PBXTextBookmark */;
- 8B9D7A521F7FAB2D007AB60F /* PBXTextBookmark */ = 8B9D7A521F7FAB2D007AB60F /* PBXTextBookmark */;
+ PBXPerProjectTemplateStateSaveDate = 569735440;
+ PBXWorkspaceStateSaveDate = 569735440;
};
sourceControlManager = 8B02375E1D42B1C400E1E8C8 /* Source Control */;
userBuildSettings = {
@@ -72,7 +68,7 @@
};
245463B80991757100464AD3 /* FromTape.h */ = {
uiCtxt = {
- sepNavIntBoundsRect = "{{0, 0}, {866, 1807}}";
+ sepNavIntBoundsRect = "{{0, 0}, {866, 1768}}";
sepNavSelRange = "{3812, 0}";
sepNavVisRange = "{329, 2291}";
sepNavWindowFrame = "{{545, 47}, {895, 831}}";
@@ -108,27 +104,7 @@
isa = PBXCodeSenseManager;
indexTemplatePath = "";
};
- 8B9D6C631F7EE5D4007AB60F /* PBXTextBookmark */ = {
- isa = PBXTextBookmark;
- fRef = 245463B80991757100464AD3 /* FromTape.h */;
- name = "FromTape.h: 128";
- rLen = 0;
- rLoc = 3812;
- rType = 0;
- vrLen = 2291;
- vrLoc = 329;
- };
- 8B9D7A521F7FAB2D007AB60F /* PBXTextBookmark */ = {
- isa = PBXTextBookmark;
- fRef = 245463B80991757100464AD3 /* FromTape.h */;
- name = "FromTape.h: 128";
- rLen = 0;
- rLoc = 3812;
- rType = 0;
- vrLen = 2291;
- vrLoc = 329;
- };
- 8D01CCC60486CAD60068D4B7 /* FromTape */ = {
+ 8D01CCC60486CAD60068D4B7 /* AudioUnit */ = {
activeExec = 0;
};
}
diff --git a/plugins/MacVST/FromTape/FromTape.xcodeproj/christopherjohnson.perspectivev3 b/plugins/MacVST/FromTape/FromTape.xcodeproj/christopherjohnson.perspectivev3
index 8d556d7..070d7b1 100755
--- a/plugins/MacVST/FromTape/FromTape.xcodeproj/christopherjohnson.perspectivev3
+++ b/plugins/MacVST/FromTape/FromTape.xcodeproj/christopherjohnson.perspectivev3
@@ -222,48 +222,7 @@
</dict>
</array>
<key>OpenEditors</key>
- <array>
- <dict>
- <key>Content</key>
- <dict>
- <key>PBXProjectModuleGUID</key>
- <string>8B2B778A1F6D6FF800A2CD5B</string>
- <key>PBXProjectModuleLabel</key>
- <string>FromTape.h</string>
- <key>PBXSplitModuleInNavigatorKey</key>
- <dict>
- <key>Split0</key>
- <dict>
- <key>PBXProjectModuleGUID</key>
- <string>8B2B778B1F6D6FF800A2CD5B</string>
- <key>PBXProjectModuleLabel</key>
- <string>FromTape.h</string>
- <key>_historyCapacity</key>
- <integer>0</integer>
- <key>bookmark</key>
- <string>8B9D7A521F7FAB2D007AB60F</string>
- <key>history</key>
- <array>
- <string>8B9D6C631F7EE5D4007AB60F</string>
- </array>
- </dict>
- <key>SplitCount</key>
- <string>1</string>
- </dict>
- <key>StatusBarVisibility</key>
- <true/>
- </dict>
- <key>Geometry</key>
- <dict>
- <key>Frame</key>
- <string>{{0, 20}, {895, 734}}</string>
- <key>PBXModuleWindowStatusBarHidden2</key>
- <false/>
- <key>RubberWindowFrame</key>
- <string>545 103 895 775 0 0 1440 878 </string>
- </dict>
- </dict>
- </array>
+ <array/>
<key>PerspectiveWidths</key>
<array>
<integer>810</integer>
@@ -510,11 +469,11 @@
</array>
<key>TableOfContents</key>
<array>
- <string>8B9D7A4F1F7FAB2D007AB60F</string>
+ <string>8B793AA321F5791C006E9731</string>
<string>1CA23ED40692098700951B8B</string>
- <string>8B9D7A501F7FAB2D007AB60F</string>
+ <string>8B793AA421F5791C006E9731</string>
<string>8B0237581D42B1C400E1E8C8</string>
- <string>8B9D7A511F7FAB2D007AB60F</string>
+ <string>8B793AA521F5791C006E9731</string>
<string>1CA23EDF0692099D00951B8B</string>
<string>1CA23EE00692099D00951B8B</string>
<string>1CA23EE10692099D00951B8B</string>
@@ -687,7 +646,7 @@
<key>StatusbarIsVisible</key>
<true/>
<key>TimeStamp</key>
- <real>528460589.56712198</real>
+ <real>569735452.09700799</real>
<key>ToolbarConfigUserDefaultsMinorVersion</key>
<string>2</string>
<key>ToolbarDisplayMode</key>
@@ -704,7 +663,6 @@
<integer>5</integer>
<key>WindowOrderList</key>
<array>
- <string>8B9D7A531F7FAB2D007AB60F</string>
<string>8B2B778A1F6D6FF800A2CD5B</string>
<string>/Users/christopherjohnson/Desktop/MacVST/FromTape/FromTape.xcodeproj</string>
</array>
diff --git a/plugins/MacVST/FromTape/FromTape.xcodeproj/project.pbxproj b/plugins/MacVST/FromTape/FromTape.xcodeproj/project.pbxproj
index 1f0cea0..8175f33 100755
--- a/plugins/MacVST/FromTape/FromTape.xcodeproj/project.pbxproj
+++ b/plugins/MacVST/FromTape/FromTape.xcodeproj/project.pbxproj
@@ -1894,7 +1894,7 @@
/* End PBXHeadersBuildPhase section */
/* Begin PBXNativeTarget section */
- 8D01CCC60486CAD60068D4B7 /* FromTape */ = {
+ 8D01CCC60486CAD60068D4B7 /* AudioUnit */ = {
isa = PBXNativeTarget;
buildConfigurationList = 24BEAAED08919AE700E695F9 /* Build configuration list for PBXNativeTarget "FromTape" */;
buildPhases = (
@@ -1947,7 +1947,7 @@
);
projectRoot = "";
targets = (
- 8D01CCC60486CAD60068D4B7 /* FromTape */,
+ 8D01CCC60486CAD60068D4B7 /* AudioUnit */,
);
};
/* End PBXProject section */
diff --git a/plugins/MacVST/FromTape/source/FromTape.cpp b/plugins/MacVST/FromTape/source/FromTape.cpp
index 55c5ced..40b7876 100755
--- a/plugins/MacVST/FromTape/source/FromTape.cpp
+++ b/plugins/MacVST/FromTape/source/FromTape.cpp
@@ -82,11 +82,8 @@ FromTape::FromTape(audioMasterCallback audioMaster) :
flip = 0;
- fpNShapeLA = 0.0;
- fpNShapeLB = 0.0;
- fpNShapeRA = 0.0;
- fpNShapeRB = 0.0;
- fpFlip = true;
+ fpNShapeL = 0.0;
+ fpNShapeR = 0.0;
//this is reset: values being initialized only once. Startup values, whatever they are.
_canDo.insert("plugAsChannelInsert"); // plug-in can be used as a channel insert effect.
diff --git a/plugins/MacVST/FromTape/source/FromTape.h b/plugins/MacVST/FromTape/source/FromTape.h
index 376b767..40efabc 100755
--- a/plugins/MacVST/FromTape/source/FromTape.h
+++ b/plugins/MacVST/FromTape/source/FromTape.h
@@ -120,11 +120,8 @@ private:
double iirSampleYR;
double iirSampleZR;
- long double fpNShapeLA;
- long double fpNShapeLB;
- long double fpNShapeRA;
- long double fpNShapeRB;
- bool fpFlip;
+ long double fpNShapeL;
+ long double fpNShapeR;
//default stuff
float A;
diff --git a/plugins/MacVST/FromTape/source/FromTapeProc.cpp b/plugins/MacVST/FromTape/source/FromTapeProc.cpp
index 42753e5..2d268ef 100755
--- a/plugins/MacVST/FromTape/source/FromTapeProc.cpp
+++ b/plugins/MacVST/FromTape/source/FromTapeProc.cpp
@@ -37,9 +37,6 @@ void FromTape::processReplacing(float **inputs, float **outputs, VstInt32 sample
double drySampleR;
double randy;
double invrandy;
- float fpTemp;
- long double fpOld = 0.618033988749894848204586; //golden ratio!
- long double fpNew = 1.0 - fpOld;
long double inputSampleL;
long double inputSampleR;
@@ -224,25 +221,14 @@ void FromTape::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;
@@ -284,9 +270,6 @@ void FromTape::processDoubleReplacing(double **inputs, double **outputs, VstInt3
double drySampleR;
double randy;
double invrandy;
- 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;
@@ -471,25 +454,16 @@ void FromTape::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;