polling wavplay

J

johnmmcparland

Hi all,

I used the class on CodeGuru to play wav files;

http://www.codeguru.com/csharp/csharp/cs_graphics/sound/article.php/c6143/

In my application however I play a number of wav files in a sequence.
Since I know the length of them (they are hard-wired into the code) all
I do is wait for 4seconds before doing anything else. However I would
like to know if there is some way of polling to see if it has finished
playing?

Anyone managed this?

John
 
N

Nicholas Paldino [.NET/C# MVP]

John,

I would use something like DirectX to handle the playing of the files.
You should be able to get events as to when the audio file starts and stops
playing.

Hope this helps.
 
J

johnmmcparland

thanks for the help, but I don't have directX available to me at
university.

i managed to solve the problem by changing the flag passed into the
playsound method, from SND_ASYNC to SND_SYNC.

the former plays in a new thread while the latter doesn't return until
it has finished playing, which is more or less what i wanted anyway.

search for PlaySound on msdn for help.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top