G+_Tnt Seeker Posted March 25, 2014 Share Posted March 25, 2014 Hey I'm trying play a sound file in WPF C#. any tips on how i can do that? Link to comment Share on other sites More sharing options...
G+_Dean T Posted March 25, 2014 Share Posted March 25, 2014 An mp3? And is it from a button click or from some other action? Link to comment Share on other sites More sharing options...
G+_Tnt Seeker Posted March 25, 2014 Author Share Posted March 25, 2014 any sound file yes, and i want it too loop. Link to comment Share on other sites More sharing options...
G+_Joe Maruschek Posted March 26, 2014 Share Posted March 26, 2014 Have you tried the SoundPlayer class? It has a PlayLooping() method that looks like it will do what you want. It looks like you will need to add using System.Media; at the top of your code. Link to comment Share on other sites More sharing options...
G+_Joe Maruschek Posted March 26, 2014 Share Posted March 26, 2014 Unfortunately SoundPlayer only plays .WAV files and not MP3s, but it does keep looping the sound. Hopefully that is good enough for your application? Here's some sample code: https://github.com/joemarus/Test1/blob/master/PlaySound.cs Link to comment Share on other sites More sharing options...
Recommended Posts