471,627 Members | 1,466 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,627 software developers and data experts.

polling wavplay

Hi all,

I used the class on CodeGuru to play wav files;

http://www.codeguru.com/csharp/cshar...cle.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

Jan 23 '06 #1
2 1252
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.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

<jo************@googlemail.com> wrote in message
news:11**********************@g44g2000cwa.googlegr oups.com...
Hi all,

I used the class on CodeGuru to play wav files;

http://www.codeguru.com/csharp/cshar...cle.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

Jan 23 '06 #2
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.

Feb 7 '06 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by Sporge | last post: by
1 post views Thread by Daniel Bass | last post: by
1 post views Thread by engwar | last post: by
1 post views Thread by kelvin.jones | last post: by
5 posts views Thread by Mike | last post: by
13 posts views Thread by LordHog | last post: by
3 posts views Thread by Chris Mullins [MVP - C#] | last post: by
1 post views Thread by XIAOLAOHU | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.