[Stk] Multichannel audio, RtAudio, and RtWvOut
David Michael
david@wildlifeanalysis.org
Wed, 1 Aug 2007 19:23:23 -0400
Hello
I have some questions regarding the use of STK for the playback of
multiple audio channels in realtime. Specifically I am trying to code
up a panner to handle any number of output channels (similar to the
NPAN in RTcmix as far as I can tell).
1) Is there a preferred realtime interface (RtAudio or RtWvOut) for
realtime multichannel audio data?
2) Is getting RtAudio to handle multiple channels in the callback
function just a matter of writing another sample to the buffer
pointer like so?:
register StkFloat *samples = (StkFloat *) buffer;
for ( int i=0; i<bufferSize; i++ ) {
StkFloat xxx = data->instrument->tick();
*samples++ = xxx; // channel 1
*samples++ = xxx; // channel 2
}
So for 3 channels it would look like this?:
or ( int i=0; i<bufferSize; i++ ) {
StkFloat xxx = data->instrument->tick();
*samples++ = xxx; // channel 1
*samples++ = xxx; // channel 2
*samples++ = xxx; // channel 3
}
If someone would like to help clarify this aspect of RtAudio, it
would be much appreciated. If it is only a matter of adding another
buffer sample to the pointer var, then I see how I could have the tick
() return an array or vector. Should I be using RtWvOut instead??
3) I have searched this one out, but are there any tutorials anywhere
that specifically address the use on STK with multiple realtime
channels, or alternatively does someone on list have some simple
example code that they could share?
Thanks in advance for your help
Best
David