At Tue, 15 May 2012 00:45:54 -0700, Paul D. DeRocco wrote:
I'm writing 48KHz stereo to Intel HD audio on my mobo, and I'd like to send it in parallel to both the analog and S/PDIF outputs, which share a clock source. If I open both devices, configure them with the same buffer space, and write the same data with snd_pcm_writei, how should I handle an underrun? Call snd_pcm_prepare on both device handles? If so, and the first device underruns, should I bother writing the buffer to the second device?
It's no direct answer to your question, but: Isn't the SPDIF device sent from the same codec as the analog, or it's over a different codec? In the former case, turning on "IEC958 Default PCM Playback Switch" mixer will send the stream both to analog and SPDIF outs. (When an SPDIF device was opened beforehand, this will keep the device thus the multiplex won't happen, though.)
Takashi