Simple Mixer Control Wrapper

Environment: VC6, Unicode

This is small and usefull C++ class which can encapsulate any windows multimedia mixer control. I wrote a simple class, named CAlexfMixer which can wrap any multimedia mixer control. You can manipulate with Master Volume, Mute or someone else mixer control with this class if control support this operations. You can retrieve information from Peak Meter and other controls like this.

There is some mixers here, but all of them are not so clear, simple and universal like my own... ;-)

Let's look at class definition:

class CAlexfMixer
  HMIXER m_HMixer;
  INT m_iMixerControlID;
  DWORD m_dwChannels;
  BOOL m_bSuccess;
  void ZeroAll();
  BOOL IsOk() {return m_bSuccess;};
  BOOL On();
  BOOL Off();
  DWORD GetControlValue();
  BOOL SetControlValue(DWORD dw);
  CAlexfMixer(DWORD DstType, DWORD SrcType, DWORD ControlType);
  CAlexfMixer(HWND hwnd, DWORD DstType, DWORD SrcType, DWORD ControlType);
  virtual ~CAlexfMixer();

The class has two constructors - with and without callback window. The class has the member IsOk() to check ability of manipulation of specified control and members to get and set control state.

Using the class.

Example 1. Master Volume Control.

if (!mixer.IsOk())

First we create object associated with Master Volume meter control. Third parameter - NO_SOURCE - is a constant, defined in .h file, it mean than control have not a source line but only destination line. Second we check - is this type of control available or not? Third - if yes we set volume to 500.

Example 2. Master Mute.


Here we create object associated with Master Mute control. And next we switch it off.

Check for latest versions at


Download source - 3 Kb


  • This is Cool, but...

    Posted by Jerronimo on 05/27/2006 05:59pm

    Hello, nice job, this is similar to what i am looking for. I need a piece of soft to switch between audio devices. I have a rear and a front driver, just like i had two sound cards. But only one can be set as default so when i want to put my headphones i must goto ControlPanet->... etc. Could you please tell me how to change DEFAULT device to another? Should i go looking something about rundll32.exe? And where to look (a book?)? Any ideas?

  • Good!!!

    Posted by Legacy on 10/13/2003 12:00am

    Originally posted by: Stefano Vaccari

    I found it very useful. Thanks a lot.

  • Very good!

    Posted by Legacy on 10/29/2001 12:00am

    Originally posted by: Rogerio Silva

    Thank you !

  • Where is Demo Project Source?

    Posted by Legacy on 10/08/2000 12:00am

    Originally posted by: hosang

    Where is Demo Project Source?

  • Functions do nothing

    Posted by Legacy on 09/22/2000 12:00am

    Originally posted by: Clinton Morell

    I compiled a program using the demo examples and ran the demo code. Nothing happened. The volume level remained unchanged and unmuted.

    I am using the VC5.0 compiler; perhaps this code has no effect when compiled under v5.0.

  • My mixer's maximum value is 65535

    Posted by Legacy on 03/29/2000 12:00am

    Originally posted by: Wuncheol Heo

    At first time, my program always set volume to zero.
    I try to find what's wrong. at last I know I set volume value to low (500 <- this value is from your example). My mixer's maximum is 65535 (0xffff).

    so I have one question.
    All mixer has maximum 65535 ? or differ each other?

Leave a Comment
  • Your email address will not be published. All fields are required.

Top White Papers and Webcasts

  • Moving from an on-premises environment to Office 365 does not remove the need to plan for disruptions or reduce the business risk requirements for protecting email services. If anything, some risks increase with a move to the cloud. Read how to ease the transition every business faces if considering or already migrating to cloud email. This white paper discusses: Setting expectations when migrating to Office 365 Understanding the implications of relying solely on Exchange Online security Necessary archiving …

  • Anthony Christie, the Chief Marketing Officer for Level Communications, is responsible for customer experience, worldwide marketing and product management. In this informative asset, he shares his insights into why a private network connection to cloud-bases applications is the right decision for your enterprise. Download now to find out more.

Most Popular Programming Stories

More for Developers

RSS Feeds

Thanks for your registration, follow us on our social networks to keep up-to-date