When does a sound fininsh playing

G

gazza67

Hi,

Does anyone know how to check for when a sound has finished playing?

I am currently using the SoundPlayer, there doesnt seem to be any
event for this - am I missing something?

Gary
 
P

Peter Duniho

gazza67 said:
Does anyone know how to check for when a sound has finished playing?

I am currently using the SoundPlayer, there doesnt seem to be any
event for this - am I missing something?

I believe you can call PlaySync() and that will not return until the
sound has finished. If you want async behavior while knowing when the
sound has finished playing, then use a worker thread to actually do the
PlaySync() call, and raise an event or otherwise signal when the
PlaySync() method returns in that thread.

There are more complicated solutions using DirectSound or the WinMM
stuff (via p/invoke), but I think the above should work.

Pete
 
G

gazza67

PlaySync, holds up your entire app, I dont want that to happen, I want
to be able to interrupt the play if a control is clicked.
 
G

gazza67

Please disregard my last post, I see what you are saying now, I will
try a worker thread as you describe.

Gary
 

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