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
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Volume Control through program....

Volume Control through program....

Scheduled Pinned Locked Moved C / C++ / MFC
json
6 Posts 2 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
    ashwath2005
    wrote on last edited by
    #1

    hi all, Is there an Api through which i can control the "volume control balance" which appears in the dialog box which appears when we double click the sound icon in the systray. thanking and regards, ashwath.

    D 1 Reply Last reply
    0
    • A ashwath2005

      hi all, Is there an Api through which i can control the "volume control balance" which appears in the dialog box which appears when we double click the sound icon in the systray. thanking and regards, ashwath.

      D Offline
      D Offline
      David Crow
      wrote on last edited by
      #2

      See here.


      "One must learn from the bite of the fire to leave it alone." - Native American Proverb

      A 1 Reply Last reply
      0
      • D David Crow

        See here.


        "One must learn from the bite of the fire to leave it alone." - Native American Proverb

        A Offline
        A Offline
        ashwath2005
        wrote on last edited by
        #3

        Thank you very much for the help. Is there a method to actually mute the volume by checking the "muteall" checkbox from program.

        D 1 Reply Last reply
        0
        • A ashwath2005

          Thank you very much for the help. Is there a method to actually mute the volume by checking the "muteall" checkbox from program.

          D Offline
          D Offline
          David Crow
          wrote on last edited by
          #4

          ashwath2005 wrote: Is there a method to actually mute the volume by checking the "muteall" checkbox from program. Sure, just use a MIXERCONTROL_CONTROLTYPE_MUTE control type.


          "One must learn from the bite of the fire to leave it alone." - Native American Proverb

          A 1 Reply Last reply
          0
          • D David Crow

            ashwath2005 wrote: Is there a method to actually mute the volume by checking the "muteall" checkbox from program. Sure, just use a MIXERCONTROL_CONTROLTYPE_MUTE control type.


            "One must learn from the bite of the fire to leave it alone." - Native American Proverb

            A Offline
            A Offline
            ashwath2005
            wrote on last edited by
            #5

            In the code below ,where should i use the "MIXERCONTROL_CONTROLTYPE_MUTE" control type.Kindly let me know. MMRESULT result; HMIXER hMixer; result = mixerOpen(&hMixer, MIXER_OBJECTF_MIXER, 0, 0, 0); //obtain a handle to the mixer device. //we need to get the speaker line of the mixer device MIXERLINE ml = {0}; ml.cbStruct = sizeof(MIXERLINE); ml.dwComponentType = MIXERLINE_COMPONENTTYPE_DST_SPEAKERS; result = mixerGetLineInfo((HMIXEROBJ) hMixer,&ml, MIXER_GETLINEINFOF_COMPONENTTYPE); //we need to get the volume control of the speaker line. MIXERLINECONTROLS mlc = {0}; MIXERCONTROL mc = {0}; mlc.cbStruct = sizeof(MIXERLINECONTROLS); mlc.dwLineID = ml.dwLineID; mlc.dwControlType = MIXERCONTROL_CONTROLTYPE_VOLUME ; mlc.cControls = 1; mlc.pamxctrl = &mc; mlc.cbmxctrl = sizeof(MIXERCONTROL); result = mixerGetLineControls((HMIXEROBJ) hMixer, &mlc, MIXER_GETLINECONTROLSF_ONEBYTYPE); //MIXERCONTROL_CONTROLTYPE_VOLUME //set the volume level MIXERCONTROLDETAILS mcd = {0}; MIXERCONTROLDETAILS_UNSIGNED mcdu = {0}; mcdu.dwValue = iVal; // the volume is a number between 0 and 65535 mcd.cbStruct = sizeof(MIXERCONTROLDETAILS); mcd.hwndOwner = 0; mcd.dwControlID = mc.dwControlID; mcd.paDetails = &mcdu; mcd.cbDetails = sizeof(MIXERCONTROLDETAILS_UNSIGNED); mcd.cChannels = 1; result = mixerSetControlDetails((HMIXEROBJ) hMixer, &mcd, MIXER_SETCONTROLDETAILSF_VALUE);

            D 1 Reply Last reply
            0
            • A ashwath2005

              In the code below ,where should i use the "MIXERCONTROL_CONTROLTYPE_MUTE" control type.Kindly let me know. MMRESULT result; HMIXER hMixer; result = mixerOpen(&hMixer, MIXER_OBJECTF_MIXER, 0, 0, 0); //obtain a handle to the mixer device. //we need to get the speaker line of the mixer device MIXERLINE ml = {0}; ml.cbStruct = sizeof(MIXERLINE); ml.dwComponentType = MIXERLINE_COMPONENTTYPE_DST_SPEAKERS; result = mixerGetLineInfo((HMIXEROBJ) hMixer,&ml, MIXER_GETLINEINFOF_COMPONENTTYPE); //we need to get the volume control of the speaker line. MIXERLINECONTROLS mlc = {0}; MIXERCONTROL mc = {0}; mlc.cbStruct = sizeof(MIXERLINECONTROLS); mlc.dwLineID = ml.dwLineID; mlc.dwControlType = MIXERCONTROL_CONTROLTYPE_VOLUME ; mlc.cControls = 1; mlc.pamxctrl = &mc; mlc.cbmxctrl = sizeof(MIXERCONTROL); result = mixerGetLineControls((HMIXEROBJ) hMixer, &mlc, MIXER_GETLINECONTROLSF_ONEBYTYPE); //MIXERCONTROL_CONTROLTYPE_VOLUME //set the volume level MIXERCONTROLDETAILS mcd = {0}; MIXERCONTROLDETAILS_UNSIGNED mcdu = {0}; mcdu.dwValue = iVal; // the volume is a number between 0 and 65535 mcd.cbStruct = sizeof(MIXERCONTROLDETAILS); mcd.hwndOwner = 0; mcd.dwControlID = mc.dwControlID; mcd.paDetails = &mcdu; mcd.cbDetails = sizeof(MIXERCONTROLDETAILS_UNSIGNED); mcd.cChannels = 1; result = mixerSetControlDetails((HMIXEROBJ) hMixer, &mcd, MIXER_SETCONTROLDETAILSF_VALUE);

              D Offline
              D Offline
              David Crow
              wrote on last edited by
              #6

              My article has been updated with this information. Check it out.


              "One must learn from the bite of the fire to leave it alone." - Native American Proverb

              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