aboutsummaryrefslogtreecommitdiffstats
path: root/plugins/MacVST/PurestDrive
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/PurestDrive
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/PurestDrive')
-rwxr-xr-x[-rw-r--r--]plugins/MacVST/PurestDrive/PurestDrive.xcodeproj/christopherjohnson.pbxuser8
-rwxr-xr-x[-rw-r--r--]plugins/MacVST/PurestDrive/PurestDrive.xcodeproj/christopherjohnson.perspectivev310
-rwxr-xr-x[-rw-r--r--]plugins/MacVST/PurestDrive/PurestDrive.xcodeproj/project.xcworkspace/contents.xcworkspacedata0
-rwxr-xr-x[-rw-r--r--]plugins/MacVST/PurestDrive/PurestDrive.xcodeproj/project.xcworkspace/xcuserdata/christopherjohnson.xcuserdatad/UserInterfaceState.xcuserstatebin12075 -> 12075 bytes
-rwxr-xr-x[-rw-r--r--]plugins/MacVST/PurestDrive/PurestDrive.xcodeproj/project.xcworkspace/xcuserdata/spiadmin.xcuserdatad/UserInterfaceState.xcuserstatebin10373 -> 10373 bytes
-rwxr-xr-x[-rw-r--r--]plugins/MacVST/PurestDrive/PurestDrive.xcodeproj/spiadmin.mode1v30
-rwxr-xr-x[-rw-r--r--]plugins/MacVST/PurestDrive/PurestDrive.xcodeproj/spiadmin.pbxuser0
-rwxr-xr-x[-rw-r--r--]plugins/MacVST/PurestDrive/PurestDrive.xcodeproj/xcuserdata/christopherjohnson.xcuserdatad/xcschemes/Gain.xcscheme0
-rwxr-xr-x[-rw-r--r--]plugins/MacVST/PurestDrive/PurestDrive.xcodeproj/xcuserdata/christopherjohnson.xcuserdatad/xcschemes/xcschememanagement.plist0
-rwxr-xr-x[-rw-r--r--]plugins/MacVST/PurestDrive/PurestDrive.xcodeproj/xcuserdata/spiadmin.xcuserdatad/xcschemes/xcschememanagement.plist0
-rwxr-xr-x[-rw-r--r--]plugins/MacVST/PurestDrive/PurestDrive.xcodeproj/xcuserdata/spiadmin.xcuserdatad/xcschemes/«PROJECTNAME».xcscheme0
-rwxr-xr-xplugins/MacVST/PurestDrive/source/PurestDrive.cpp7
-rwxr-xr-xplugins/MacVST/PurestDrive/source/PurestDrive.h7
-rwxr-xr-xplugins/MacVST/PurestDrive/source/PurestDriveProc.cpp62
14 files changed, 31 insertions, 63 deletions
diff --git a/plugins/MacVST/PurestDrive/PurestDrive.xcodeproj/christopherjohnson.pbxuser b/plugins/MacVST/PurestDrive/PurestDrive.xcodeproj/christopherjohnson.pbxuser
index 12c4f1e..d8eeda2 100644..100755
--- a/plugins/MacVST/PurestDrive/PurestDrive.xcodeproj/christopherjohnson.pbxuser
+++ b/plugins/MacVST/PurestDrive/PurestDrive.xcodeproj/christopherjohnson.pbxuser
@@ -2,7 +2,7 @@
{
089C1669FE841209C02AAC07 /* Project object */ = {
activeBuildConfigurationName = Release;
- activeTarget = 8D01CCC60486CAD60068D4B7 /* PurestDrive */;
+ activeTarget = 8D01CCC60486CAD60068D4B7 /* AudioUnit */;
codeSenseManager = 8B02375F1D42B1C400E1E8C8 /* Code sense */;
perUserDictionary = {
PBXConfiguration.PBXFileTableDataSource3.PBXFileTableDataSource = {
@@ -49,8 +49,8 @@
PBXFileDataSource_Warnings_ColumnID,
);
};
- PBXPerProjectTemplateStateSaveDate = 538683677;
- PBXWorkspaceStateSaveDate = 538683677;
+ PBXPerProjectTemplateStateSaveDate = 569771199;
+ PBXWorkspaceStateSaveDate = 569771199;
};
sourceControlManager = 8B02375E1D42B1C400E1E8C8 /* Source Control */;
userBuildSettings = {
@@ -102,7 +102,7 @@
isa = PBXCodeSenseManager;
indexTemplatePath = "";
};
- 8D01CCC60486CAD60068D4B7 /* PurestDrive */ = {
+ 8D01CCC60486CAD60068D4B7 /* AudioUnit */ = {
activeExec = 0;
};
}
diff --git a/plugins/MacVST/PurestDrive/PurestDrive.xcodeproj/christopherjohnson.perspectivev3 b/plugins/MacVST/PurestDrive/PurestDrive.xcodeproj/christopherjohnson.perspectivev3
index 41e246d..461e4df 100644..100755
--- a/plugins/MacVST/PurestDrive/PurestDrive.xcodeproj/christopherjohnson.perspectivev3
+++ b/plugins/MacVST/PurestDrive/PurestDrive.xcodeproj/christopherjohnson.perspectivev3
@@ -469,11 +469,11 @@
</array>
<key>TableOfContents</key>
<array>
- <string>8B4E5444201BA92300B5DC2A</string>
+ <string>8B793E9D21F604DA006E9731</string>
<string>1CA23ED40692098700951B8B</string>
- <string>8B4E5445201BA92300B5DC2A</string>
+ <string>8B793E9E21F604DA006E9731</string>
<string>8B0237581D42B1C400E1E8C8</string>
- <string>8B4E5446201BA92300B5DC2A</string>
+ <string>8B793E9F21F604DA006E9731</string>
<string>1CA23EDF0692099D00951B8B</string>
<string>1CA23EE00692099D00951B8B</string>
<string>1CA23EE10692099D00951B8B</string>
@@ -626,7 +626,7 @@
<key>StatusbarIsVisible</key>
<true/>
<key>TimeStamp</key>
- <real>538684550.59728301</real>
+ <real>569771226.28827202</real>
<key>ToolbarConfigUserDefaultsMinorVersion</key>
<string>2</string>
<key>ToolbarDisplayMode</key>
@@ -643,7 +643,7 @@
<integer>5</integer>
<key>WindowOrderList</key>
<array>
- <string>/Users/christopherjohnson/Desktop/PurestDrive/PurestDrive.xcodeproj</string>
+ <string>/Users/christopherjohnson/Desktop/MacVST/PurestDrive/PurestDrive.xcodeproj</string>
</array>
<key>WindowString</key>
<string>9 381 810 487 0 0 1440 878 </string>
diff --git a/plugins/MacVST/PurestDrive/PurestDrive.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/plugins/MacVST/PurestDrive/PurestDrive.xcodeproj/project.xcworkspace/contents.xcworkspacedata
index a80c038..a80c038 100644..100755
--- a/plugins/MacVST/PurestDrive/PurestDrive.xcodeproj/project.xcworkspace/contents.xcworkspacedata
+++ b/plugins/MacVST/PurestDrive/PurestDrive.xcodeproj/project.xcworkspace/contents.xcworkspacedata
diff --git a/plugins/MacVST/PurestDrive/PurestDrive.xcodeproj/project.xcworkspace/xcuserdata/christopherjohnson.xcuserdatad/UserInterfaceState.xcuserstate b/plugins/MacVST/PurestDrive/PurestDrive.xcodeproj/project.xcworkspace/xcuserdata/christopherjohnson.xcuserdatad/UserInterfaceState.xcuserstate
index 5c38f94..5c38f94 100644..100755
--- a/plugins/MacVST/PurestDrive/PurestDrive.xcodeproj/project.xcworkspace/xcuserdata/christopherjohnson.xcuserdatad/UserInterfaceState.xcuserstate
+++ b/plugins/MacVST/PurestDrive/PurestDrive.xcodeproj/project.xcworkspace/xcuserdata/christopherjohnson.xcuserdatad/UserInterfaceState.xcuserstate
Binary files differ
diff --git a/plugins/MacVST/PurestDrive/PurestDrive.xcodeproj/project.xcworkspace/xcuserdata/spiadmin.xcuserdatad/UserInterfaceState.xcuserstate b/plugins/MacVST/PurestDrive/PurestDrive.xcodeproj/project.xcworkspace/xcuserdata/spiadmin.xcuserdatad/UserInterfaceState.xcuserstate
index 314de0f..314de0f 100644..100755
--- a/plugins/MacVST/PurestDrive/PurestDrive.xcodeproj/project.xcworkspace/xcuserdata/spiadmin.xcuserdatad/UserInterfaceState.xcuserstate
+++ b/plugins/MacVST/PurestDrive/PurestDrive.xcodeproj/project.xcworkspace/xcuserdata/spiadmin.xcuserdatad/UserInterfaceState.xcuserstate
Binary files differ
diff --git a/plugins/MacVST/PurestDrive/PurestDrive.xcodeproj/spiadmin.mode1v3 b/plugins/MacVST/PurestDrive/PurestDrive.xcodeproj/spiadmin.mode1v3
index c572326..c572326 100644..100755
--- a/plugins/MacVST/PurestDrive/PurestDrive.xcodeproj/spiadmin.mode1v3
+++ b/plugins/MacVST/PurestDrive/PurestDrive.xcodeproj/spiadmin.mode1v3
diff --git a/plugins/MacVST/PurestDrive/PurestDrive.xcodeproj/spiadmin.pbxuser b/plugins/MacVST/PurestDrive/PurestDrive.xcodeproj/spiadmin.pbxuser
index df94780..df94780 100644..100755
--- a/plugins/MacVST/PurestDrive/PurestDrive.xcodeproj/spiadmin.pbxuser
+++ b/plugins/MacVST/PurestDrive/PurestDrive.xcodeproj/spiadmin.pbxuser
diff --git a/plugins/MacVST/PurestDrive/PurestDrive.xcodeproj/xcuserdata/christopherjohnson.xcuserdatad/xcschemes/Gain.xcscheme b/plugins/MacVST/PurestDrive/PurestDrive.xcodeproj/xcuserdata/christopherjohnson.xcuserdatad/xcschemes/Gain.xcscheme
index 8ee693f..8ee693f 100644..100755
--- a/plugins/MacVST/PurestDrive/PurestDrive.xcodeproj/xcuserdata/christopherjohnson.xcuserdatad/xcschemes/Gain.xcscheme
+++ b/plugins/MacVST/PurestDrive/PurestDrive.xcodeproj/xcuserdata/christopherjohnson.xcuserdatad/xcschemes/Gain.xcscheme
diff --git a/plugins/MacVST/PurestDrive/PurestDrive.xcodeproj/xcuserdata/christopherjohnson.xcuserdatad/xcschemes/xcschememanagement.plist b/plugins/MacVST/PurestDrive/PurestDrive.xcodeproj/xcuserdata/christopherjohnson.xcuserdatad/xcschemes/xcschememanagement.plist
index 5bccbcb..5bccbcb 100644..100755
--- a/plugins/MacVST/PurestDrive/PurestDrive.xcodeproj/xcuserdata/christopherjohnson.xcuserdatad/xcschemes/xcschememanagement.plist
+++ b/plugins/MacVST/PurestDrive/PurestDrive.xcodeproj/xcuserdata/christopherjohnson.xcuserdatad/xcschemes/xcschememanagement.plist
diff --git a/plugins/MacVST/PurestDrive/PurestDrive.xcodeproj/xcuserdata/spiadmin.xcuserdatad/xcschemes/xcschememanagement.plist b/plugins/MacVST/PurestDrive/PurestDrive.xcodeproj/xcuserdata/spiadmin.xcuserdatad/xcschemes/xcschememanagement.plist
index a7bdd62..a7bdd62 100644..100755
--- a/plugins/MacVST/PurestDrive/PurestDrive.xcodeproj/xcuserdata/spiadmin.xcuserdatad/xcschemes/xcschememanagement.plist
+++ b/plugins/MacVST/PurestDrive/PurestDrive.xcodeproj/xcuserdata/spiadmin.xcuserdatad/xcschemes/xcschememanagement.plist
diff --git a/plugins/MacVST/PurestDrive/PurestDrive.xcodeproj/xcuserdata/spiadmin.xcuserdatad/xcschemes/«PROJECTNAME».xcscheme b/plugins/MacVST/PurestDrive/PurestDrive.xcodeproj/xcuserdata/spiadmin.xcuserdatad/xcschemes/«PROJECTNAME».xcscheme
index 0df2de4..0df2de4 100644..100755
--- a/plugins/MacVST/PurestDrive/PurestDrive.xcodeproj/xcuserdata/spiadmin.xcuserdatad/xcschemes/«PROJECTNAME».xcscheme
+++ b/plugins/MacVST/PurestDrive/PurestDrive.xcodeproj/xcuserdata/spiadmin.xcuserdatad/xcschemes/«PROJECTNAME».xcscheme
diff --git a/plugins/MacVST/PurestDrive/source/PurestDrive.cpp b/plugins/MacVST/PurestDrive/source/PurestDrive.cpp
index e2451fe..a1d9264 100755
--- a/plugins/MacVST/PurestDrive/source/PurestDrive.cpp
+++ b/plugins/MacVST/PurestDrive/source/PurestDrive.cpp
@@ -17,11 +17,8 @@ PurestDrive::PurestDrive(audioMasterCallback audioMaster) :
previousSampleL = 0.0;
previousSampleR = 0.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/PurestDrive/source/PurestDrive.h b/plugins/MacVST/PurestDrive/source/PurestDrive.h
index 1f5b349..abcd65b 100755
--- a/plugins/MacVST/PurestDrive/source/PurestDrive.h
+++ b/plugins/MacVST/PurestDrive/source/PurestDrive.h
@@ -52,11 +52,8 @@ private:
char _programName[kVstMaxProgNameLen + 1];
std::set< std::string > _canDo;
- long double fpNShapeLA;
- long double fpNShapeLB;
- long double fpNShapeRA;
- long double fpNShapeRB;
- bool fpFlip;
+ long double fpNShapeL;
+ long double fpNShapeR;
//default stuff
double previousSampleL;
diff --git a/plugins/MacVST/PurestDrive/source/PurestDriveProc.cpp b/plugins/MacVST/PurestDrive/source/PurestDriveProc.cpp
index e453883..f5cc804 100755
--- a/plugins/MacVST/PurestDrive/source/PurestDriveProc.cpp
+++ b/plugins/MacVST/PurestDrive/source/PurestDriveProc.cpp
@@ -14,9 +14,6 @@ void PurestDrive::processReplacing(float **inputs, float **outputs, VstInt32 sam
float* out1 = outputs[0];
float* out2 = outputs[1];
- float fpTemp;
- long double fpOld = 0.618033988749894848204586; //golden ratio!
- long double fpNew = 1.0 - fpOld;
double intensity = A;
double drySampleL;
@@ -90,25 +87,14 @@ void PurestDrive::processReplacing(float **inputs, float **outputs, VstInt32 sam
previousSampleR = sin(drySampleR);
//apply the sine while storing previous sample
- //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;
@@ -127,9 +113,6 @@ void PurestDrive::processDoubleReplacing(double **inputs, double **outputs, VstI
double* out1 = outputs[0];
double* out2 = outputs[1];
- double fpTemp;
- long double fpOld = 0.618033988749894848204586; //golden ratio!
- long double fpNew = 1.0 - fpOld;
double intensity = A;
double drySampleL;
@@ -204,25 +187,16 @@ void PurestDrive::processDoubleReplacing(double **inputs, double **outputs, VstI
previousSampleR = sin(drySampleR);
//apply the sine while storing previous sample
- //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;