Click here to Skip to main content
65,938 articles
CodeProject is changing. Read more.
Articles
(untagged)

The Equalizer Design: Graphic and Parametric Win32 Equalizer

0.00/5 (No votes)
14 Dec 2019 1  
A ready to use equalizer for your projects

Introduction

Image 1

Image 2

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; // 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

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here