protux-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Protux-devel] [Fwd: Re: [Alsa-devel] available sampling rate detect


From: Martin Herren
Subject: Re: [Protux-devel] [Fwd: Re: [Alsa-devel] available sampling rate detection]
Date: Tue, 11 Feb 2003 10:17:32 +0100
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:0.9.4) Gecko/20011128 Netscape6/6.2.1

Martin Herren wrote:

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


i changed the three snd_pcm_hw_params_test_...()==0 to != 0 and added snd_pcm_hw_params_any() before the first test. MustuxAudioDeviceMapper seems now to recognise correctly the interfaces. I removed the comments around the format test, as if works fine for me too...

But even if MustuxAudioDeviceMapper seems to detect correctly the capabilities of the interfaces, BusSelector still let me select buses that's don't support 44.1kHz (like my digital out), and don't allow me to select 'legal' buses, like my SB16 in...

i didn't commit any changes to cvs, but here's my patch for MustuxAudioDeviceMapper.cc:

address@hidden:~/mustuxlib$ cvs diff MustuxAudioDeviceMapper.cc
Index: MustuxAudioDeviceMapper.cc
===================================================================
RCS file: /cvsroot/mustux/mustuxlib/MustuxAudioDeviceMapper.cc,v
retrieving revision 1.36
diff -r1.36 MustuxAudioDeviceMapper.cc
667a668,669
>       if (snd_pcm_hw_params_any(pcmHandle, tempHwParams) < 0)
> return ERROR_CANNOT_OPEN_BUS; // would need its own error code
669c671
< if (snd_pcm_hw_params_test_rate (pcmHandle, tempHwParams, pRate, 0)==0)
---
> if (snd_pcm_hw_params_test_rate (pcmHandle, tempHwParams, pRate, 0)!=0)
674,675c676,677
< /* UNCOMMENT ME ...  THIS IS CRASHING !!! WHY ???
< if (snd_pcm_hw_params_test_format (pcmHandle, tempHwParams, format)==0)
---
> /* UNCOMMENT ME ...  THIS IS CRASHING !!! WHY ??? */
> if (snd_pcm_hw_params_test_format (pcmHandle, tempHwParams, format)!=0)
681,682c683,684
< */
< if (snd_pcm_hw_params_test_channels (pcmHandle, tempHwParams, pChannels)==0)
---
>
> if (snd_pcm_hw_params_test_channels (pcmHandle, tempHwParams, pChannels)!=0)






reply via email to

[Prev in Thread] Current Thread [Next in Thread]