Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Moved shelving code to new branch for further development #14

Merged
merged 2 commits into from
May 19, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
58 changes: 1 addition & 57 deletions Source/Biquads.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -205,15 +205,14 @@ void Biquads<SampleType>::coefficients()
const SampleType two = static_cast <SampleType>(2.0);
const SampleType minusOne = static_cast <SampleType>(-1.0);
const SampleType minusTwo = static_cast <SampleType>(-2.0);
const SampleType pi = static_cast<SampleType>(juce::MathConstants<SampleType>::pi);

SampleType omega = static_cast <SampleType>(hz * ((pi * two) / sampleRate));
SampleType cos = static_cast <SampleType>(std::cos(omega));
SampleType sin = static_cast <SampleType>(std::sin(omega));
SampleType tan = static_cast <SampleType>(sin / cos);
SampleType alpha = static_cast <SampleType>(sin * (one - q));
SampleType a = static_cast <SampleType>(juce::Decibels::decibelsToGain(g * static_cast <SampleType>(0.5)));

//SampleType a = static_cast <SampleType>(std::pow(static_cast <SampleType>(10.0), (g / static_cast <SampleType>(40.0))));

juce::ignoreUnused(tan);

Expand Down Expand Up @@ -298,37 +297,6 @@ void Biquads<SampleType>::coefficients()
break;


case filterType::lowShelf:

/*b0 = a * (((a + one) - (cos * (a - one)) ) + );
b1 = a * (two * ((a - one) - (cos * (a + one))));
b2 = a * (((a + one) - (cos * (a - one)) ) - );
a0 = one;
a1 = minusTwo * ((cos * (a + one)) + (a - one));
a2 = zero;*/

b0 = one;
b1 = zero;
b2 = zero;
a0 = one;
a1 = zero;
a2 = zero;

break;


case filterType::highShelf:

b0 = one;
b1 = zero;
b2 = zero;
a0 = one;
a1 = zero;
a2 = zero;

break;


case filterType::bandPass1:

b0 = alpha;
Expand Down Expand Up @@ -365,30 +333,6 @@ void Biquads<SampleType>::coefficients()
break;


case filterType::lowShelf1:

b0 = one;
b1 = zero;
b2 = zero;
a0 = one;
a1 = zero;
a2 = zero;

break;


case filterType::highShelf1:

b0 = one;
b1 = zero;
b2 = zero;
a0 = one;
a1 = zero;
a2 = zero;

break;


default:

b0 = one;
Expand Down
8 changes: 1 addition & 7 deletions Source/Biquads.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,9 @@ enum class FilterType
peak,
notch,
allPass,
lowShelf,
highShelf,
bandPass1,
lowPass1,
highPass1,
lowShelf1,
highShelf1
highPass1
};

enum class TransformationType
Expand Down Expand Up @@ -172,8 +168,6 @@ class Biquads

filterType filtType = filterType::lowPass;
transformationType transformType = transformationType::directFormIItransposed;

const SampleType pi = static_cast<SampleType>(juce::MathConstants<SampleType>::pi);

//==============================================================================
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(Biquads)
Expand Down
14 changes: 3 additions & 11 deletions Source/ProcessorWrapper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ void ProcessWrapper<SampleType>::createParameterLayout(std::vector<std::unique_p
auto freqRange = juce::NormalisableRange<float>(20.00f, 20000.00f, 0.01f, 00.198894f);
auto gainRange = juce::NormalisableRange<float>(-30.00f, 30.00f, 0.01f, 1.00f);

auto fString = juce::StringArray({ "Low Pass", "High Pass", "Band Pass", "Peak", "Notch", "All Pass", "Low Shelf", "High Shelf", "Band Pass (g)", "Low Pass (1)", "High Pass (1)", "Low Shelf (1)", "High Shelf (1)"});
auto fString = juce::StringArray({ "Low Pass", "High Pass", "Band Pass", "Peak", "Notch", "All Pass", "Band Pass (g)", "Low Pass (1)", "High Pass (1)"});
auto tString = juce::StringArray({ "Direct Form I", "Direct Form II", "Direct Form I (t)", "Direct Form II (t)" });
auto osString = juce::StringArray({ "1x", "2x", "4x", "8x", "16x" });

Expand Down Expand Up @@ -125,19 +125,11 @@ void ProcessWrapper<SampleType>::update()
else if (typePtr->getIndex() == 5)
biquad.setFilterType(FilterType::allPass);
else if (typePtr->getIndex() == 6)
biquad.setFilterType(FilterType::lowShelf);
else if (typePtr->getIndex() == 7)
biquad.setFilterType(FilterType::highShelf);
else if (typePtr->getIndex() == 8)
biquad.setFilterType(FilterType::bandPass1);
else if (typePtr->getIndex() == 9)
else if (typePtr->getIndex() == 7)
biquad.setFilterType(FilterType::lowPass1);
else if (typePtr->getIndex() == 10)
else if (typePtr->getIndex() == 8)
biquad.setFilterType(FilterType::highPass1);
else if (typePtr->getIndex() == 11)
biquad.setFilterType(FilterType::lowShelf1);
else if (typePtr->getIndex() == 12)
biquad.setFilterType(FilterType::highShelf1);
else
biquad.setFilterType(FilterType::lowPass);

Expand Down