Click here to Skip to main content
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

    GeneralRe: Unmute does not work to wave too PinmemberBurgao24-Dec-04 9:32 
    GeneralRe: Unmute does not work to wave too Pinmembersabit23-Jun-06 19:10 
    Generalexcuse me PinmemberNeverGrief21-Nov-02 7:37 
    GeneralQuestion about using this class PinsussAnonymous20-Aug-02 4:22 
    QuestionAbout Recording Control? PinsussAnonymous8-Aug-02 21:26 
    AnswerRe: About Recording Control? PinsussAnonymous11-Aug-02 6:43 
    Generalmix several wav fils PinmemberER__6-Jan-02 10:55 
    GeneralRe: mix several wav fils PinmemberPeteCIS5-Feb-02 8:47 
    You can use multiple Secondary Buffers using DirectX's DirectSound API and fill each buffer with a different wav file. Then choose to play each buffer and the DirectSound API will mix the sounds for you.
    Of course, if the wave files are too large, you will want to make smaller circular buffers and periodically keep adding new audio data to them as playback occurs.
    Also provided is the ability to set notification events when the play back cursor reaches a specified position in the buffer. This is great for statically setting notification points, but since the buffer playback must be stopped to set a notification point, the uses are more limited than those you initially think of.
    GeneralRe: mix several wav fils Pinmembermice16-Aug-02 23:54 
    GeneralRe: mix several wav fils Pinmemberbegray14-Oct-05 22:45 
    GeneralGREAT! And yet so simple! Amazing PinmemberPeter B. Hardwick3-Oct-01 17:54 
    GeneralDoes not work PinmemberAnonymous2-Jul-01 11:30 
    GeneralRecording information Pinmemberroland22-Nov-00 7:14 
    GeneralWhere can i Find...... PinsussJon13-Jul-00 6:18 
    GeneralIt's very nice Pinsussalex11-Jan-00 23:04 

    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
    Web03 | 2.8.150327.1 | Last Updated 10 Jan 2000
    Article Copyright 2000 by Alexander Fedorov
    Everything else Copyright © CodeProject, 1999-2015
    Layout: fixed | fluid