sorry for the late reply
ndivuyo to both an audio output and an analog output since they have different sample rates.
Say that you write to the audio out with
audioWrite(context, n, channel, outValue);
where n
is the frame you write to and channel
is the channel you write to, then, assuming the analog channels have half of the sampling rate (and half of the frames) as the audio channels, you'd write:
analogWriteOnce(context, n/2, channel, outValue);
So for instance you could have something like this:
for(unsigned int n = 0; n < context->audioFrames; ++n)
{
// audio channels
for(unsigned int channel = 0; channel < context->audioOutChannels; ++channel)
{
float outValue;
// do some magic to compute outValue, possibly channel-dependent
audioWrite(context, channel, outValue);
}
// analog channels
if(n % 2 == 0) // write analog channel only on even audio frames
{
for(unsigned int channel = 0; channel < context->analogOutChannels; ++channel)
{
float outValue;
// do some magic to compute outValue, possibly channel-dependent
// use n/2, as there are half as many analog frames as there are audio frames
analogWriteOnce(context, n/2, channel, outValue);
}
}
}