On 5/2/07, Stephen Cameron <smcameron(a)yahoo.com> wrote:
Oh yeah I do see it now, so, nevermind.
Looking at pa_multi_sine.c, I can see that
each stream can have multiple channels, and an example
of doing it interleaved and not interleaved.
So, portaudio looks like it's just what I needed.
Hmm, not quite on the mark. Multiple channels give you more speakers;
for one channel, you have mono, for two channels, you have stereo, for
7 channels, you have surround sound, etc. However, you were right on
the mark with your code sample in the previous email. Just integrate
that into your program, and you should have a working audio engine.
The only wrinkle is the race condition you noted when accessing the
sources list. In a normal situation, you'd obviously solve the problem
using locks, but that's not an option in this case, since the
PortAudio callback isn't allowed to do any potentially blocking
operations (such as acquiring a lock). You need to use some sort of
lock-free synchronization algorithm. I've never tackled that sort of
problem with PortAudio in particular, but you may look at this page
(from the creator of PortAudio) for some pointers:
http://www.audiomulch.com/~rossb/code/lockfree/