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. WPF
  4. sount control slider

sount control slider

Scheduled Pinned Locked Moved WPF
question
3 Posts 3 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.
  • Y Offline
    Y Offline
    yogesh_softworld123
    wrote on last edited by
    #1

    dear sir, i want to control system sound using slider. how can i do ?? any idea???

    yogesh

    B S 2 Replies Last reply
    0
    • Y yogesh_softworld123

      dear sir, i want to control system sound using slider. how can i do ?? any idea???

      yogesh

      B Offline
      B Offline
      BlitzPackage
      wrote on last edited by
      #2

      Greetings, Create a handler for the slider value changed event. Then in that event handler, set the sound volume of your player. Of course, make sure that whatever values you use in the slider correspond proportionately to the sound volume of your audio player. I am doing the same thing in my project and here is the code I use:

          private void OnSliderMusicVolumeValueChanged(object sender, RoutedPropertyChangedEventArgs e)
          {
              if (myMusicManager != null)
              {
                  myMusicManager.Volume = SliderMusicVolume.Value; 
              }
          }
      

      myMusicManager is just the name I gave to a class that wraps the wpf media player. Below is where I get and set the volume using the appropriate conversions.

          public double Volume
          {
              get
              {
                  return myMusicPlayer.Volume \* 10; // myMusicPlayer is the actual wpf media player
              }
              set
              {
                  myMusicPlayer.Volume = (value / 10);
              }
          }
      

      I hope this helps, let me know if you have any more questions. Blitz

      1 Reply Last reply
      0
      • Y yogesh_softworld123

        dear sir, i want to control system sound using slider. how can i do ?? any idea???

        yogesh

        S Offline
        S Offline
        sivaddrahcir
        wrote on last edited by
        #3

        or... if your question is really "how can I control the master system volume on Vista using managed code", then check out: Vista Core Audio API Master Volume Control[^]

        Blog: http://windowsclientdevelopment.spaces.live.com FAQs: http://windowspresentationfoundation.wikispaces.com http://windowsmobile.wikispaces.com http://vsto.wikispaces.com

        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