public inbox for alsa-devel@alsa-project.org
 help / color / mirror / Atom feed
From: James Courtier-Dutton <James@superbug.co.uk>
To: Jaroslav Kysela <perex@suse.cz>
Cc: ALSA development <alsa-devel@alsa-project.org>
Subject: Re: simple PCM helper function
Date: Mon, 09 Jan 2006 16:21:36 +0000	[thread overview]
Message-ID: <43C28D90.10103@superbug.co.uk> (raw)
In-Reply-To: <Pine.LNX.4.61.0601062102080.10811@tm8103.perex-int.cz>

Jaroslav Kysela wrote:

>Hi all,
>
>	I added three functions to alsa-lib - PCM API:
>
>/*
> * application helpers - these functions are implemented on top
> * of the basic API
> */
>
>int snd_pcm_recover(snd_pcm_t *pcm, int err, int silent);
>int snd_pcm_set_params(snd_pcm_t *pcm,
>                       snd_pcm_format_t format,
>                       snd_pcm_access_t access,
>                       unsigned int channels,
>                       unsigned int rate,
>                       int soft_resample,
>                       unsigned int latency);
>int snd_pcm_get_params(snd_pcm_t *pcm,
>                       snd_pcm_uframes_t *buffer_size,
>                       snd_pcm_uframes_t *period_size);
>
>	These functions are intended for "lazy" people who are doing just 
>simple command line players or recorders and don't want to bother with
>the ALSA details. The implementation comes from strong attitude against
>alsa-lib on LKML by some people.
>	Please, look to them and tell me, if I missed something useable.
>The really "minimalistic" example using these functions is in 
>alsa-lib/test/pcm_min.c (compile the code typing 'make pcm_min' in the 
>test directory).
>
>						Jaroslav
>  
>
Would it not have been better to provide a similar few function calls, 
but use a method similar to MaxOSX. I.e. callback based.
I.e. Set parameters, and one of the parameters is the callback function 
of the user's program.
The application would then not care how big the sound hardware buffer 
size was.
The callback would just be:
snd_pcm_callback(void *private,     /* Private information provided by 
the user application at set_params call */
            void *buffer,    /* Frame buffer */
            snd_pcm_uframes_t number_of_samples_please,  /* number of 
samples for frame buffer */
            snd_pcm_format_t format, /* Might not be needed, but the 
same format. */
            snd_pcm_uframe_t delay, /* Estimate of delay between the 
current time, and the time when the same will reach the DAC */
            int status);  /* RUNNING, XRUN etc. */

Where "number_of_samples_please" is likely to be the period size.
One could therefore drop the

snd_pcm_get_params()

and 
snd_pcm_recover()
would hardly ever need to be called.

James




-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click

  parent reply	other threads:[~2006-01-09 16:21 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-01-06 20:10 simple PCM helper function Jaroslav Kysela
2006-01-07 11:38 ` Conditionally compiling for 1.0.9 and later ? Dave Raggett
2006-01-09 16:21 ` James Courtier-Dutton [this message]
2006-01-10 12:26   ` simple PCM helper function Jaroslav Kysela
2006-01-14 21:48     ` Giuliano Pochini

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=43C28D90.10103@superbug.co.uk \
    --to=james@superbug.co.uk \
    --cc=alsa-devel@alsa-project.org \
    --cc=perex@suse.cz \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox