All of lore.kernel.org
 help / color / mirror / Atom feed
* return value of snd_pcm_hw_params_set_rate_near
@ 2004-03-01  7:21 Doug McLain
  2004-03-01  8:24 ` Jaroslav Kysela
  2004-03-01  9:21 ` Måns Rullgård
  0 siblings, 2 replies; 4+ messages in thread
From: Doug McLain @ 2004-03-01  7:21 UTC (permalink / raw)
  To: alsa-devel

According to the alsa documentation, the return value of 
snd_hw_params_set_rate_near is the 'approximate chosen rate', and the 
3rd arg being type 'int'.  The two tutorials at the documentation 
section of the alsa-project website both hold true to this with code like:

exact_rate = snd_pcm_hw_params_set_rate_near(pcm_handle, hwparams, rate, &dir);
    if (dir != 0) {
      fprintf(stderr, "The rate %d Hz is not supported by your hardware.\n 
                       ==> Using %d Hz instead.\n", rate, exact_rate);
    }



After unsuccesful attempts at using this function this way (I'm learning 
linux audio software devel starting with alsa drivers and user 
interface), I went into the aplay source and found the version that 
tests a before and after version of arg 3 (which is a pointer to int 
that gets changed to the result rate by the function) and tests the 
return only for err. I assume this function changed?  Im at the learning 
stage so I'm probably stating the obvious, but when your new sometimes 
reassurance from someone that knows helps.  Is the documentaion just 
behind, or did this slip by unnoticed?  Curious...

---

http://nostar.isa-geek.com




-------------------------------------------------------
SF.Net is sponsored by: Speed Start Your Linux Apps Now.
Build and deploy apps & Web services for Linux with
a free DVD software kit from IBM. Click Now!
http://ads.osdn.com/?ad_id=1356&alloc_id=3438&op=click

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: return value of snd_pcm_hw_params_set_rate_near
  2004-03-01  7:21 return value of snd_pcm_hw_params_set_rate_near Doug McLain
@ 2004-03-01  8:24 ` Jaroslav Kysela
  2004-03-01  8:49   ` Doug McLain
  2004-03-01  9:21 ` Måns Rullgård
  1 sibling, 1 reply; 4+ messages in thread
From: Jaroslav Kysela @ 2004-03-01  8:24 UTC (permalink / raw)
  To: Doug McLain; +Cc: alsa-devel

On Mon, 1 Mar 2004, Doug McLain wrote:

> According to the alsa documentation, the return value of 
> snd_hw_params_set_rate_near is the 'approximate chosen rate', and the 
> 3rd arg being type 'int'.  The two tutorials at the documentation 
> section of the alsa-project website both hold true to this with code like:
> 
> exact_rate = snd_pcm_hw_params_set_rate_near(pcm_handle, hwparams, rate, &dir);
>     if (dir != 0) {
>       fprintf(stderr, "The rate %d Hz is not supported by your hardware.\n 
>                        ==> Using %d Hz instead.\n", rate, exact_rate);
>     }
> 
> 
> 
> After unsuccesful attempts at using this function this way (I'm learning 
> linux audio software devel starting with alsa drivers and user 
> interface), I went into the aplay source and found the version that 
> tests a before and after version of arg 3 (which is a pointer to int 
> that gets changed to the result rate by the function) and tests the 
> return only for err. I assume this function changed?  Im at the learning 
> stage so I'm probably stating the obvious, but when your new sometimes 
> reassurance from someone that knows helps.  Is the documentaion just 
> behind, or did this slip by unnoticed?  Curious...

Yes, the new functions returns value in function parameter not result.

Can you post me URL on the ALSA website, where this information is not 
updated?

						Jaroslav

-----
Jaroslav Kysela <perex@suse.cz>
Linux Kernel Sound Maintainer
ALSA Project, SuSE Labs


-------------------------------------------------------
SF.Net is sponsored by: Speed Start Your Linux Apps Now.
Build and deploy apps & Web services for Linux with
a free DVD software kit from IBM. Click Now!
http://ads.osdn.com/?ad_id=1356&alloc_id=3438&op=click

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: return value of snd_pcm_hw_params_set_rate_near
  2004-03-01  8:24 ` Jaroslav Kysela
@ 2004-03-01  8:49   ` Doug McLain
  0 siblings, 0 replies; 4+ messages in thread
From: Doug McLain @ 2004-03-01  8:49 UTC (permalink / raw)
  To: Jaroslav Kysela; +Cc: alsa-devel

http://www.alsa-project.org/alsa-doc/alsa-lib/group___p_c_m___h_w___params.html#a58

Thanks for the reply...

P.S.  I was mistaken, the doc does in fact define arg 3 as 'pointer to 
int' and describes the action.  The return value is the only problem.

Jaroslav Kysela wrote:

>On Mon, 1 Mar 2004, Doug McLain wrote:
>
>  
>
>>According to the alsa documentation, the return value of 
>>snd_hw_params_set_rate_near is the 'approximate chosen rate', and the 
>>3rd arg being type 'int'.  The two tutorials at the documentation 
>>section of the alsa-project website both hold true to this with code like:
>>
>>exact_rate = snd_pcm_hw_params_set_rate_near(pcm_handle, hwparams, rate, &dir);
>>    if (dir != 0) {
>>      fprintf(stderr, "The rate %d Hz is not supported by your hardware.\n 
>>                       ==> Using %d Hz instead.\n", rate, exact_rate);
>>    }
>>
>>
>>
>>After unsuccesful attempts at using this function this way (I'm learning 
>>linux audio software devel starting with alsa drivers and user 
>>interface), I went into the aplay source and found the version that 
>>tests a before and after version of arg 3 (which is a pointer to int 
>>that gets changed to the result rate by the function) and tests the 
>>return only for err. I assume this function changed?  Im at the learning 
>>stage so I'm probably stating the obvious, but when your new sometimes 
>>reassurance from someone that knows helps.  Is the documentaion just 
>>behind, or did this slip by unnoticed?  Curious...
>>    
>>
>
>Yes, the new functions returns value in function parameter not result.
>
>Can you post me URL on the ALSA website, where this information is not 
>updated?
>
>						Jaroslav
>
>-----
>Jaroslav Kysela <perex@suse.cz>
>Linux Kernel Sound Maintainer
>ALSA Project, SuSE Labs
>
>
>-------------------------------------------------------
>SF.Net is sponsored by: Speed Start Your Linux Apps Now.
>Build and deploy apps & Web services for Linux with
>a free DVD software kit from IBM. Click Now!
>http://ads.osdn.com/?ad_id=1356&alloc_id=3438&op=click
>_______________________________________________
>Alsa-devel mailing list
>Alsa-devel@lists.sourceforge.net
>https://lists.sourceforge.net/lists/listinfo/alsa-devel
>
>  
>



-------------------------------------------------------
SF.Net is sponsored by: Speed Start Your Linux Apps Now.
Build and deploy apps & Web services for Linux with
a free DVD software kit from IBM. Click Now!
http://ads.osdn.com/?ad_id=1356&alloc_id=3438&op=click

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: return value of snd_pcm_hw_params_set_rate_near
  2004-03-01  7:21 return value of snd_pcm_hw_params_set_rate_near Doug McLain
  2004-03-01  8:24 ` Jaroslav Kysela
@ 2004-03-01  9:21 ` Måns Rullgård
  1 sibling, 0 replies; 4+ messages in thread
From: Måns Rullgård @ 2004-03-01  9:21 UTC (permalink / raw)
  To: alsa-devel

Doug McLain <nostar@comcast.net> writes:

> According to the alsa documentation, the return value of
> snd_hw_params_set_rate_near is the 'approximate chosen rate', and the
> 3rd arg being type 'int'.  The two tutorials at the documentation
> section of the alsa-project website both hold true to this with code
> like:
>
> exact_rate = snd_pcm_hw_params_set_rate_near(pcm_handle, hwparams, rate, &dir);
>     if (dir != 0) {
>       fprintf(stderr, "The rate %d Hz is not supported by your
>       hardware.\n                      ==> Using %d Hz instead.\n",
>       rate, exact_rate);
>     }
>
> After unsuccesful attempts at using this function this way (I'm
> learning linux audio software devel starting with alsa drivers and
> user interface), I went into the aplay source and found the version
> that tests a before and after version of arg 3 (which is a pointer to
> int that gets changed to the result rate by the function) and tests
> the return only for err. I assume this function changed?  Im at the
> learning stage so I'm probably stating the obvious, but when your new
> sometimes reassurance from someone that knows helps.  Is the
> documentaion just behind, or did this slip by unnoticed?  Curious...

The function was changed some time ago, along with a few other similar
cases.

-- 
Måns Rullgård
mru@kth.se



-------------------------------------------------------
SF.Net is sponsored by: Speed Start Your Linux Apps Now.
Build and deploy apps & Web services for Linux with
a free DVD software kit from IBM. Click Now!
http://ads.osdn.com/?ad_id=1356&alloc_id=3438&op=click

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2004-03-01  9:21 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-03-01  7:21 return value of snd_pcm_hw_params_set_rate_near Doug McLain
2004-03-01  8:24 ` Jaroslav Kysela
2004-03-01  8:49   ` Doug McLain
2004-03-01  9:21 ` Måns Rullgård

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.