Play a Sound File and know when it's finished...

G

Guest

Hi all,

As the title suggests, I'm trying to play back an audio file and know
when it's finished.

I've tried several methods:

1. My.Computer.Audio.Play - No way of knowing when a file is finished
playing

2. SoundPlayer - Same as #1

3. Media Player SDK 9.0 - Duration flag not set correctly - always 0.
Even tried a workaround of creating the newMedia manually, still 0.

4. DirectSounds - works, but only when the app is in focus

Although it seems like a simple thing to do, I'm having a lot of
trouble.

I need to:

1. Play a sound asynchronously
2. Get notified when the sound is finished playing
3. The app can be in the foreground or background
4. Get some basic information about the file - such as duration,
frequency, etc. etc

So what is my best option?

Thanks!
 
G

Guest

4. DirectSounds - works, but only when the app is in focus

I solved the problem... Setting the BufferDescription.GlobalFocus flag =
True solved the issue :)
 
K

kimiraikkonen

Thanks for the update.

I also wonder how can my program know when using WMP control after a
song is finished, i mean which event area i must enter the mediaended
or mediaStopped code.
 

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