aboutsummaryrefslogtreecommitdiffstats
path: root/plugins/MacVST/Bite
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/Bite
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/Bite')
-rwxr-xr-xplugins/MacVST/Bite/Bite.xcodeproj/christopherjohnson.pbxuser16
-rwxr-xr-xplugins/MacVST/Bite/Bite.xcodeproj/christopherjohnson.perspectivev313
-rwxr-xr-xplugins/MacVST/Bite/source/Bite.cpp7
-rwxr-xr-xplugins/MacVST/Bite/source/Bite.h7
-rwxr-xr-xplugins/MacVST/Bite/source/BiteProc.cpp62
5 files changed, 36 insertions, 69 deletions
diff --git a/plugins/MacVST/Bite/Bite.xcodeproj/christopherjohnson.pbxuser b/plugins/MacVST/Bite/Bite.xcodeproj/christopherjohnson.pbxuser
index 110bab7..70f9ad3 100755
--- a/plugins/MacVST/Bite/Bite.xcodeproj/christopherjohnson.pbxuser
+++ b/plugins/MacVST/Bite/Bite.xcodeproj/christopherjohnson.pbxuser
@@ -49,12 +49,12 @@
PBXFileDataSource_Warnings_ColumnID,
);
};
- PBXPerProjectTemplateStateSaveDate = 528459162;
- PBXWorkspaceStateSaveDate = 528459162;
+ PBXPerProjectTemplateStateSaveDate = 569718265;
+ PBXWorkspaceStateSaveDate = 569718265;
};
perUserProjectItems = {
+ 8B79344521F53610006E9731 /* PBXTextBookmark */ = 8B79344521F53610006E9731 /* PBXTextBookmark */;
8B9D778D1F7FA5B8007AB60F /* PBXTextBookmark */ = 8B9D778D1F7FA5B8007AB60F /* PBXTextBookmark */;
- 8BCA84A31EC2586000521D27 /* PBXTextBookmark */ = 8BCA84A31EC2586000521D27 /* PBXTextBookmark */;
};
sourceControlManager = 8B02375E1D42B1C400E1E8C8 /* Source Control */;
userBuildSettings = {
@@ -78,7 +78,7 @@
};
24A2FFDB0F90D1DD003BB5A7 /* audioeffectx.cpp */ = {
uiCtxt = {
- sepNavIntBoundsRect = "{{0, 0}, {747, 19877}}";
+ sepNavIntBoundsRect = "{{0, 0}, {747, 19864}}";
sepNavSelRange = "{10616, 0}";
sepNavVisRange = "{0, 0}";
sepNavWindowFrame = "{{15, 42}, {895, 831}}";
@@ -86,9 +86,9 @@
};
24D8286F09A914000093AEF8 /* BiteProc.cpp */ = {
uiCtxt = {
- sepNavIntBoundsRect = "{{0, 0}, {554, 3783}}";
+ sepNavIntBoundsRect = "{{0, 0}, {848, 3458}}";
sepNavSelRange = "{4277, 0}";
- sepNavVisRange = "{0, 0}";
+ sepNavVisRange = "{0, 1351}";
sepNavWindowFrame = "{{205, 46}, {895, 831}}";
};
};
@@ -106,7 +106,7 @@
isa = PBXCodeSenseManager;
indexTemplatePath = "";
};
- 8B9D778D1F7FA5B8007AB60F /* PBXTextBookmark */ = {
+ 8B79344521F53610006E9731 /* PBXTextBookmark */ = {
isa = PBXTextBookmark;
fRef = 24A2FFDB0F90D1DD003BB5A7 /* audioeffectx.cpp */;
name = "audioeffectx.cpp: 307";
@@ -116,7 +116,7 @@
vrLen = 0;
vrLoc = 0;
};
- 8BCA84A31EC2586000521D27 /* PBXTextBookmark */ = {
+ 8B9D778D1F7FA5B8007AB60F /* PBXTextBookmark */ = {
isa = PBXTextBookmark;
fRef = 24A2FFDB0F90D1DD003BB5A7 /* audioeffectx.cpp */;
name = "audioeffectx.cpp: 307";
diff --git a/plugins/MacVST/Bite/Bite.xcodeproj/christopherjohnson.perspectivev3 b/plugins/MacVST/Bite/Bite.xcodeproj/christopherjohnson.perspectivev3
index 991888c..58ed0f1 100755
--- a/plugins/MacVST/Bite/Bite.xcodeproj/christopherjohnson.perspectivev3
+++ b/plugins/MacVST/Bite/Bite.xcodeproj/christopherjohnson.perspectivev3
@@ -351,10 +351,10 @@
<key>_historyCapacity</key>
<integer>0</integer>
<key>bookmark</key>
- <string>8B9D778D1F7FA5B8007AB60F</string>
+ <string>8B79344521F53610006E9731</string>
<key>history</key>
<array>
- <string>8BCA84A31EC2586000521D27</string>
+ <string>8B9D778D1F7FA5B8007AB60F</string>
</array>
</dict>
<key>SplitCount</key>
@@ -477,11 +477,11 @@
</array>
<key>TableOfContents</key>
<array>
- <string>8B9D778E1F7FA5B8007AB60F</string>
+ <string>8B79344621F53610006E9731</string>
<string>1CA23ED40692098700951B8B</string>
- <string>8B9D778F1F7FA5B8007AB60F</string>
+ <string>8B79344721F53610006E9731</string>
<string>8B0237581D42B1C400E1E8C8</string>
- <string>8B9D77901F7FA5B8007AB60F</string>
+ <string>8B79344821F53610006E9731</string>
<string>1CA23EDF0692099D00951B8B</string>
<string>1CA23EE00692099D00951B8B</string>
<string>1CA23EE10692099D00951B8B</string>
@@ -634,7 +634,7 @@
<key>StatusbarIsVisible</key>
<true/>
<key>TimeStamp</key>
- <real>528459192.24507099</real>
+ <real>569718288.19823003</real>
<key>ToolbarConfigUserDefaultsMinorVersion</key>
<string>2</string>
<key>ToolbarDisplayMode</key>
@@ -651,7 +651,6 @@
<integer>5</integer>
<key>WindowOrderList</key>
<array>
- <string>8B9D77911F7FA5B8007AB60F</string>
<string>/Users/christopherjohnson/Desktop/MacVST/Bite/Bite.xcodeproj</string>
</array>
<key>WindowString</key>
diff --git a/plugins/MacVST/Bite/source/Bite.cpp b/plugins/MacVST/Bite/source/Bite.cpp
index b563f54..c9d0fcb 100755
--- a/plugins/MacVST/Bite/source/Bite.cpp
+++ b/plugins/MacVST/Bite/source/Bite.cpp
@@ -34,11 +34,8 @@ Bite::Bite(audioMasterCallback audioMaster) :
sampleHR = 0.0;
sampleIR = 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/Bite/source/Bite.h b/plugins/MacVST/Bite/source/Bite.h
index d6f9e44..288ac7f 100755
--- a/plugins/MacVST/Bite/source/Bite.h
+++ b/plugins/MacVST/Bite/source/Bite.h
@@ -53,11 +53,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 sampleAL;
double sampleBL;
diff --git a/plugins/MacVST/Bite/source/BiteProc.cpp b/plugins/MacVST/Bite/source/BiteProc.cpp
index 690a998..64e0ac4 100755
--- a/plugins/MacVST/Bite/source/BiteProc.cpp
+++ b/plugins/MacVST/Bite/source/BiteProc.cpp
@@ -17,9 +17,6 @@ void Bite::processReplacing(float **inputs, float **outputs, VstInt32 sampleFram
double overallscale = 1.3;
overallscale /= 44100.0;
overallscale *= getSampleRate();
- float fpTemp;
- long double fpOld = 0.618033988749894848204586; //golden ratio!
- long double fpNew = 1.0 - fpOld;
double gain = ((A*2.0)-1.0)*overallscale;
double outputgain = B;
@@ -119,25 +116,14 @@ void Bite::processReplacing(float **inputs, float **outputs, VstInt32 sampleFram
inputSampleR *= outputgain;
}
- //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;
@@ -159,9 +145,6 @@ void Bite::processDoubleReplacing(double **inputs, double **outputs, VstInt32 sa
double overallscale = 1.3;
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 gain = ((A*2.0)-1.0)*overallscale;
double outputgain = B;
@@ -261,25 +244,16 @@ void Bite::processDoubleReplacing(double **inputs, double **outputs, VstInt32 sa
inputSampleR *= outputgain;
}
- //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;