-
Notifications
You must be signed in to change notification settings - Fork 146
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'sdatkinson:main' into themeColors
- Loading branch information
Showing
25 changed files
with
258 additions
and
68 deletions.
There are no files selected for viewing
Submodule AudioDSPTools
updated
2 files
+56 −15 | dsp/ResamplingContainer/Dependencies/LanczosResampler.h | |
+10 −1 | dsp/ResamplingContainer/ResamplingContainer.h |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
#include "ToneStack.h" | ||
|
||
DSP_SAMPLE** dsp::tone_stack::BasicNamToneStack::Process(DSP_SAMPLE** inputs, const int numChannels, | ||
const int numFrames) | ||
{ | ||
DSP_SAMPLE** bassPointers = mToneBass.Process(inputs, numChannels, numFrames); | ||
DSP_SAMPLE** midPointers = mToneMid.Process(bassPointers, numChannels, numFrames); | ||
DSP_SAMPLE** treblePointers = mToneTreble.Process(midPointers, numChannels, numFrames); | ||
return treblePointers; | ||
} | ||
|
||
void dsp::tone_stack::BasicNamToneStack::Reset(const double sampleRate, const int maxBlockSize) | ||
{ | ||
dsp::tone_stack::AbstractToneStack::Reset(sampleRate, maxBlockSize); | ||
|
||
// Refresh the params! | ||
SetParam("bass", mBassVal); | ||
SetParam("middle", mMiddleVal); | ||
SetParam("treble", mTrebleVal); | ||
} | ||
|
||
void dsp::tone_stack::BasicNamToneStack::SetParam(const std::string name, const double val) | ||
{ | ||
if (name == "bass") | ||
{ | ||
// HACK: Store for refresh | ||
mBassVal = val; | ||
const double sampleRate = GetSampleRate(); | ||
const double bassGainDB = 4.0 * (val - 5.0); // +/- 20 | ||
const double bassFrequency = 150.0; | ||
const double bassQuality = 0.707; | ||
recursive_linear_filter::BiquadParams bassParams(sampleRate, bassFrequency, bassQuality, bassGainDB); | ||
mToneBass.SetParams(bassParams); | ||
} | ||
else if (name == "middle") | ||
{ | ||
// HACK: Store for refresh | ||
mMiddleVal = val; | ||
const double sampleRate = GetSampleRate(); | ||
const double midGainDB = 3.0 * (val - 5.0); // +/- 15 | ||
const double midFrequency = 425.0; | ||
// Wider EQ on mid bump up to sound less honky. | ||
const double midQuality = midGainDB < 0.0 ? 1.5 : 0.7; | ||
recursive_linear_filter::BiquadParams midParams(sampleRate, midFrequency, midQuality, midGainDB); | ||
mToneMid.SetParams(midParams); | ||
} | ||
else if (name == "treble") | ||
{ | ||
// HACK: Store for refresh | ||
mTrebleVal = val; | ||
const double sampleRate = GetSampleRate(); | ||
const double trebleGainDB = 2.0 * (val - 5.0); // +/- 10 | ||
const double trebleFrequency = 1800.0; | ||
const double trebleQuality = 0.707; | ||
recursive_linear_filter::BiquadParams trebleParams(sampleRate, trebleFrequency, trebleQuality, trebleGainDB); | ||
mToneTreble.SetParams(trebleParams); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
#pragma once | ||
|
||
#include <string> | ||
#include "AudioDSPTools/dsp/dsp.h" | ||
#include "AudioDSPTools/dsp/RecursiveLinearFilter.h" | ||
|
||
namespace dsp | ||
{ | ||
namespace tone_stack | ||
{ | ||
class AbstractToneStack | ||
{ | ||
public: | ||
// Compute in the real-time loop | ||
virtual DSP_SAMPLE** Process(DSP_SAMPLE** inputs, const int numChannels, const int numFrames) = 0; | ||
// Any preparation. Call from Reset() in the plugin | ||
virtual void Reset(const double sampleRate, const int maxBlockSize) | ||
{ | ||
mSampleRate = sampleRate; | ||
mMaxBlockSize = maxBlockSize; | ||
}; | ||
// Set the various parameters of your tone stack by name. | ||
// Call this during OnParamChange() | ||
virtual void SetParam(const std::string name, const double val) = 0; | ||
|
||
protected: | ||
double GetSampleRate() const { return mSampleRate; }; | ||
double mSampleRate = 0.0; | ||
int mMaxBlockSize = 0; | ||
}; | ||
|
||
class BasicNamToneStack : public AbstractToneStack | ||
{ | ||
public: | ||
BasicNamToneStack() | ||
{ | ||
SetParam("bass", 5.0); | ||
SetParam("middle", 5.0); | ||
SetParam("treble", 5.0); | ||
}; | ||
~BasicNamToneStack() = default; | ||
|
||
DSP_SAMPLE** Process(DSP_SAMPLE** inputs, const int numChannels, const int numFrames); | ||
virtual void Reset(const double sampleRate, const int maxBlockSize) override; | ||
// :param val: Assumed to be between 0 and 10, 5 is "noon" | ||
void SetParam(const std::string name, const double val); | ||
|
||
|
||
protected: | ||
recursive_linear_filter::LowShelf mToneBass; | ||
recursive_linear_filter::Peaking mToneMid; | ||
recursive_linear_filter::HighShelf mToneTreble; | ||
|
||
// HACK not DRY w knob defs | ||
double mBassVal = 5.0; | ||
double mMiddleVal = 5.0; | ||
double mTrebleVal = 5.0; | ||
}; | ||
}; // namespace tone_stack | ||
}; // namespace dsp |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.