Re: NSBeep() blocks for some users
Re: NSBeep() blocks for some users
- Subject: Re: NSBeep() blocks for some users
- From: Jens Alfke <email@hidden>
- Date: Wed, 20 Jul 2011 08:59:57 -0700
On Jul 20, 2011, at 8:13 AM, Glenn L. Austin wrote:
>> I've had a few users complain that if my app calls NSBeep() many times in
>> quick succession the program blocks until each of the beeps has played
>> sequentially. I can't reproduce this: on my system, NSBeep() returns
>> immediately and a subsequent call to NSBeep() will cause the sound to stop
>> and restart. Is there any reason why some machines would behave differently?
>
> The sounds used for the beeps may be different formats, requiring different decoders that might not be interruptible.
IIRC, the beep from NSBeep() is actually played by a separate process (SystemUIServer?) This was an optimization added in some earlier OS release to avoid the overhead of initializing CoreAudio and decoding audio files in every app process.
NSSound, on the other hand, does run in your own process, and can definitely block the main thread for macroscopic periods, if that sound hasn’t been played recently.
—Jens
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden