The Equalizer Design: Graphic and Parametric Win32 Equalizer






2.27/5 (5 votes)
A ready to use equalizer for your projects
Introduction
Background
This is a flexible equalizer to use in your Direct2D Win32 projects. I use it in my Turbo Play.
OK, this is complex recursive filter design (Chebyshev, Elliptic, etc) so I assume you already know those. The EQ uses:
- My XML for serialization: https://github.com/WindowsNT/xml
- My syncs for playback: https://github.com/WindowsNT/mt
- DSPFilters for Low/High cut of the parametric equalizer: https://github.com/vinniefalco/DSPFilters
- SNDFilter for biquad peaking filters in parametric/graphic equalizer: https://github.com/voidqk/sndfilter
Using the Code
This is a Direct2D EQ
class:
class EQ
{
virtual void Paint(ID2D1Factory*fact, ID2D1RenderTarget* r, RECT rc) = 0;
virtual void LeftDown(WPARAM ww, LPARAM ll) = 0;
virtual void RightDown(WPARAM ww, LPARAM ll) = 0;
virtual void LeftUp(WPARAM ww, LPARAM ll) = 0;
virtual void MouseMove(WPARAM ww, LPARAM ll) = 0;
virtual void MouseWheel(WPARAM ww, LPARAM ll) = 0;
virtual void KeyDown(WPARAM ww, LPARAM ll) = 0;
virtual void LeftDoubleClick(WPARAM ww,LPARAM ll) = 0;
virtual void Ser(XML3::XMLElement& e) = 0;
virtual void Unser(XML3::XMLElement& e) = 0;
virtual void Prepare(int SR) = 0;
virtual void Run(int SR, float* in, int ns, float* out) = 0; // Single channel
virtual bool Run2(int SR, int nch,float** in,
int ns, float** out) = 0; // Multiple channel (ToDo)
virtual void Build(int SR) = 0; // Create the filters
};
// Callbacks
class EQCALLBACK
{
public:
virtual void RedrawRequest(EQ* pr) = 0; // Called when the equalizer needs to redraw
virtual void Dirty(EQ* e,bool) = 0; // Called when the equalizer has changed
};
Descendants of this class are the GRAPHICEQ
and the PARAMETRICEQ
. Use the paint and mouse/keyboard functions from your window procedure.
Included also two functions, Run()
and Run2()
which process samples. The sample project included in the VS 2019 solution has an MP3 player. Load the app, then press Space to load an MP3 file and adjust the equalizer while playing to hear the results.
Have fun!
History
- 14th December, 2019: First release