-
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: falkTX <[email protected]>
- Loading branch information
Showing
8 changed files
with
608 additions
and
2 deletions.
There are no files selected for viewing
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
Submodule dpf
updated
35 files
Submodule dpf-widgets
updated
19 files
+169 −61 | opengl/DearImGui.cpp | |
+3 −0 | opengl/DearImGui.hpp | |
+1 −1 | opengl/DearImGui/README.txt | |
+16 −17 | opengl/DearImGui/imconfig.h | |
+3,842 −1,773 | opengl/DearImGui/imgui.cpp | |
+607 −383 | opengl/DearImGui/imgui.h | |
+641 −452 | opengl/DearImGui/imgui_demo.cpp | |
+154 −163 | opengl/DearImGui/imgui_draw.cpp | |
+22 −9 | opengl/DearImGui/imgui_impl_opengl2.cpp | |
+1 −1 | opengl/DearImGui/imgui_impl_opengl2.h | |
+171 −58 | opengl/DearImGui/imgui_impl_opengl3.cpp | |
+4 −4 | opengl/DearImGui/imgui_impl_opengl3.h | |
+760 −329 | opengl/DearImGui/imgui_internal.h | |
+187 −119 | opengl/DearImGui/imgui_tables.cpp | |
+1,054 −725 | opengl/DearImGui/imgui_widgets.cpp | |
+15 −27 | opengl/DearImGui/imstb_rectpack.h | |
+19 −31 | opengl/DearImGui/imstb_textedit.h | |
+503 −321 | opengl/DearImGui/imstb_truetype.h | |
+1 −1 | tests/Makefile |
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,165 @@ | ||
// | ||
// Biquad.cpp | ||
// | ||
// Created by Nigel Redmon on 11/24/12 | ||
// EarLevel Engineering: earlevel.com | ||
// Copyright 2012 Nigel Redmon | ||
// | ||
// For a complete explanation of the Biquad code: | ||
// http://www.earlevel.com/main/2012/11/26/biquad-c-source-code/ | ||
// | ||
// License: | ||
// | ||
// This source code is provided as is, without warranty. | ||
// You may copy and distribute verbatim copies of this document. | ||
// You may modify and use this source code to create binary code | ||
// for your own purposes, free or commercial. | ||
// | ||
|
||
#include <math.h> | ||
#include "Biquad.h" | ||
|
||
Biquad::Biquad() { | ||
type = bq_type_lowpass; | ||
a0 = 1.0; | ||
a1 = a2 = b1 = b2 = 0.0; | ||
Fc = 0.50; | ||
Q = 0.707; | ||
peakGain = 0.0; | ||
z1 = z2 = 0.0; | ||
} | ||
|
||
Biquad::Biquad(int type, double Fc, double Q, double peakGainDB) { | ||
setBiquad(type, Fc, Q, peakGainDB); | ||
z1 = z2 = 0.0; | ||
} | ||
|
||
Biquad::~Biquad() { | ||
} | ||
|
||
void Biquad::setType(int type) { | ||
this->type = type; | ||
calcBiquad(); | ||
} | ||
|
||
void Biquad::setQ(double Q) { | ||
this->Q = Q; | ||
calcBiquad(); | ||
} | ||
|
||
void Biquad::setFc(double Fc) { | ||
this->Fc = Fc; | ||
calcBiquad(); | ||
} | ||
|
||
void Biquad::setPeakGain(double peakGainDB) { | ||
this->peakGain = peakGainDB; | ||
calcBiquad(); | ||
} | ||
|
||
void Biquad::setBiquad(int type, double Fc, double Q, double peakGainDB) { | ||
this->type = type; | ||
this->Q = Q; | ||
this->Fc = Fc; | ||
setPeakGain(peakGainDB); | ||
} | ||
|
||
void Biquad::calcBiquad(void) { | ||
double norm; | ||
double V = pow(10, fabs(peakGain) / 20.0); | ||
double K = tan(M_PI * Fc); | ||
switch (this->type) { | ||
case bq_type_lowpass: | ||
norm = 1 / (1 + K / Q + K * K); | ||
a0 = K * K * norm; | ||
a1 = 2 * a0; | ||
a2 = a0; | ||
b1 = 2 * (K * K - 1) * norm; | ||
b2 = (1 - K / Q + K * K) * norm; | ||
break; | ||
|
||
case bq_type_highpass: | ||
norm = 1 / (1 + K / Q + K * K); | ||
a0 = 1 * norm; | ||
a1 = -2 * a0; | ||
a2 = a0; | ||
b1 = 2 * (K * K - 1) * norm; | ||
b2 = (1 - K / Q + K * K) * norm; | ||
break; | ||
|
||
case bq_type_bandpass: | ||
norm = 1 / (1 + K / Q + K * K); | ||
a0 = K / Q * norm; | ||
a1 = 0; | ||
a2 = -a0; | ||
b1 = 2 * (K * K - 1) * norm; | ||
b2 = (1 - K / Q + K * K) * norm; | ||
break; | ||
|
||
case bq_type_notch: | ||
norm = 1 / (1 + K / Q + K * K); | ||
a0 = (1 + K * K) * norm; | ||
a1 = 2 * (K * K - 1) * norm; | ||
a2 = a0; | ||
b1 = a1; | ||
b2 = (1 - K / Q + K * K) * norm; | ||
break; | ||
|
||
case bq_type_peak: | ||
if (peakGain >= 0) { // boost | ||
norm = 1 / (1 + 1/Q * K + K * K); | ||
a0 = (1 + V/Q * K + K * K) * norm; | ||
a1 = 2 * (K * K - 1) * norm; | ||
a2 = (1 - V/Q * K + K * K) * norm; | ||
b1 = a1; | ||
b2 = (1 - 1/Q * K + K * K) * norm; | ||
} | ||
else { // cut | ||
norm = 1 / (1 + V/Q * K + K * K); | ||
a0 = (1 + 1/Q * K + K * K) * norm; | ||
a1 = 2 * (K * K - 1) * norm; | ||
a2 = (1 - 1/Q * K + K * K) * norm; | ||
b1 = a1; | ||
b2 = (1 - V/Q * K + K * K) * norm; | ||
} | ||
break; | ||
case bq_type_lowshelf: | ||
if (peakGain >= 0) { // boost | ||
norm = 1 / (1 + sqrt(2) * K + K * K); | ||
a0 = (1 + sqrt(2*V) * K + V * K * K) * norm; | ||
a1 = 2 * (V * K * K - 1) * norm; | ||
a2 = (1 - sqrt(2*V) * K + V * K * K) * norm; | ||
b1 = 2 * (K * K - 1) * norm; | ||
b2 = (1 - sqrt(2) * K + K * K) * norm; | ||
} | ||
else { // cut | ||
norm = 1 / (1 + sqrt(2*V) * K + V * K * K); | ||
a0 = (1 + sqrt(2) * K + K * K) * norm; | ||
a1 = 2 * (K * K - 1) * norm; | ||
a2 = (1 - sqrt(2) * K + K * K) * norm; | ||
b1 = 2 * (V * K * K - 1) * norm; | ||
b2 = (1 - sqrt(2*V) * K + V * K * K) * norm; | ||
} | ||
break; | ||
case bq_type_highshelf: | ||
if (peakGain >= 0) { // boost | ||
norm = 1 / (1 + sqrt(2) * K + K * K); | ||
a0 = (V + sqrt(2*V) * K + K * K) * norm; | ||
a1 = 2 * (K * K - V) * norm; | ||
a2 = (V - sqrt(2*V) * K + K * K) * norm; | ||
b1 = 2 * (K * K - 1) * norm; | ||
b2 = (1 - sqrt(2) * K + K * K) * norm; | ||
} | ||
else { // cut | ||
norm = 1 / (V + sqrt(2*V) * K + K * K); | ||
a0 = (1 + sqrt(2) * K + K * K) * norm; | ||
a1 = 2 * (K * K - 1) * norm; | ||
a2 = (1 - sqrt(2) * K + K * K) * norm; | ||
b1 = 2 * (K * K - V) * norm; | ||
b2 = (V - sqrt(2*V) * K + K * K) * norm; | ||
} | ||
break; | ||
} | ||
|
||
return; | ||
} |
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 @@ | ||
// | ||
// Biquad.h | ||
// | ||
// Created by Nigel Redmon on 11/24/12 | ||
// EarLevel Engineering: earlevel.com | ||
// Copyright 2012 Nigel Redmon | ||
// | ||
// For a complete explanation of the Biquad code: | ||
// http://www.earlevel.com/main/2012/11/26/biquad-c-source-code/ | ||
// | ||
// License: | ||
// | ||
// This source code is provided as is, without warranty. | ||
// You may copy and distribute verbatim copies of this document. | ||
// You may modify and use this source code to create binary code | ||
// for your own purposes, free or commercial. | ||
// | ||
|
||
#ifndef Biquad_h | ||
#define Biquad_h | ||
|
||
enum { | ||
bq_type_lowpass = 0, | ||
bq_type_highpass, | ||
bq_type_bandpass, | ||
bq_type_notch, | ||
bq_type_peak, | ||
bq_type_lowshelf, | ||
bq_type_highshelf | ||
}; | ||
|
||
class Biquad { | ||
public: | ||
Biquad(); | ||
Biquad(int type, double Fc, double Q, double peakGainDB); | ||
~Biquad(); | ||
void setType(int type); | ||
void setQ(double Q); | ||
void setFc(double Fc); | ||
void setPeakGain(double peakGainDB); | ||
void setBiquad(int type, double Fc, double Q, double peakGainDB); | ||
float process(float in); | ||
|
||
protected: | ||
void calcBiquad(void); | ||
|
||
int type; | ||
double a0, a1, a2, b1, b2; | ||
double Fc, Q, peakGain; | ||
double z1, z2; | ||
}; | ||
|
||
inline float Biquad::process(float in) { | ||
double out = in * a0 + z1; | ||
z1 = in * a1 + z2 - b1 * out; | ||
z2 = in * a2 - b2 * out; | ||
return out; | ||
} | ||
|
||
#endif // Biquad_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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
/* | ||
* DISTRHO OneKnob Filter | ||
* Copyright (C) 2023 Filipe Coelho <[email protected]> | ||
* | ||
* This program is free software; you can redistribute it and/or | ||
* modify it under the terms of the GNU General Public License as | ||
* published by the Free Software Foundation; either version 2 of | ||
* the License, or any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* For a full copy of the GNU General Public License see the LICENSE file. | ||
*/ | ||
|
||
#pragma once | ||
|
||
#include "OneKnobPluginInfo.h" | ||
#include "Biquad.h" | ||
|
||
#define DISTRHO_PLUGIN_NAME "OneKnob Filter" | ||
#define DISTRHO_PLUGIN_URI "https://distrho.kx.studio/plugins/oneknob#Filter" | ||
#define DISTRHO_PLUGIN_CLAP_ID "studio.kx.distrho.oneknob.Filter" | ||
|
||
#define DISTRHO_PLUGIN_CLAP_FEATURES "audio-effect", "filter", "stereo" | ||
#define DISTRHO_PLUGIN_LV2_CATEGORY "lv2:FilterPlugin" | ||
#define DISTRHO_PLUGIN_VST3_CATEGORIES "Fx|Filter|Stereo" | ||
|
||
#ifdef __MOD_DEVICES__ | ||
#undef DISTRHO_PLUGIN_NUM_INPUTS | ||
#undef DISTRHO_PLUGIN_NUM_OUTPUTS | ||
#define DISTRHO_PLUGIN_NUM_INPUTS 1 | ||
#define DISTRHO_PLUGIN_NUM_OUTPUTS 1 | ||
#endif | ||
|
||
enum Parameters { | ||
kParameterType = 0, | ||
kParameterFrequency, | ||
kParameterQ, | ||
kParameterGain, | ||
kParameterBypass, | ||
kParameterCount | ||
}; | ||
|
||
enum Programs { | ||
kProgramDefault, | ||
kProgramCount | ||
}; | ||
|
||
enum States { | ||
kStateCount | ||
}; | ||
|
||
static constexpr const struct OneKnobParameterRanges { | ||
float min, def, max; | ||
} kParameterRanges[kParameterCount] = { | ||
{ bq_type_lowpass, bq_type_lowpass, bq_type_highshelf }, | ||
{ 20.f, 5000.f, 20000.f }, | ||
{ 0.f, 0.707f, 1.f }, | ||
{ -20.f, 0.f, 20.f }, | ||
{} | ||
}; |
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,35 @@ | ||
#!/usr/bin/make -f | ||
# Makefile for DISTRHO Plugins # | ||
# ---------------------------- # | ||
# Created by falkTX | ||
# | ||
|
||
# -------------------------------------------------------------- | ||
# Project name, used for binaries | ||
|
||
NAME = OK-Filter | ||
|
||
# -------------------------------------------------------------- | ||
# Files to build | ||
|
||
FILES_DSP = \ | ||
OneKnobPlugin.cpp \ | ||
Biquad.cpp | ||
|
||
# -------------------------------------------------------------- | ||
# Do some magic | ||
|
||
include ../../dpf/Makefile.plugins.mk | ||
|
||
BUILD_CXX_FLAGS += -I../common | ||
BUILD_CXX_FLAGS += -I../../dpf-widgets/opengl | ||
LINK_FLAGS += $(SHARED_MEMORY_LIBS) | ||
|
||
# -------------------------------------------------------------- | ||
# Enable all possible plugin types | ||
|
||
TARGETS += lv2_sep | ||
|
||
all: $(TARGETS) | ||
|
||
# -------------------------------------------------------------- |
Oops, something went wrong.