I am trying to get a C# console program to play WAV files. The following code works in a Windows Application:
FileStream fs = new FileStream(@"c:\oou.wav",FileMode.Open, FileAccess.Read);
System.Media.SoundPlayer sp = new System.Media.SoundPlayer(fs);
sp.Play();
When I port the same code into a Console Application, there is only a very brief output from the sound card the first time I invoke the code, subsequent invocations pass so quickly that there is no apparent audio whatsoever (the WAV file I am testing with is about 8 secs. long).
What do I need to do to make this work?
FileStream fs = new FileStream(@"c:\oou.wav",FileMode.Open, FileAccess.Read);
System.Media.SoundPlayer sp = new System.Media.SoundPlayer(fs);
sp.Play();
When I port the same code into a Console Application, there is only a very brief output from the sound card the first time I invoke the code, subsequent invocations pass so quickly that there is no apparent audio whatsoever (the WAV file I am testing with is about 8 secs. long).
What do I need to do to make this work?