play sound in C#
Published: 8. January 2009 | Updated: 8. January 2009License: Microsoft Public License (MS-PL)
Categories: Winforms
Tags: C# Media Windows Winforms
Import namespace
using System.Media;
Code
SoundPlayer sound = new SoundPlayer(@"C:\mySound.wav"); // play in new thread sound.Play(); // play in UI thread sound.PlaySync(); // play looping in new thread sound.PlayLooping();
| Send us feedback about this snippet » |





