Reputation: 980
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
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
Reputation:
Easiest way I've run into is to use libao. Conveniently, it's also cross-platform.
Upvotes: 0