DEgITx
DEgITx

Reputation: 980

Mac OS X sound output

Are there any examples for how to output a raw sound buffer on Mac OS X?
Something like pa_simple_write() for pulseaudio or waveOutWrite() from WINAPI.

Upvotes: 2

Views: 2400

Answers (2)

Goz
Goz

Reputation: 62323

You need to create an AudioQueue.

Next you need to allocate a buffer. Once allocated, you then fill it with data and enqueue it. Finally you call AudioQueueStart. You can then immediately call AudioQueueStop passing false as the last parameter.

The above won't work very well, though, if you need to play multiple sounds simultaneously. If you wish to do that, AFAIK, you'll need a more complex setup where you mix audio into a buffer. That will get complicated quickly, though ...

Upvotes: 1

user149341
user149341

Reputation:

Easiest way I've run into is to use libao. Conveniently, it's also cross-platform.

Upvotes: 0

Related Questions