Click here to Skip to main content
15,867,704 members
Articles / Desktop Programming / Win32
Tip/Trick

The Equalizer Design: Graphic and Parametric Win32 Equalizer

Rate me:
Please Sign up or sign in to vote.
2.27/5 (5 votes)
14 Dec 2019CPOL 6.7K   1   2
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:

C++
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, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Software Developer
Greece Greece
I'm working in C++, PHP , Java, Windows, iOS, Android and Web (HTML/Javascript/CSS).

I 've a PhD in Digital Signal Processing and Artificial Intelligence and I specialize in Pro Audio and AI applications.

My home page: https://www.turbo-play.com

Comments and Discussions

 
QuestionIn you're wondering about the two low votes, Michael Pin
Gary Wheeler16-Dec-19 5:21
Gary Wheeler16-Dec-19 5:21 
AnswerRe: In you're wondering about the two low votes, Michael Pin
Michael Chourdakis20-Dec-19 10:06
mvaMichael Chourdakis20-Dec-19 10:06 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.