From mboxrd@z Thu Jan 1 00:00:00 1970 From: Abramo Bagnara Subject: Re: periods? fragments? Date: Mon, 19 May 2003 10:06:54 +0200 Sender: alsa-devel-admin@lists.sourceforge.net Message-ID: <3EC8909E.7090904@libero.it> References: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: Errors-To: alsa-devel-admin@lists.sourceforge.net List-Help: List-Post: List-Subscribe: , List-Unsubscribe: , List-Archive: To: Paul Davis Cc: David Stuart , alsa-devel@lists.sourceforge.net List-Id: alsa-devel@alsa-project.org Paul Davis ha scritto: >>Greetings! Fledgeling alsa developer here, >> >>After reading a bunch of documentation, it's unclear to me exactly what >>a period/fragment is used for. Could anyone expand on it a bit to fill >>me in? > > > there is a hardware buffer. its N frames long. you rarely want to deal > with the entire buffer at once. its therefore divided into sections of > a certain length, often (but not always) specified in numbers of > frames. these sections are called "periods" and typically (but not > always) the hardware will interrupt the CPU every time it finishes > dealing with a "period", and you in turn get to deal with it in 1 (or > more) periods at a time. the number of periods per h/w buffer (or > alternately, their size) is a hardware parameter; how many periods > have to have been processed by the h/w before the driver will wake up > your code to read/write more data is a software parameter. > > a "fragment" is an older OSS term for the same concept. Caution there Paul, your definitions are wrong. A period in ALSA is exactly the distance (measured in frames or time) between two consecutive periodic interrupts generated by PCM hardware. There is no mandatory correlation between buffer size and period for ALSA (as there is no mandatory correlation in all hardware). This is fundamentally different from OSS where a fragment sizes are forced to be buffer_size/K (with an integer K). This is exactly the reason why I've substituted fragment concept with period some time ago. -- Abramo Bagnara mailto:abramo.bagnara@libero.it Opera Unica Phone: +39.546.656023 Via Emilia Interna, 140 48014 Castel Bolognese (RA) - Italy ------------------------------------------------------- This SF.net email is sponsored by: If flattening out C++ or Java code to make your application fit in a relational database is painful, don't do it! Check out ObjectStore. Now part of Progress Software. http://www.objectstore.net/sourceforge