I am creating a Windows Phone 7 application and trying to play sound.
I have code for this, but it cannot find the file when I try to run it on an emulator.
I added a sound file as a resource (think)
here is the code if this is a problem
PlaySound(@"Sounds\show.wav");
And function
private void PlaySound(string path)
{
try
{
if (!string.IsNullOrEmpty(path))
{
using (var stream = TitleContainer.OpenStream(path))
{
if (stream != null)
{
var effect = SoundEffect.FromStream(stream);
FrameworkDispatcher.Update();
effect.Play();
}
}
}
}catch(Exception e){
timerCount.Text = path;
}
}
Chris source
share