Click here to Skip to main content
11,412,833 members (74,156 online)
Click here to Skip to main content

Simple Mixer Control Wrapper

, 9 Jan 2000
Rate this:
Please Sign up or sign in to vote.
A small audio mixer control wrapper
  • Download source files - 2.7 Kb
  • <!-- Article Starts -->

    This is small and useful C++ class which can encapsulate any windows multimedia mixer control.

    I wrote a simple class CAlexfMixer to wrap any multimedia mixer control. You can manipulate the Master Volume, Mute or someone elses mixer control with this class, as long as the control support these operations. You can also retrieve information such as the Peak Meter.

    Let's look at class definition:

    class CAlexfMixer
      HMIXER m_HMixer;
      INT m_iMixerControlID;
      MMRESULT mmr;
      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 the callback window.

    The class has member IsOk to check whether the specified control can be manipulated, and member functions to get and set the control's state.

    How it works

    Example 1. Master Volume Control.

    if (!mixer.IsOk()) 

    First we create an object associated with the Master Volume meter control. The third parameter NO_SOURCE is a constant defined in the header file. It means that the control does not have a source line, only a destination line.

    Second we check if is this type of control available or not.

    Finally, we set the volume to 500.

    Example 2. Master Mute.


    Here we create an object associated with Master Mute control, and turn it off.


    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


    About the Author

    Alexander Fedorov
    Web Developer SEO
    Russian Federation Russian Federation
    AlexF's Blog in Russian
    Owner Spy competition analysis
    Rating Burner Rating of blogs

    Comments and Discussions

    Questioncan u guide me i am new for mixer control Pin
    rajneshmalik at 30-Aug-07 3:18
    memberrajneshmalik30-Aug-07 3:18 
    GeneralNo Mixer Present!!! Pin
    DexterND at 14-May-07 2:45
    memberDexterND14-May-07 2:45 
    QuestionHow to choose FrontPanel MIC or BackPanel MIC? Pin
    guzeliang at 10-Oct-06 16:42
    memberguzeliang10-Oct-06 16:42 
    AnswerRe: How to choose FrontPanel MIC or BackPanel MIC? Pin
    guzeliang at 11-Oct-06 18:09
    memberguzeliang11-Oct-06 18:09 
    GeneralHow did you solve that problem? Pin
    cheong junhwan at 27-Aug-07 0:50
    membercheong junhwan27-Aug-07 0:50 
    GeneralNEW VERSION Pin at 21-Apr-06 16:43
    memberuwgmxbscdb@mailinator.com21-Apr-06 16:43 
    GeneralMute or Pause Sounds from other Applications Pin
    Suntai at 7-Feb-06 3:04
    memberSuntai7-Feb-06 3:04 
    Generalmodify change fault code Pin
    JS Lee at 1-May-05 20:25
    memberJS Lee1-May-05 20:25 
    GeneralForget My Email,Sorry! Pin
    peposi at 30-Aug-04 23:12
    memberpeposi30-Aug-04 23:12 
    GeneralI Can not Download you code! Pin
    peposi at 30-Aug-04 23:01
    memberpeposi30-Aug-04 23:01 
    GeneralPeak Meter not working Pin
    Atif Goheer at 19-Nov-03 8:38
    memberAtif Goheer19-Nov-03 8:38 
    GeneralRe: Peak Meter not working Pin
    AkikoAkikoChan at 17-Oct-04 18:44
    memberAkikoAkikoChan17-Oct-04 18:44 
    GeneralControlling mic loudness Pin
    In-Chul, Yang at 24-Jul-03 18:07
    sussIn-Chul, Yang24-Jul-03 18:07 
    GeneralRe: Controlling mic loudness Pin
    FBKK at 12-Sep-06 23:57
    memberFBKK12-Sep-06 23:57 
    QuestionSolved balance problem? Pin
    geert jacobs at 8-May-03 23:39
    membergeert jacobs8-May-03 23:39 
    AnswerRe: Solved balance problem? Pin
    geert jacobs at 8-May-03 23:57
    membergeert jacobs8-May-03 23:57 
    GeneralRe: Solved balance problem? Pin
    AkikoAkikoChan at 17-Oct-04 18:42
    memberAkikoAkikoChan17-Oct-04 18:42 
    AnswerRe: Solved balance problem? [modified] Pin
    ultraVBCoder at 25-Jun-06 18:26
    memberultraVBCoder25-Jun-06 18:26 
    GeneralCallback handling Pin
    rjo2909 at 28-Apr-03 19:43
    memberrjo290928-Apr-03 19:43 
    Questionhow to close Aux? Pin
    TangQin at 24-Feb-03 21:44
    memberTangQin24-Feb-03 21:44 
    AnswerRe: how to close Aux? Pin
    TangQin at 24-Feb-03 22:06
    memberTangQin24-Feb-03 22:06 
    GeneralUnmute does not work. Pin
    Jobe at 14-Jan-03 5:08
    memberJobe14-Jan-03 5:08 
    GeneralRe: Unmute does not work. Pin
    Jobe at 14-Jan-03 6:11
    memberJobe14-Jan-03 6:11 
    GeneralRe: Unmute does not work to wave too Pin
    Burgao at 24-Dec-04 9:32
    memberBurgao24-Dec-04 9:32 
    How can i change the status from the mute check box for the wave control:;)
    GeneralRe: Unmute does not work to wave too Pin
    sabit at 23-Jun-06 19:10
    membersabit23-Jun-06 19:10 

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

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

    | Advertise | Privacy | Terms of Use | Mobile
    Web02 | 2.8.150427.1 | Last Updated 10 Jan 2000
    Article Copyright 2000 by Alexander Fedorov
    Everything else Copyright © CodeProject, 1999-2015
    Layout: fixed | fluid