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:
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;
virtual bool Run2(int SR, int nch,float** in,
int ns, float** out) = 0;
virtual void Build(int SR) = 0;
};
class EQCALLBACK
{
public:
virtual void RedrawRequest(EQ* pr) = 0;
virtual void Dirty(EQ* e,bool) = 0;
};
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