Re: Fragment/period setting

From: Alexandre Ratchov <alex_at_caoua.org>
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
> <http://www.sndio.org/tips.html#section_5> 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?
> 

Hi,

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);
	}

HTH

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

This archive was generated by hypermail 2.3.0 : Sun Jul 05 2020 - 01:33:17 CEST