BorlandTalk.com Forum Index BorlandTalk.com
Borland discussion newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Windows PlaySound () strangeness

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> C++ Builder (Native API)
View previous topic :: View next topic  
Author Message
Simon Elliott
Guest





PostPosted: Thu Jan 05, 2006 3:27 pm    Post subject: Windows PlaySound () strangeness Reply with quote



I always thought that I understood the Windows PlaySound() API function:

With the flag SND_ASYNC, the sound is played asynchronously and
PlaySound() returns immediately after beginning the sound.

with the flag SND_SYNC, PlaySound() returns after the sound event
completes.

However I've been testing some code which calls PlaySound() from within
a thread, with SND_SYNC set, and the PlaySound() call returns long
before the sound has finished playing. For a 60 second sound, the
PlaySound() call returns after less than 500 milliseconds. In fact,
it's behaving a lot like it should with SND_ASYNC.

This is happening both on a W2K box with SP4, and XP with SP2. Has
anyone else seen this?

--
Simon Elliott http://www.ctsn.co.uk
Back to top
Simon Elliott
Guest





PostPosted: Thu Jan 05, 2006 3:53 pm    Post subject: Re: Windows PlaySound () strangeness Reply with quote



On 05/01/2006, I wrote:
(some stuff about PlaySound())

On further investigation this was due to a race condition in my code
which set the "PlaySound() finished" flag before PlaySound() had
actually finished...


--
Simon Elliott http://www.ctsn.co.uk
Back to top
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> C++ Builder (Native API) All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.