i’m building a wp7 application for a game using silverlight & XNA
i have an mp3 file called “Punch1.mp3” (Build action : resource ) stored inside a folder called “SoundEffects" inside the project folder
and i want to play the file using this code
StreamResourceInfo info;
Uri myuri = new Uri("/SoundEffects/Punch1.mp3", UriKind.Relative);
info = App.GetResourceStream (myuri);
punch1 = SoundEffect.FromStream(info.Stream ) ;
punch is defined in the code here :
public static SoundEffect punch1;
the problem is that it raises a nullreference exception in the third line claiming that info is null
and that’s true in the debugging mode , i found that the resource stream info is null
i think this is because the it can’t read the file although the uri is correct

in the following code :
SoundEffect.FromStream()expects a wave file stream not an MP3 as shown here : http://msdn.microsoft.com/en-us/library/microsoft.xna.framework.audio.soundeffect.fromstream.aspx .so solution to find a mp3 > wav convertor or just find another way to load mp3 to WP7
considering the picture this is normal URI in normal cases can’t evaluate expression of isfile .