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. .NET (Core and Framework)
  4. Getting and Setting the Master and Wave Volume

Getting and Setting the Master and Wave Volume

Scheduled Pinned Locked Moved .NET (Core and Framework)
csharpdotnetquestion
3 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.
  • B Offline
    B Offline
    bneacetp
    wrote on last edited by
    #1

    How would I go about using the .NET Framework to get and set the Master and Wave Volume of the user's computer? Can it be done with .NET, or is Direct Sound required to do this? Any leads in the right direction would be appreciated. Happy Programming and may God Bless! "Your coding practices might be buggy, but your code is always right." Internet::WWW::CodeProject::bneacetp

    M 1 Reply Last reply
    0
    • B bneacetp

      How would I go about using the .NET Framework to get and set the Master and Wave Volume of the user's computer? Can it be done with .NET, or is Direct Sound required to do this? Any leads in the right direction would be appreciated. Happy Programming and may God Bless! "Your coding practices might be buggy, but your code is always right." Internet::WWW::CodeProject::bneacetp

      M Offline
      M Offline
      mav northwind
      wrote on last edited by
      #2

      You can P/Invoke waveOutSetVolume() to set the volume of a waveform audio output device.

      [DllImport("winmm.dll")]
      public static extern int waveOutSetVolume(IntPtr hwo, UInt32 dwVolume);
      
      ...
      waveOutSetVolume(IntPtr.Zero, 0xFFFFFFFF);
      ...
      

      This sets both channels of master volume to maximum. For special target devices you might have to use other WaveOut-functions, but they're all documented in the platform SDK. Regards, mav

      B 1 Reply Last reply
      0
      • M mav northwind

        You can P/Invoke waveOutSetVolume() to set the volume of a waveform audio output device.

        [DllImport("winmm.dll")]
        public static extern int waveOutSetVolume(IntPtr hwo, UInt32 dwVolume);
        
        ...
        waveOutSetVolume(IntPtr.Zero, 0xFFFFFFFF);
        ...
        

        This sets both channels of master volume to maximum. For special target devices you might have to use other WaveOut-functions, but they're all documented in the platform SDK. Regards, mav

        B Offline
        B Offline
        bneacetp
        wrote on last edited by
        #3

        Thanks for your reply. :-D Happy Programming and may God Bless! "Your coding practices might be buggy, but your code is always right." Internet::WWW::CodeProject::bneacetp

        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