From alsa-devel-owner@alsa.jcu.cz  Sun Jan 10 12:00:43 1999
Received: from entry.jcu.cz (IDENT:perex@entry.jcu.cz [160.217.1.111])
	by marvin.jcu.cz (8.9.1a/8.9.1) with SMTP id MAA07932;
	Sun, 10 Jan 1999 12:00:28 +0100
Date: Sun, 10 Jan 1999 12:00:28 +0100 (CET)
From: Jaroslav Kysela <perex@jcu.cz>
To: Benjamin GOLINVAUX <golinvaux@benjamin.net>
cc: alsa-devel@alsa.jcu.cz
Subject: Re: Question : library API
In-Reply-To: <3697DE65.4AF7E076@benjamin.net>
Message-ID: <Pine.LNX.3.96.990110114642.1596A-100000@entry.jcu.cz>
MIME-Version: 1.0
Content-Type: TEXT/PLAIN; charset=US-ASCII
Reply-To: alsa-devel@alsa.jcu.cz
Sender: alsa-devel-owner@alsa.jcu.cz
Precedence: list

On Sat, 9 Jan 1999, Benjamin GOLINVAUX wrote:

> Hi All...
> 
> Question 1 :
> 
> Is alsa-devel for driver coders and alsa-users for application coders
> and regular users, or
> should I (with my application related questions) send library API
> request to alsa-user ?

List alsa-user is mainly for installation support.

> Question 2 :
> 
> I'm trying to port an audio app from Win32/DirectSound to ALSA...
> 
> The model is kinda different and I'd like to know how to check the 'safe
> write' position. I mean, let's imagine I have a loop which is called as
> fast as possible and which makes some sound data ready for 2 or 3 ms at
> each call.... How could I suspend my process till I can send data ? In

Use select() function, non-block I/O and set appropriate playback
parameters (watermark limits for process wakeup - fragment_size,
fragments_max, fragments_room) for PCM device.

> Question 3 :
> 
> Regarding snd_pcm_write, is there a register-only way to send data to,
> let's say, a GUS or SB16 codec ? Is it CPU unfriendly ? ;-) OR is it
> possible to change DMA buffer size to lower this latency ?

Again, look to playback parameters structure.. Programmed I/O (direct 
writting samples to DAC or ADC) isn't very much useable under Linux.

> Question 4 :
> 
> Regarding the ALSA architecture, how does it manage the snd_pcm_write
> function : What happens if we try to send BIIIIG (let's say, 10 Mb)
> chunks of audio to a card ? snd_pcm_write allocs room for it, copies it
> then copies it to DMA buffer or does it directly feed dma buffer with
> OUR buffer ?

ALSA driver does copy of data from user space (application) directly to 
DMA buffer (or onboard memory for GF1 etc..). For block I/O - if data
are large - driver blocks application and waits until all user data aren't
processed. For non-block I/O is returned number of bytes written to
playback ring buffer in kernel.

							Jaroslav

-----
Jaroslav Kysela <perex@jcu.cz>
Academic Computer Centre, University of South Bohemia
Branisovska 31, C. Budejovice, CZ-370 05 Czech Republic


