aboutsummaryrefslogtreecommitdiffstats
path: root/plugins/MacVST/Fracture
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/Fracture
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/Fracture')
-rwxr-xr-xplugins/MacVST/Fracture/Fracture.xcodeproj/christopherjohnson.pbxuser4
-rwxr-xr-xplugins/MacVST/Fracture/Fracture.xcodeproj/christopherjohnson.perspectivev313
-rwxr-xr-xplugins/MacVST/Fracture/source/Fracture.cpp7
-rwxr-xr-xplugins/MacVST/Fracture/source/Fracture.h7
-rwxr-xr-xplugins/MacVST/Fracture/source/FractureProc.cpp62
5 files changed, 31 insertions, 62 deletions
diff --git a/plugins/MacVST/Fracture/Fracture.xcodeproj/christopherjohnson.pbxuser b/plugins/MacVST/Fracture/Fracture.xcodeproj/christopherjohnson.pbxuser
index 319327c..46f29ff 100755
--- a/plugins/MacVST/Fracture/Fracture.xcodeproj/christopherjohnson.pbxuser
+++ b/plugins/MacVST/Fracture/Fracture.xcodeproj/christopherjohnson.pbxuser
@@ -49,8 +49,8 @@
PBXFileDataSource_Warnings_ColumnID,
);
};
- PBXPerProjectTemplateStateSaveDate = 528460537;
- PBXWorkspaceStateSaveDate = 528460537;
+ PBXPerProjectTemplateStateSaveDate = 569735404;
+ PBXWorkspaceStateSaveDate = 569735404;
};
sourceControlManager = 8B02375E1D42B1C400E1E8C8 /* Source Control */;
userBuildSettings = {
diff --git a/plugins/MacVST/Fracture/Fracture.xcodeproj/christopherjohnson.perspectivev3 b/plugins/MacVST/Fracture/Fracture.xcodeproj/christopherjohnson.perspectivev3
index 3c29fa7..da6f297 100755
--- a/plugins/MacVST/Fracture/Fracture.xcodeproj/christopherjohnson.perspectivev3
+++ b/plugins/MacVST/Fracture/Fracture.xcodeproj/christopherjohnson.perspectivev3
@@ -339,13 +339,15 @@
<key>PBXProjectModuleGUID</key>
<string>8B0237581D42B1C400E1E8C8</string>
<key>PBXProjectModuleLabel</key>
- <string>&lt;No Editor&gt;</string>
+ <string></string>
<key>PBXSplitModuleInNavigatorKey</key>
<dict>
<key>Split0</key>
<dict>
<key>PBXProjectModuleGUID</key>
<string>8B0237591D42B1C400E1E8C8</string>
+ <key>PBXProjectModuleLabel</key>
+ <string></string>
</dict>
<key>SplitCount</key>
<string>1</string>
@@ -467,11 +469,11 @@
</array>
<key>TableOfContents</key>
<array>
- <string>8B9D7A301F7FAB0C007AB60F</string>
+ <string>8B793A8421F578F8006E9731</string>
<string>1CA23ED40692098700951B8B</string>
- <string>8B9D7A311F7FAB0C007AB60F</string>
+ <string>8B793A8521F578F8006E9731</string>
<string>8B0237581D42B1C400E1E8C8</string>
- <string>8B9D7A321F7FAB0C007AB60F</string>
+ <string>8B793A8621F578F8006E9731</string>
<string>1CA23EDF0692099D00951B8B</string>
<string>1CA23EE00692099D00951B8B</string>
<string>1CA23EE10692099D00951B8B</string>
@@ -624,7 +626,7 @@
<key>StatusbarIsVisible</key>
<true/>
<key>TimeStamp</key>
- <real>528460556.044348</real>
+ <real>569735416.520316</real>
<key>ToolbarConfigUserDefaultsMinorVersion</key>
<string>2</string>
<key>ToolbarDisplayMode</key>
@@ -641,7 +643,6 @@
<integer>5</integer>
<key>WindowOrderList</key>
<array>
- <string>8B9D7A331F7FAB0C007AB60F</string>
<string>/Users/christopherjohnson/Desktop/MacVST/Fracture/Fracture.xcodeproj</string>
</array>
<key>WindowString</key>
diff --git a/plugins/MacVST/Fracture/source/Fracture.cpp b/plugins/MacVST/Fracture/source/Fracture.cpp
index 255475a..03f3b19 100755
--- a/plugins/MacVST/Fracture/source/Fracture.cpp
+++ b/plugins/MacVST/Fracture/source/Fracture.cpp
@@ -16,11 +16,8 @@ Fracture::Fracture(audioMasterCallback audioMaster) :
B = 0.5; //2 from 1 to 3: (B*2.999)+1
C = 1.0;
D = 1.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/Fracture/source/Fracture.h b/plugins/MacVST/Fracture/source/Fracture.h
index 659f94b..49d2718 100755
--- a/plugins/MacVST/Fracture/source/Fracture.h
+++ b/plugins/MacVST/Fracture/source/Fracture.h
@@ -55,11 +55,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
float A;
diff --git a/plugins/MacVST/Fracture/source/FractureProc.cpp b/plugins/MacVST/Fracture/source/FractureProc.cpp
index 8e217d8..5c1aaa9 100755
--- a/plugins/MacVST/Fracture/source/FractureProc.cpp
+++ b/plugins/MacVST/Fracture/source/FractureProc.cpp
@@ -14,9 +14,6 @@ void Fracture::processReplacing(float **inputs, float **outputs, VstInt32 sample
float* out1 = outputs[0];
float* out2 = outputs[1];
- float fpTemp;
- long double fpOld = 0.618033988749894848204586; //golden ratio!
- long double fpNew = 1.0 - fpOld;
double density = A*4;
double fracture = (((B*2.999)+1)*3.14159265358979);
@@ -101,25 +98,14 @@ void Fracture::processReplacing(float **inputs, float **outputs, VstInt32 sample
inputSampleL = (drySampleL * dry)+(inputSampleL * wet);
inputSampleR = (drySampleR * dry)+(inputSampleR * wet);
- //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;
@@ -141,9 +127,6 @@ void Fracture::processDoubleReplacing(double **inputs, double **outputs, VstInt3
double overallscale = 1.0;
overallscale /= 44100.0;
overallscale *= getSampleRate();
- double fpTemp; //this is different from singlereplacing
- long double fpOld = 0.618033988749894848204586; //golden ratio!
- long double fpNew = 1.0 - fpOld;
double density = A*4;
double fracture = (((B*2.999)+1)*3.14159265358979);
@@ -228,25 +211,16 @@ void Fracture::processDoubleReplacing(double **inputs, double **outputs, VstInt3
inputSampleL = (drySampleL * dry)+(inputSampleL * wet);
inputSampleR = (drySampleR * dry)+(inputSampleR * wet);
- //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;