Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. How to determine whether master volume is enabled?

How to determine whether master volume is enabled?

Scheduled Pinned Locked Moved C / C++ / MFC
comdebuggingtutorialquestion
1 Posts 1 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    Artem Moroz
    wrote on last edited by
    #1

    I'm using class CVolumeOutMaster - it sets and gets master volume. The class could be found here: http://www.codeproject.com/audio/volumeclasses.asp It determines the volume like this:

    DWORD CVolumeOutMaster::GetCurrentVolume()
    {
    if ( !m_bAvailable )
    return BAD_DWORD;
    MIXERCONTROLDETAILS_UNSIGNED* aDetails = (MIXERCONTROLDETAILS_UNSIGNED*)malloc(m_nChannelCount*sizeof(MIXERCONTROLDETAILS_UNSIGNED));
    if ( !aDetails )
    return BAD_DWORD;
    MIXERCONTROLDETAILS ControlDetails;
    memset( &ControlDetails, 0, sizeof(MIXERCONTROLDETAILS) );
    ControlDetails.cbStruct = sizeof(MIXERCONTROLDETAILS);
    ControlDetails.dwControlID = m_dwVolumeControlID;
    ControlDetails.cChannels = m_nChannelCount;
    ControlDetails.cMultipleItems = 0;
    ControlDetails.cbDetails = sizeof(MIXERCONTROLDETAILS_UNSIGNED);
    ControlDetails.paDetails = &aDetails[0];
    MMRESULT mmResult = mixerGetControlDetails( (HMIXEROBJ)m_dwMixerHandle, &ControlDetails, MIXER_GETCONTROLDETAILSF_VALUE );
    DWORD dw = aDetails[0].dwValue;
    free( aDetails );
    if ( mmResult != MMSYSERR_NOERROR )
    {
    TRACE(".MasterOutputVolume: FAILURE: Could not get volume. mmResult=%d\n", mmResult );
    return BAD_DWORD;
    }
    return dw;
    }

    How to determine whether master volume is enabled or disabled?

    1 Reply Last reply
    0
    Reply
    • Reply as topic
    Log in to reply
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes


    • Login

    • Don't have an account? Register

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • World
    • Users
    • Groups