What is up with the system sounds on El Capitan?

I’m trying to implement a function to make a small sound when the user does thing, like adjusting a value.

When I use the Xojo sound class, it has to wait for the sound to complete before the app continues. Which I don’t mind as the sound is very very quick, the downside is that it can wait as long as a second before the sound is played.

I switched over to using NSSound and while it’s doesn’t hog the main thread, it can take up to 2 seconds before the sound is actually played.

Both of which are terrible for providing audio feedback. Ideas, suggestions?

That lag has always been there afaik but it should only happen the first time played. A workaround I’ve read about is to prime it on app launch by setting volume 0, play it once and reset volume. Workarounds I’ve used 1) play through a MoviePlayer 2) load and play with Audio ToolBox declares, specifically the Extended Audio File Services which are the simplest to use (but still some work). Or use an audio plugin.

Maybe AVFoundation can come to the rescue?

Hi Jean-paul,
Thanks for the example code, but it has the same issue as the system sounds. Which is that they play after the action occurs. I want to have the sounds play at the exact some time as the action.

Thanks Will, I’ll check these out over the next couple of days.

I’d rather not delve into that ‘bag of pain’ again, especially to play a sound that’s not even 1 second long…

Doh! I mis-remembered, Extended Audio File Services is only reading and writing files. There is a System Sound Services in Audio Toolbox that plays files but I haven’t used it and maybe the same lag headache.

@jean-paul devulder
Thanks for the demo application, interesting to see the NSOperationQueue code. It might come in handy in the future. It looks like a really easy way to add some multi-core threading.

@Joe Ranieri How safe is it use [NSOperationQueue addOperationWithBlock:] in a Xojo made application? Is there anything we should be cautious of, or things we need to pay attention to?

Not at all safe.

Pfffttt… splosh… wrrrghhg… That’s the sound of my hopes and dreams being flushed down the toilet. Anyone got a toilet brush, this one doesn’t want to go down.

Just found that even Beep or NSBeep are no longer synchronous and can take 1~2 seconds to play (have my screen set to flash when the system sound plays).

With both a Xojo made application and an Xcode made application, so there’s something laggy in El Cap and Yosemite :frowning:

Yet another iOS intrusion :confused:

I’m presuming so :frowning: