Hello
I want in the win Application (written in C#), the sound (Wav Format) play as Background Sound, and mouse over Control play small wav sound File,
and when Click on Button, Stop Background Sound and ... .
Thanks For your guidance.
views:
561answers:
3NO, but Background sound in Thread.
Modir
2009-09-17 11:58:16
Give it a try, I think this will work for u
Ahmed Khalaf
2009-09-17 12:07:32
+2
A:
You could try look around in the System.Media namespace. There is a SoundPlayer which is able to play Wave files.
To play a wav file in a loop, you can use the following code:
string filename = @"C:\WINDOWS\Media\notify.wav";
System.Media.SoundPlayer player = new System.Media.SoundPlayer(filename);
player.PlayLooping();
To stop playing, you simple call Stop():
player.Stop();
Play around a bit, there's more if you need it.
horsedrowner
2009-09-17 12:01:03
Thanks, But When Mouse over Event of Button Occur, Play another Sound that cause stop Background Sound.
Modir
2009-09-17 12:09:00
You can use the same SoundPlayer. Call .Stop() and set the property SoundLocation to the new wave file, and call .Play() to play it.
horsedrowner
2009-09-17 18:17:03
A:
you can use Windows Media Player:
reference C:\Windows\System32\wmp.dll in your project
to launch a wav file:
WMPLib.WindowsMediaPlayer wmp = new WMPLib.WindowsMediaPlayerClass();
wmp.URL = "[wav file path]";
//then control the player with :
wmp.controls.play(), stop(), ...
for the second wav file, do the same thing with another instance of WindowsMediaPlayer etc...
you can also use Managed DirectX : Managed DirectX Tutorial Part 2
najmeddine
2009-09-17 12:11:44