sount control slider
-
dear sir, i want to control system sound using slider. how can i do ?? any idea???
yogesh
-
dear sir, i want to control system sound using slider. how can i do ?? any idea???
yogesh
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
-
dear sir, i want to control system sound using slider. how can i do ?? any idea???
yogesh
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