* available sampling rate detection
@ 2003-02-11 7:53 Martin Herren
2003-02-11 8:40 ` Takashi Iwai
2003-02-11 9:26 ` Patrice Tisserand
0 siblings, 2 replies; 4+ messages in thread
From: Martin Herren @ 2003-02-11 7:53 UTC (permalink / raw)
To: alsa-devel
[-- Attachment #1: Type: text/plain, Size: 1172 bytes --]
Hej,
i'm new on this list as well as to alsa.
We need to find out the supported sampling rates (and other parameters) for the pcm devices of soundcards.
We used snd_pcm_hw_params_test_rate() for this, which according to the documentation (http://www.alsa-project.org/alsa-doc/alsa-lib/group___p_c_m___h_w___params.html#a53)
should return 1 if the rate is available, 0 otherwise.
The problem is that it always returned an non-null value, for any rate even if we knew it wasn't supported.
Then we found out that we need to call snd_pcm_hw_params_any() first, and then snd_pcm_hw_params_test_rate() returns 0 for supported rates, and a negativ value (-22) otherwise.
Is this the correct way to do the test or did we miss a point ?
If it is correct, the documentation should be updated.
An additional question, what is the correct way to find out all existing cards/buses on a system ? Currently we scan /proc/asound/card?/ for all pcmX[cp]. Is there a better way to do it ?
Thanks,
Martin
--
Martin Herren
Protux - A Free Professional Audio Tool for GNU/Linux:
-> http://www.nongnu.org/protux/
Open your Windows - Free your Mind - Enjoy:
->http://gnuwin.epfl.ch
[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: available sampling rate detection
2003-02-11 7:53 available sampling rate detection Martin Herren
@ 2003-02-11 8:40 ` Takashi Iwai
2003-02-11 9:26 ` Patrice Tisserand
1 sibling, 0 replies; 4+ messages in thread
From: Takashi Iwai @ 2003-02-11 8:40 UTC (permalink / raw)
To: Martin Herren; +Cc: alsa-devel
At Tue, 11 Feb 2003 08:53:59 +0100,
Martin Herren wrote:
>
> Hej,
>
> i'm new on this list as well as to alsa.
>
> We need to find out the supported sampling rates (and other parameters) for the pcm devices of soundcards.
>
> We used snd_pcm_hw_params_test_rate() for this, which according to the documentation (http://www.alsa-project.org/alsa-doc/alsa-lib/group___p_c_m___h_w___params.html#a53)
> should return 1 if the rate is available, 0 otherwise.
> The problem is that it always returned an non-null value, for any rate even if we knew it wasn't supported.
>
> Then we found out that we need to call snd_pcm_hw_params_any() first, and then snd_pcm_hw_params_test_rate() returns 0 for supported rates, and a negativ value (-22) otherwise.
the documentation is wrong. the test functions return zero if
supported and a negative value if not supported, as well as the set
functions do.
Takashi
-------------------------------------------------------
This SF.NET email is sponsored by:
SourceForge Enterprise Edition + IBM + LinuxWorld = Something 2 See!
http://www.vasoftware.com
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: available sampling rate detection
2003-02-11 7:53 available sampling rate detection Martin Herren
2003-02-11 8:40 ` Takashi Iwai
@ 2003-02-11 9:26 ` Patrice Tisserand
2003-02-12 18:05 ` Martin Herren
1 sibling, 1 reply; 4+ messages in thread
From: Patrice Tisserand @ 2003-02-11 9:26 UTC (permalink / raw)
To: Martin Herren; +Cc: alsa-devel
On Tue, 2003-02-11 at 08:53, Martin Herren wrote:
[..]
> An additional question, what is the correct way to find out all existing cards/buses on a system ? Currently we scan /proc/asound/card?/ for all pcmX[cp]. Is there a better way to do it ?
>
I think you case use a loop with snd_card_next
from alsa-lib/src/control/card.c
/**
* \brief Try to determine the next card.
* \param rcard pointer to card number
* \result zero if success, otherwise a negative error code
*
* Tries to determine the next card from given card number.
* If card number is -1, then the first available card is
* returned. If the result card number is -1, no more cards
* are available.
*/
int snd_card_next(int *rcard)
--
Patrice Tisserand <Patrice.Tisserand@ircam.fr>
IRCAM
-------------------------------------------------------
This SF.NET email is sponsored by:
SourceForge Enterprise Edition + IBM + LinuxWorld = Something 2 See!
http://www.vasoftware.com
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: available sampling rate detection
2003-02-11 9:26 ` Patrice Tisserand
@ 2003-02-12 18:05 ` Martin Herren
0 siblings, 0 replies; 4+ messages in thread
From: Martin Herren @ 2003-02-12 18:05 UTC (permalink / raw)
To: alsa-devel
[-- Attachment #1: Type: text/plain, Size: 1226 bytes --]
On Tue, 11 Feb 2003 10:26:25 +0100
Patrice Tisserand <Patrice.Tisserand@ircam.fr> wrote:
> On Tue, 2003-02-11 at 08:53, Martin Herren wrote:
> [..]
> > An additional question, what is the correct way to find out all existing cards/buses on a system ? Currently we scan /proc/asound/card?/ for all pcmX[cp]. Is there a better way to do it ?
> >
> I think you case use a loop with snd_card_next
>
> from alsa-lib/src/control/card.c
> /**
> * \brief Try to determine the next card.
> * \param rcard pointer to card number
> * \result zero if success, otherwise a negative error code
> *
> * Tries to determine the next card from given card number.
> * If card number is -1, then the first available card is
> * returned. If the result card number is -1, no more cards
> * are available.
> */
> int snd_card_next(int *rcard)
thanks, i didn't have time to test it, but there seems to several interesting functions which could be what we need.
thanks to Takashi too... next time i'll try to read the source for such a question ;-)
/Martin
--
Martin Herren
Protux - A Free Professional Audio Tool for GNU/Linux:
-> http://www.nongnu.org/protux/
Open your Windows - Free your Mind - Enjoy:
->http://gnuwin.epfl.ch
[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2003-02-12 18:05 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-02-11 7:53 available sampling rate detection Martin Herren
2003-02-11 8:40 ` Takashi Iwai
2003-02-11 9:26 ` Patrice Tisserand
2003-02-12 18:05 ` Martin Herren
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.