[alsa-devel] Staying synced after underrun
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?
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.
Use snd_pcm_link() to ensure that the stream start happens at the same time. All linked streams are automatically started/stopped when one of them starts/ stops.
Regards, Clemens
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
participants (3)
-
Clemens Ladisch
-
Paul D. DeRocco
-
Takashi Iwai