Click here to Skip to main content
13,900,985 members
Click here to Skip to main content
Add your own
alternative version


52 bookmarked
Posted 5 Dec 2001
Licenced CPOL

Multimedia PeakMeter Control

, 25 Jun 2002
Rate this:
Please Sign up or sign in to vote.
Multimedia Meter Control - ala WinAmp.

Sample Image - PeakMeter.gif


This Multimedia PeakMeter control can be used to display audio metering information in Multimedia applications. It has a few features like those found in WinAmp such as peak value fall off. This is the third version of this control, which now can display three different color ranges. I hope that you will find it useful. I don't think there's any free PeakMeter like this available.

Luigi Bianchi has made a free OWL Version of this control available. You may want to view it here. You are free to use this control as you wish as long as it is not sold for profit without my consent. Just let me know if you use it in your application.


This control should be very easy to use since it uses the same format as other MFC standard controls. Each function includes a header with description. The Peak falloff speed can be controlled with SetFalloffDelay function.

This new version allows you to use this control as a Progress control with the difference that you may have more than one band. To use this control as a progress control, don't call Start function. Peak Falloff effect and Grid can be turned on and off by using SetFalloffEffect and ShowGrid respectively.

This control uses Keith Rule's CMemDC class. An ATL version of this control can be created easily. The class CMemDC can be removed. An ATL (or ActiveX) version of this control can be created easily.

How to Use

Using this control is quite simple, you may create a static control and subclass it from a dialog. Both Vertical and Horizontal type of this control can be created this way. Add a static control to your dialog and use SS_LEFT or SS_CENTER to display the Horizontal or Vertical band for this control.

You may want to view the full features of this control by recompiling it with different values for color range and/or meter range. This control can also be used as a progress control. In this case, you should not call the Start method.

void CPeakMeterDlg::DoDataExchange(CDataExchange* pDX)
    DDX_Control(pDX, IDC_PMC_HORZ, m_PeakMeter1);
// Then Initialize your control like this
    m_PeakMeter1.SetMeterBands(10, 10); // use value of "1" to 
                                        // obtain smooth effect - see demo
    m_PeakMeter1.Start(1000/18); // 18 fps - puts delay in ms

// or create the control like this:
    // Create this control with create
    m_PeakMeter2.Create(WS_CHILD|WS_VISIBLE|PMS_VERTICAL, rc, this, IDC_PMC_HORZ);
    m_PeakMeter2.SetMeterBands(1, 10); // smooth horizontal band
    m_PeakMeter2.Start(1000/20); // 20 fps - puts delay in ms

// Change Band value like this - you can change all data or single value
// ArrayData is an array of "int" - see demo for more details
    m_PeakMeter1.SetData(ArrayData, 0, nElements);


  • 4 Feb 2002 - 1.1: Improved Falloff effect to look more like Audio system.
  • 10 June 2002 - 1.2: Added three ranges of color (low, medium, high).
  • 26 June 2002 - updated source.


This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


About the Author

Ernest Laurentin
Software Developer (Senior)
United States United States
Ernest is a multi-discipline software engineer.
Skilled at software design and development for all Windows platforms.
Interests: User Interface, GDI/GDI+, Scripting, Android, iOS, Windows Mobile.
Programming Skills: C/C++, C#, Java (Android), VB and ASP.NET.

I hope you will enjoy my contributions.

You may also be interested in...


Comments and Discussions

General.NET Version available Pin
Ernest Laurentin25-May-08 13:05
memberErnest Laurentin25-May-08 13:05 
QuestionVB.Net version? Pin
UltraWhack5-May-08 15:18
memberUltraWhack5-May-08 15:18 
AnswerRe: VB.Net version? Pin
Ernest Laurentin6-May-08 4:58
memberErnest Laurentin6-May-08 4:58 
GeneralVery interesting - thank you Pin
Abadani12-Dec-07 4:35
memberAbadani12-Dec-07 4:35 
GeneralRe: Very interesting - thank you Pin
Ernest Laurentin8-Jan-08 5:17
memberErnest Laurentin8-Jan-08 5:17 
GeneralVertical falloff effect Pin
Neville Richards5-May-07 1:23
memberNeville Richards5-May-07 1:23 
GeneralOnly 16 single meters at a time,,, :( Pin
aquawicket13-Dec-06 14:49
memberaquawicket13-Dec-06 14:49 
GeneralRe: Only 16 single meters at a time,,, :( Pin
aquawicket13-Dec-06 15:26
memberaquawicket13-Dec-06 15:26 
AnswerRe: Only 16 single meters at a time,,, :( Pin
Ernest Laurentin14-Dec-06 15:56
memberErnest Laurentin14-Dec-06 15:56 
AnswerRe: Only 16 single meters at a time,,, :( Pin
Ernest Laurentin14-Dec-06 15:54
memberErnest Laurentin14-Dec-06 15:54 
GeneralRe: Only 16 single meters at a time,,, :( Pin
aquawicket15-Dec-06 20:05
memberaquawicket15-Dec-06 20:05 
GeneralRe: Only 16 single meters at a time,,, :( Pin
aquawicket16-Dec-06 12:33
memberaquawicket16-Dec-06 12:33 
QuestionHow to link to Mic Level Pin
69 Bay19-Oct-05 7:02
member69 Bay19-Oct-05 7:02 
AnswerRe: How to link to Mic Level Pin
Anonymous19-Oct-05 13:50
memberAnonymous19-Oct-05 13:50 
GeneralRe: How to link to Mic Level Pin
69 Bay24-Oct-05 4:07
member69 Bay24-Oct-05 4:07 
GeneralSimple audio interface Pin
Robert Bielik1-Apr-06 4:27
memberRobert Bielik1-Apr-06 4:27 
QuestionI can NOT load your project! What about DSP file in your zip file? Pin
Behzad Ebrahimi25-Apr-05 11:17
memberBehzad Ebrahimi25-Apr-05 11:17 
AnswerRe: I can NOT load your project! What about DSP file in your zip file? Pin
Ernest Laurentin27-Apr-05 16:46
memberErnest Laurentin27-Apr-05 16:46 
GeneralArticle Updated Pin
Ernest Laurentin18-Jun-02 5:23
memberErnest Laurentin18-Jun-02 5:23 
GeneralRe: How to get the real peak values from a .wav file? Pin
hehak18-Apr-02 16:01
memberhehak18-Apr-02 16:01 
GeneralBogus Falloff. Pin
LarsW7-Dec-01 3:25
memberLarsW7-Dec-01 3:25 
GeneralRe: Bogus Falloff. Pin
Ernest Laurentin7-Dec-01 3:58
memberErnest Laurentin7-Dec-01 3:58 

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.

Permalink | Advertise | Privacy | Cookies | Terms of Use | Mobile
Web03 | 2.8.190306.1 | Last Updated 26 Jun 2002
Article Copyright 2001 by Ernest Laurentin
Everything else Copyright © CodeProject, 1999-2019
Layout: fixed | fluid