codice:
class PlaySound
{
private string filename;
public PlaySound(string filename) {
this.filename = filename;
}
public void play()
{
SoundPlayer sp = new SoundPlayer(filename);
sp.Load();
sp.Play();
}
}
codice:
class Program
{
static void Main(string[] args)
{
PlaySound p = new PlaySound("C:/sound1.wav");
PlaySound q = new PlaySound("C:/sound2.wav");
Thread pThread = new Thread(p.play);
Thread aThread = new Thread(q.play);
pThread.Start();
aThread.Start();
}
}
i due suoni non si sentono comtemporaneamente