aboutsummaryrefslogtreecommitdiffstats
path: root/plugins/MacVST/Swell
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/Swell
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/Swell')
-rwxr-xr-xplugins/MacVST/Swell/Swell.xcodeproj/christopherjohnson.pbxuser8
-rwxr-xr-xplugins/MacVST/Swell/Swell.xcodeproj/christopherjohnson.perspectivev310
-rwxr-xr-xplugins/MacVST/Swell/Swell.xcodeproj/project.pbxproj4
-rwxr-xr-xplugins/MacVST/Swell/source/Swell.cpp7
-rwxr-xr-xplugins/MacVST/Swell/source/Swell.h7
-rwxr-xr-xplugins/MacVST/Swell/source/SwellProc.cpp62
6 files changed, 33 insertions, 65 deletions
diff --git a/plugins/MacVST/Swell/Swell.xcodeproj/christopherjohnson.pbxuser b/plugins/MacVST/Swell/Swell.xcodeproj/christopherjohnson.pbxuser
index dcb6a41..6dbf178 100755
--- a/plugins/MacVST/Swell/Swell.xcodeproj/christopherjohnson.pbxuser
+++ b/plugins/MacVST/Swell/Swell.xcodeproj/christopherjohnson.pbxuser
@@ -2,7 +2,7 @@
{
089C1669FE841209C02AAC07 /* Project object */ = {
activeBuildConfigurationName = Release;
- activeTarget = 8D01CCC60486CAD60068D4B7 /* Swell */;
+ activeTarget = 8D01CCC60486CAD60068D4B7 /* AudioUnit */;
codeSenseManager = 8B02375F1D42B1C400E1E8C8 /* Code sense */;
perUserDictionary = {
PBXConfiguration.PBXFileTableDataSource3.PBXFileTableDataSource = {
@@ -49,8 +49,8 @@
PBXFileDataSource_Warnings_ColumnID,
);
};
- PBXPerProjectTemplateStateSaveDate = 532491124;
- PBXWorkspaceStateSaveDate = 532491124;
+ PBXPerProjectTemplateStateSaveDate = 569772934;
+ PBXWorkspaceStateSaveDate = 569772934;
};
sourceControlManager = 8B02375E1D42B1C400E1E8C8 /* Source Control */;
userBuildSettings = {
@@ -102,7 +102,7 @@
isa = PBXCodeSenseManager;
indexTemplatePath = "";
};
- 8D01CCC60486CAD60068D4B7 /* Swell */ = {
+ 8D01CCC60486CAD60068D4B7 /* AudioUnit */ = {
activeExec = 0;
};
}
diff --git a/plugins/MacVST/Swell/Swell.xcodeproj/christopherjohnson.perspectivev3 b/plugins/MacVST/Swell/Swell.xcodeproj/christopherjohnson.perspectivev3
index c2e2adb..4bb2aa5 100755
--- a/plugins/MacVST/Swell/Swell.xcodeproj/christopherjohnson.perspectivev3
+++ b/plugins/MacVST/Swell/Swell.xcodeproj/christopherjohnson.perspectivev3
@@ -469,11 +469,11 @@
</array>
<key>TableOfContents</key>
<array>
- <string>8BCC7CDC1FBD2FDD00982BD6</string>
+ <string>8B79410721F60B8F006E9731</string>
<string>1CA23ED40692098700951B8B</string>
- <string>8BCC7CDD1FBD2FDD00982BD6</string>
+ <string>8B79410821F60B8F006E9731</string>
<string>8B0237581D42B1C400E1E8C8</string>
- <string>8BCC7CDE1FBD2FDD00982BD6</string>
+ <string>8B79410921F60B8F006E9731</string>
<string>1CA23EDF0692099D00951B8B</string>
<string>1CA23EE00692099D00951B8B</string>
<string>1CA23EE10692099D00951B8B</string>
@@ -626,7 +626,7 @@
<key>StatusbarIsVisible</key>
<true/>
<key>TimeStamp</key>
- <real>532492253.86718899</real>
+ <real>569772943.08427894</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/Swell/Swell.xcodeproj</string>
+ <string>/Users/christopherjohnson/Desktop/MacVST/Swell/Swell.xcodeproj</string>
</array>
<key>WindowString</key>
<string>21 352 810 487 0 0 1440 878 </string>
diff --git a/plugins/MacVST/Swell/Swell.xcodeproj/project.pbxproj b/plugins/MacVST/Swell/Swell.xcodeproj/project.pbxproj
index 30d06b4..eb22bb1 100755
--- a/plugins/MacVST/Swell/Swell.xcodeproj/project.pbxproj
+++ b/plugins/MacVST/Swell/Swell.xcodeproj/project.pbxproj
@@ -1894,7 +1894,7 @@
/* End PBXHeadersBuildPhase section */
/* Begin PBXNativeTarget section */
- 8D01CCC60486CAD60068D4B7 /* Swell */ = {
+ 8D01CCC60486CAD60068D4B7 /* AudioUnit */ = {
isa = PBXNativeTarget;
buildConfigurationList = 24BEAAED08919AE700E695F9 /* Build configuration list for PBXNativeTarget "Swell" */;
buildPhases = (
@@ -1947,7 +1947,7 @@
);
projectRoot = "";
targets = (
- 8D01CCC60486CAD60068D4B7 /* Swell */,
+ 8D01CCC60486CAD60068D4B7 /* AudioUnit */,
);
};
/* End PBXProject section */
diff --git a/plugins/MacVST/Swell/source/Swell.cpp b/plugins/MacVST/Swell/source/Swell.cpp
index 30518d8..e197cfb 100755
--- a/plugins/MacVST/Swell/source/Swell.cpp
+++ b/plugins/MacVST/Swell/source/Swell.cpp
@@ -21,11 +21,8 @@ Swell::Swell(audioMasterCallback audioMaster) :
louderL = false;
louderR = false;
- 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/Swell/source/Swell.h b/plugins/MacVST/Swell/source/Swell.h
index c383df2..7c108b7 100755
--- a/plugins/MacVST/Swell/source/Swell.h
+++ b/plugins/MacVST/Swell/source/Swell.h
@@ -54,11 +54,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
diff --git a/plugins/MacVST/Swell/source/SwellProc.cpp b/plugins/MacVST/Swell/source/SwellProc.cpp
index 28c0aba..3ab1e9b 100755
--- a/plugins/MacVST/Swell/source/SwellProc.cpp
+++ b/plugins/MacVST/Swell/source/SwellProc.cpp
@@ -17,9 +17,6 @@ void Swell::processReplacing(float **inputs, float **outputs, VstInt32 sampleFra
double overallscale = 1.0;
overallscale /= 44100.0;
overallscale *= getSampleRate();
- float fpTemp;
- long double fpOld = 0.618033988749894848204586; //golden ratio!
- long double fpNew = 1.0 - fpOld;
double thresholdOn = pow(A,2) * B;
double speedOn = (pow(B,2)*0.001)/overallscale;
@@ -97,25 +94,14 @@ void Swell::processReplacing(float **inputs, float **outputs, VstInt32 sampleFra
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;
@@ -137,9 +123,6 @@ void Swell::processDoubleReplacing(double **inputs, double **outputs, VstInt32 s
double overallscale = 1.0;
overallscale /= 44100.0;
overallscale *= getSampleRate();
- double fpTemp;
- long double fpOld = 0.618033988749894848204586; //golden ratio!
- long double fpNew = 1.0 - fpOld;
double thresholdOn = pow(A,2) * B;
double speedOn = (pow(B,2)*0.001)/overallscale;
@@ -217,25 +200,16 @@ void Swell::processDoubleReplacing(double **inputs, double **outputs, VstInt32 s
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;