I have tried a couple of ways. One being the SoundPlayer, but to my understanding that can only play 1 sound at a time, and I need background music looping. I have also used the winmm.dll to try and play looping music, but it doesnt seem to work for me. Also, I cant seem to play the sound more than once. Here is what I have tried
[DllImport("winmm.dll")]
private static extern long mciSendString(string strCommand, StringBuilder strReturn, int iReturnLength, IntPtr hwndCallback);
mciSendString(@"open C:\\Users\\jberry\\Documents\\Pics\\MusicLoop2.wav type waveaudio alias applause", null, 0, IntPtr.Zero);
mciSendString(@"play applause", null, 0, IntPtr.Zero);
This works, but will only play once. I have seen a lot of post that say do something like this
mciSendString(@"open C:\\Users\\jberry\\Documents\\Pics\\MusicLoop2.wav type waveaudio alias applause", null, 0, IntPtr.Zero);
mciSendString(@"play applause repeat", null, 0, IntPtr.Zero);
But that wont even play anything. Could anyone help me find a quick way to play multiple sounds + a repeating song loop? If I didnt have to install any DLLs that would be nice, but I will do whats needed
NAudio. It's an open source library that can be easily installed via NuGet. No need to P/Invoke. It supports playing concurrent sounds. - Zer0