CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4
  1. #1
    Join Date
    Jul 2005
    Posts
    218

    Get master volume value

    Here is a simple code to obtain a master volume value in Windows:

    Code:
    HMIXER                          hMixer;
    MIXERLINE                       ml   = {0};
    
    memset (&ml, 0, sizeof (MIXERLINE));
    
    
    // get a handle to the mixer device
    result = mixerOpen(&hMixer, 0, 0, 0, MIXER_OBJECTF_HMIXER);
        
    if (MMSYSERR_NOERROR == result)
    {
            ml.cbStruct        = sizeof(MIXERLINE);
            ml.dwComponentType = MIXERLINE_COMPONENTTYPE_DST_SPEAKERS;
    
            // get the speaker line of the mixer device
    
            result = mixerGetLineInfo((HMIXEROBJ) hMixer, &ml, 
            MIXER_GETLINEINFOF_COMPONENTTYPE);
    
      .......................
    }
    the mixer is opened OK. But I get MMSYSERR_INVALPARAM error on the bold line.

    This code works perfectly on all machines but one. That computer has a built-in sound card from Realtek.

    Does anyone know why it could happen?

    Thanks a lot.

  2. #2
    Join Date
    May 2012
    Posts
    1

    Re: Get master volume value

    Have you been able to find a solution to this? I'm facing the same problem and I too have a Realtek soundcard.
    Thanks.

  3. #3
    Join Date
    Jan 2002
    Location
    Houston, TX
    Posts
    1,421

    Re: Get master volume value

    I doubt that he's still monitoring this thread after 6 years!

    You should open a new thread for this question.
    Be sure to rate those who help!
    -------------------------------------------------------------
    Karl - WK5M
    PP-ASEL-IA (N43CS)
    PGP Key: 0xDB02E193
    PGP Key Fingerprint: 8F06 5A2E 2735 892B 821C 871A 0411 94EA DB02 E193

  4. #4
    Ejaz's Avatar
    Ejaz is offline Elite Member Power Poster
    Join Date
    Jul 2002
    Location
    Lahore, Pakistan
    Posts
    4,211

    Re: Get master volume value

    In addition to krmed, when you provide the code snippet, please make sure that it can effectively reproduce the issue that you are having.

    As for MMSYSERR_INVALPARAM, according to MSDN, it indicates that

    One or more parameters are invalid.
    Therefore, which parameter is exactly not right, you can figure out best without anything concrete for others to take a look.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured