Re: Fragment/period setting

From: Alexandre Ratchov <>
Date: Sat, 4 Jul 2020 10:27:12 +0200
On Fri, Jul 03, 2020 at 08:42:53AM -0300, Sleep wrote:
> Hello, what is the equivalent of 'fragment' (from OSS) or 'period' (from
> ALSA) in Sndio's documentation? The section 5.1 of this document
> <> uses the term 'block':
> >The block size is stored in the ``round'' field of the sio_par structure,
> and is negotiated using sio_setpar(3) and sio_getpar(3).
> Is 'block' here the same as 'period' and 'fragment'? Meaning that the
> 'round' member of the sio_par struct stores the 'period size' as used in
> ALSA's documentation?


Yes, sio_par.round is the block/fragment/period size used by the
hardware (expressed in frames). Reads and writes rounded to it are
optimal in terms of latency.

Full-duplex programs must interleave reads and writes of blocks of
sio_par.round frames otherwise underruns/overruns may occur. Ex., as
in the pseudo-code below:

	write_samples(buf, par.bufsz)
	while (1) {
		read_samples(rec_buf, par.round);
		process(rec_buf, play_buf, par.round);
		write_samples(play_buf, par.round);


-- Alexandre
Received on Sat Jul 04 2020 - 10:27:12 CEST

This archive was generated by hypermail 2.3.0 : Tue Aug 09 2022 - 16:23:49 CEST