[alsa-devel] Some functionality of ice1724 broken between 1.0.14.RC1 and 1.0.14.RC3
Hi,
This is going to be fairly long because of the explanations needed, but there are three problems I've found on my Revolution 5.1 between Alsa 1.0.14.RC1 and 1.0.14.RC3.
1. Support for high sample rates 96000 and 192000 was lost. 2. Sound distortion at high sound frequencies was introduced. 3. The maximum buffer size seems too small for high sample rates (not related to release candidate).
Overview On Fedora 6 the alsa version is 1.0.14.RC1. Using that version, my application can use the high frequencies and there is no distortion introduced at high frequencies. On Fedora 7 the alsa version is 1.0.14.RC3. I can't use the high frequencies on the Revolution 5.1 and there is distortion introduced into the sound at high frequencies. In investigating this I noticed that the maximum buffer sizes seem small.
1.
Here is the output from my app on Fedora 6 at 192000. (1.0.14.RC1) This works great!
Minimum channels (1) Maximum channels (10000) Minimum rate (4000) Direction = 0 Maximum rate (4294967295) Direction = -1 Minimum period_time (10) Direction = 1 Maximum period_time (2048000) Direction = 0 Minimum period_size (0) Direction = 1 Maximum period_size (4294967295) Direction = -1 Minimum periods (0) Direction = 1 Maximum periods (4294967295) Direction = 0 Minimum buffer_time (1) Direction = 0 Maximum buffer_time (4294967295) Direction = 0 Minimum buffer_size (1) Maximum buffer_size (4294967294) Minimum tick_time (1000) Direction = 0 Maximum tick_time (1000) Direction = 0 Actual rate (192000) Direction = 0 Actual channels (2) Actual period_size (8) Direction = 0 Actual buffer_size (8192) <--- notice that this is reasonable
Here is the output from my app on Fedora 7 at 192000. (1.0.14.RC3) This aborts while setting the hardware parameters with invalid argument.
Minimum channels (1) Maximum channels (10000) Minimum rate (4000) Direction = 0 Maximum rate (4294967295) Direction = -1 Rate (48000) Direction = -1 Result = 0 <-- from test rate Rate (96000) Direction = -1 Result = 0 Rate (192000) Direction = -1 Result = 0 <-- maximum for card hw Rate (384000) Direction = -1 Result = 0 <-- accepts invalid 384000 Minimum period_time (21333) Direction = 1 <-- seems strange the same Maximum period_time (21334) Direction = -1 Minimum period_size (85) Direction = 1 Maximum period_size (91628833) Direction = -1 Minimum periods (0) Direction = 1 Maximum periods (17247242) Direction = -1 Minimum buffer_time (1) Direction = 0 Maximum buffer_time (4294967295) Direction = 0 Minimum buffer_size (170) Maximum buffer_size (1466015503) Minimum tick_time (0) Direction = 0 Maximum tick_time (4294967295) Direction = 0 Actual rate (192000) Direction = 0 Actual channels (2) Actual buffer_time (341333) Direction = 1 Actual buffer_size (65536) Actual buffer_size (65536) Actual period_time (21333) Direction = 1 Actual period_size (807872295) Direction = 1 <--- Note invalid period size Actual periods (21333) Direction = 1 cannot set parameters (Invalid argument) Could not open the sound device
The two are on the same hardware, just different OS versions. While investigating I switched from using size to time as the allocation mechanism without any effect (using the sample from pcm.c on alsa site).
I did a diff on the ice1724.c driver (attached below) and noticed that there was a lot of cleanup done by making the structs and arrays of structs const. Could that possibly cause this problem by not allowing calculated values to be set? Don't know. 44100 and 48000 work.
I installed the alsa-debuginfo package to try to get a handle on this in gdb. But with the extreme indirection in alsa in order to deal with all the options and the compiler optimization, gdb left my head spinning so I thought I would ask here before going any further.
Can you think of an explanation for this behavior? Can you fix it?
2.
I ran a frequency loudness test that is part of the app. It drops the frequency at 5 seconds intervals from 20 KHz to 5 Hz alternating. On Fedora 6 with 1.0.14.RC1 it works as expected. When above my hearing range I hear silence. When it gets to frequencies I can hear the sound is pure. On Fedora 7, this same app produces noise at frequencies I can't hear. This behavior is the same as the behavior I noticed with my emu10k1, ca0106 and CK8S sound cards on 1.0.14.RC1 as well as 1.0.14.RC3. I previously had ascribed this to bad/low quality sound chips; now I'm not so sure. In terms of sound quality the Rev 5.1 ranks well. See the link
http://compreviews.about.com/od/multimedia/tp/SoundCards.htm
Exact same hardware produces different sound. Can't explain it. Can you? Can you fix it?
3.
While looking at the ice1724.c code I noticed that the maximum buffer size is 2**18. This seems small for an application today. I'm producing sound at 192000 frames per second (admittedly overkill though I like very smooth sound) using stereo doubles (16 bytes per frame). The maximum buffer size is only a fraction of my per second byte rate.
Could you increase this?
Discussion.
The app is a binaural / chronaural beat generator and is on sourceforge at
http://sourceforge.net/projects/discord/
so you can download and run the tests yourself (about a meg). You will need libsndfile and libsamplerate installed to compile it. The version there won't have the conversion to time based allocation as I won't release that until this issue is resolved. To change the rate you change the -r option in the script file high_noon.discord (-r 192000 or --rate=192000). The run command to use is "./discord high_noon.discord". For issue 2 you have to run "./discord frequency_loudness_test.discord". Again change the rate using the -r option (-r 192000 or -r 96000 fail).
The open_alsa function starts at around line 5610 in discord.c if you want to play around with the initialization. I basically cloned it from the libsndfile samples.
If you aren't familiar with binaural or chronaural beats you can search for "binaural beat" or "brain wave entrainment" and find more than you probably want to know. :-)
Thanks for any help.
At Fri, 13 Jul 2007 06:23:26 -0700, stan wrote:
Hi,
This is going to be fairly long because of the explanations needed, but there are three problems I've found on my Revolution 5.1 between Alsa 1.0.14.RC1 and 1.0.14.RC3.
Could you check whether the same problem still exists on 1.0.14 final? There are tons of changes since rc3, so debugging rc3 is just a waste of time.
- Support for high sample rates 96000 and 192000 was lost.
- Sound distortion at high sound frequencies was introduced.
- The maximum buffer size seems too small for high sample rates (not related to release candidate).
Overview On Fedora 6 the alsa version is 1.0.14.RC1. Using that version, my application can use the high frequencies and there is no distortion introduced at high frequencies. On Fedora 7 the alsa version is 1.0.14.RC3. I can't use the high frequencies on the Revolution 5.1 and there is distortion introduced into the sound at high frequencies. In investigating this I noticed that the maximum buffer sizes seem small.
Here is the output from my app on Fedora 6 at 192000. (1.0.14.RC1) This works great!
Minimum channels (1) Maximum channels (10000) Minimum rate (4000) Direction = 0 Maximum rate (4294967295) Direction = -1 Minimum period_time (10) Direction = 1 Maximum period_time (2048000) Direction = 0 Minimum period_size (0) Direction = 1 Maximum period_size (4294967295) Direction = -1 Minimum periods (0) Direction = 1 Maximum periods (4294967295) Direction = 0 Minimum buffer_time (1) Direction = 0 Maximum buffer_time (4294967295) Direction = 0 Minimum buffer_size (1) Maximum buffer_size (4294967294) Minimum tick_time (1000) Direction = 0 Maximum tick_time (1000) Direction = 0 Actual rate (192000) Direction = 0 Actual channels (2) Actual period_size (8) Direction = 0 Actual buffer_size (8192) <--- notice that this is reasonable
Here is the output from my app on Fedora 7 at 192000. (1.0.14.RC3) This aborts while setting the hardware parameters with invalid argument.
Minimum channels (1) Maximum channels (10000) Minimum rate (4000) Direction = 0 Maximum rate (4294967295) Direction = -1 Rate (48000) Direction = -1 Result = 0 <-- from test rate Rate (96000) Direction = -1 Result = 0 Rate (192000) Direction = -1 Result = 0 <-- maximum for card hw Rate (384000) Direction = -1 Result = 0 <-- accepts invalid 384000 Minimum period_time (21333) Direction = 1 <-- seems strange the same Maximum period_time (21334) Direction = -1 Minimum period_size (85) Direction = 1 Maximum period_size (91628833) Direction = -1 Minimum periods (0) Direction = 1 Maximum periods (17247242) Direction = -1 Minimum buffer_time (1) Direction = 0 Maximum buffer_time (4294967295) Direction = 0 Minimum buffer_size (170) Maximum buffer_size (1466015503) Minimum tick_time (0) Direction = 0 Maximum tick_time (4294967295) Direction = 0 Actual rate (192000) Direction = 0 Actual channels (2) Actual buffer_time (341333) Direction = 1 Actual buffer_size (65536) Actual buffer_size (65536) Actual period_time (21333) Direction = 1 Actual period_size (807872295) Direction = 1 <--- Note invalid period size Actual periods (21333) Direction = 1 cannot set parameters (Invalid argument) Could not open the sound device
The two are on the same hardware, just different OS versions. While investigating I switched from using size to time as the allocation mechanism without any effect (using the sample from pcm.c on alsa site).
I did a diff on the ice1724.c driver (attached below) and noticed that there was a lot of cleanup done by making the structs and arrays of structs const. Could that possibly cause this problem by not allowing calculated values to be set? Don't know. 44100 and 48000 work.
No, consts shouldn't matter. (BTW, please use diff -up option at the next time. That'll make it way easier to read a patch.)
I ran a frequency loudness test that is part of the app. It drops the frequency at 5 seconds intervals from 20 KHz to 5 Hz alternating. On Fedora 6 with 1.0.14.RC1 it works as expected. When above my hearing range I hear silence. When it gets to frequencies I can hear the sound is pure. On Fedora 7, this same app produces noise at frequencies I can't hear. This behavior is the same as the behavior I noticed with my emu10k1, ca0106 and CK8S sound cards on 1.0.14.RC1 as well as 1.0.14.RC3. I previously had ascribed this to bad/low quality sound chips; now I'm not so sure. In terms of sound quality the Rev 5.1 ranks well. See the link
http://compreviews.about.com/od/multimedia/tp/SoundCards.htm
Exact same hardware produces different sound. Can't explain it. Can you? Can you fix it?
Might be alsa-lib dmix issue now used as default PCM? Which PCM configuration are you using? Does the problem exist even if you use "hw" (or "plughw") PCM explicitly?
While looking at the ice1724.c code I noticed that the maximum buffer size is 2**18. This seems small for an application today. I'm producing sound at 192000 frames per second (admittedly overkill though I like very smooth sound) using stereo doubles (16 bytes per frame). The maximum buffer size is only a fraction of my per second byte rate.
Could you increase this?
Ditto.
thanks,
Takashi
On Fri, 13 Jul 2007 15:33:28 +0200 Takashi Iwai tiwai@suse.de wrote:
At Fri, 13 Jul 2007 06:23:26 -0700, stan wrote:
[snip]
Could you check whether the same problem still exists on 1.0.14 final? There are tons of changes since rc3, so debugging rc3 is just a waste of time.
Darn! I was hoping you would just look at it and know the problem. :-)
How would I go about that? Is there a document somewhere that describes the process? I've downloaded the lib, drivers, utils, and tools for 1.0.14.final. I'll compile all of them. If I install to /usr/local/, will it work? I'm concerned about breaking the packaging system / the system. Do I modprobe the new kernel module from my own build? It's been a while since I messed with such things. I usually install applications outside the package management system, not base components like alsa. Hand holding would be nice but if you just point me towards some documentation that would be enough, or even describe the outline of the process and I can use search to find documentation.
[snip]
No, consts shouldn't matter. (BTW, please use diff -up option at the next time. That'll make it way easier to read a patch.)
Done and attached below.
I am working on the rest of your requests and will send it along later.
I ran a frequency loudness test that is part of the app. It drops the frequency at 5 seconds intervals from 20 KHz to 5 Hz alternating. On Fedora 6 with 1.0.14.RC1 it works as expected. When above my hearing range I hear silence. When it gets to frequencies I can hear the sound is pure. On Fedora 7, this same app produces noise at frequencies I can't hear. This behavior is the same as the behavior I noticed with my emu10k1, ca0106 and CK8S sound cards on 1.0.14.RC1 as well as 1.0.14.RC3. I previously had ascribed this to bad/low quality sound chips; now I'm not so sure. In terms of sound quality the Rev 5.1 ranks well. See the link
http://compreviews.about.com/od/multimedia/tp/SoundCards.htm
Exact same hardware produces different sound. Can't explain it. Can you? Can you fix it?
Might be alsa-lib dmix issue now used as default PCM? Which PCM configuration are you using? Does the problem exist even if you use "hw" (or "plughw") PCM explicitly?
I am using default, if I understand what you are asking. I will set it to use plughw:0,0 and try.
While looking at the ice1724.c code I noticed that the maximum buffer size is 2**18. This seems small for an application today. I'm producing sound at 192000 frames per second (admittedly overkill though I like very smooth sound) using stereo doubles (16 bytes per frame). The maximum buffer size is only a fraction of my per second byte rate.
Could you increase this?
Ditto.
That seems to have done the trick for both issues. You did answer it off the top of your head. :-)
Minimum channels (1) Maximum channels (10000) Minimum rate (4000) Direction = 0 Maximum rate (4294967295) Direction = -1 Rate (48000) Direction = -1 Result = 0 Rate (96000) Direction = -1 Result = 0 Rate (192000) Direction = -1 Result = 0 Rate (384000) Direction = -1 Result = 0 Minimum period_time (10) Direction = 1 Maximum period_time (2048000) Direction = 0 Minimum period_size (0) Direction = 1 Maximum period_size (4294967295) Direction = -1 Minimum periods (0) Direction = 1 Maximum periods (4294967295) Direction = 0 Minimum buffer_time (1) Direction = 0 Maximum buffer_time (4294967295) Direction = 0 Minimum buffer_size (1) Maximum buffer_size (4294967294) Minimum tick_time (1000) Direction = 0 Maximum tick_time (1000) Direction = 0 Actual rate (192000) Direction = 0 Actual channels (2) Actual buffer_time (170666) Direction = 1 Actual buffer_size (32768) Actual buffer_size (32768) Actual period_time (85333) Direction = 1 Actual period_size (16384) Direction = 0 Actual periods (2) Direction = 0 Actual rate (192000) Direction = 0 Actual channels (2) Actual periods (2) Direction = 0 Actual period_size (16384) Direction = 0 Actual buffer_size (32768)
What would be the effect of using plughw:0,0 instead of default on an average system? Would a user have any control over which sound card plays the sound? Or, to rephrase, with default if a user changes the default then the sound card playing changes, with plughw:0,0 the user is locked into the first card, true?
Let me know if you still want me to test 14 final, though it seems redundant now.
Thanks for your help.
For RPM based systems, I have a build environment for the drivers, libs, and utils packages at http://members.dsl-only.net/~tdavis/my-build.tar.bz2. You need to be root to build them, but they won't interfere with your rpm distribution. THe driver rpm will also make a backup of your current drivers prior to installation.
Tobin
Quoting stan stanl@cox.net:
On Fri, 13 Jul 2007 15:33:28 +0200 Takashi Iwai tiwai@suse.de wrote:
At Fri, 13 Jul 2007 06:23:26 -0700, stan wrote:
[snip]
Could you check whether the same problem still exists on 1.0.14 final? There are tons of changes since rc3, so debugging rc3 is just a waste of time.
Darn! I was hoping you would just look at it and know the problem. :-)
How would I go about that? Is there a document somewhere that describes the process? I've downloaded the lib, drivers, utils, and tools for 1.0.14.final. I'll compile all of them. If I install to /usr/local/, will it work? I'm concerned about breaking the packaging system / the system. Do I modprobe the new kernel module from my own build? It's been a while since I messed with such things. I usually install applications outside the package management system, not base components like alsa. Hand holding would be nice but if you just point me towards some documentation that would be enough, or even describe the outline of the process and I can use search to find documentation.
[snip]
No, consts shouldn't matter. (BTW, please use diff -up option at the next time. That'll make it way easier to read a patch.)
Done and attached below.
I am working on the rest of your requests and will send it along later.
I ran a frequency loudness test that is part of the app. It drops the frequency at 5 seconds intervals from 20 KHz to 5 Hz alternating. On Fedora 6 with 1.0.14.RC1 it works as expected. When above my hearing range I hear silence. When it gets to frequencies I can hear the sound is pure. On Fedora 7, this same app produces noise at frequencies I can't hear. This behavior is the same as the behavior I noticed with my emu10k1, ca0106 and CK8S sound cards on 1.0.14.RC1 as well as 1.0.14.RC3. I previously had ascribed this to bad/low quality sound chips; now I'm not so sure. In terms of sound quality the Rev 5.1 ranks well. See the link
http://compreviews.about.com/od/multimedia/tp/SoundCards.htm
Exact same hardware produces different sound. Can't explain it. Can you? Can you fix it?
Might be alsa-lib dmix issue now used as default PCM? Which PCM configuration are you using? Does the problem exist even if you use "hw" (or "plughw") PCM explicitly?
I am using default, if I understand what you are asking. I will set it to use plughw:0,0 and try.
While looking at the ice1724.c code I noticed that the maximum buffer size is 2**18. This seems small for an application today. I'm producing sound at 192000 frames per second (admittedly overkill though I like very smooth sound) using stereo doubles (16 bytes per frame). The maximum buffer size is only a fraction of my per second byte rate.
Could you increase this?
Ditto.
That seems to have done the trick for both issues. You did answer it off the top of your head. :-)
Minimum channels (1) Maximum channels (10000) Minimum rate (4000) Direction = 0 Maximum rate (4294967295) Direction = -1 Rate (48000) Direction = -1 Result = 0 Rate (96000) Direction = -1 Result = 0 Rate (192000) Direction = -1 Result = 0 Rate (384000) Direction = -1 Result = 0 Minimum period_time (10) Direction = 1 Maximum period_time (2048000) Direction = 0 Minimum period_size (0) Direction = 1 Maximum period_size (4294967295) Direction = -1 Minimum periods (0) Direction = 1 Maximum periods (4294967295) Direction = 0 Minimum buffer_time (1) Direction = 0 Maximum buffer_time (4294967295) Direction = 0 Minimum buffer_size (1) Maximum buffer_size (4294967294) Minimum tick_time (1000) Direction = 0 Maximum tick_time (1000) Direction = 0 Actual rate (192000) Direction = 0 Actual channels (2) Actual buffer_time (170666) Direction = 1 Actual buffer_size (32768) Actual buffer_size (32768) Actual period_time (85333) Direction = 1 Actual period_size (16384) Direction = 0 Actual periods (2) Direction = 0 Actual rate (192000) Direction = 0 Actual channels (2) Actual periods (2) Direction = 0 Actual period_size (16384) Direction = 0 Actual buffer_size (32768)
What would be the effect of using plughw:0,0 instead of default on an average system? Would a user have any control over which sound card plays the sound? Or, to rephrase, with default if a user changes the default then the sound card playing changes, with plughw:0,0 the user is locked into the first card, true?
Let me know if you still want me to test 14 final, though it seems redundant now.
Thanks for your help.
On Fri, 13 Jul 2007 08:53:47 -0700 tdavis@dsl-only.net wrote:
For RPM based systems, I have a build environment for the drivers, libs, and utils packages at http://members.dsl-only.net/~tdavis/my-build.tar.bz2. You need to be root to build them, but they won't interfere with your rpm distribution. THe driver rpm will also make a backup of your current drivers prior to installation.
Tobin
Wow! That is great. Already downloaded it, will install it in a bit. With such a tool, it would be a snap to run the latest HG image. If I were to do that, which link should I grab on the hg.alsa-project.org page?
And thank you for making this available.
On Fri, 13 Jul 2007 15:33:28 +0200 Takashi Iwai tiwai@suse.de wrote:
At Fri, 13 Jul 2007 06:23:26 -0700, stan wrote:
- Support for high sample rates 96000 and 192000 was lost.
- Sound distortion at high sound frequencies was introduced.
Could you check whether the same problem still exists on 1.0.14 final? There are tons of changes since rc3, so debugging rc3 is just a waste of time.
Finally, I can state that the issue is still there with default device on both 1.0.14 final and july 14, 2007 hg snapshot of alsa-lib. I think you've stated elsewhere that dmix is fixed at 48000 frames/sec and this is the behavior I am seeing and that was causing the problem. Both of the above libraries indicate that the rate is 48000. It has been awhile, but I seem to recall that the RC3 rate showed the requested rate even when dmix had changed it to 48000. Much better this way.
The fix is to use calls to determine the card and device for default, and then create a plughw plugin to open the device instead. Using the function suggested by Jaroslav to lock the rates and set_rate_near to set them ensures that only hardware supported rates are set. Works great.
For search users, here are some code samples. Somewhat redundant with the alsa sample programs.
char *default_device = "default" ; char *device_to_use = NULL; unsigned val; unsigned long lval; int dir = 0; int err ; snd_pcm_info_t *info_params ; snd_pcm_hw_params_t *hw_params ; snd_pcm_uframes_t buffer_size, xfer_align, start_threshold ; snd_pcm_uframes_t alsa_period_size, alsa_buffer_frames ; snd_pcm_sw_params_t *sw_params ;
if (opt_a) // audio device in options or configuration device_to_use = opt_a_plughw; else // use default device device_to_use = default_device;
err = snd_pcm_open (&alsa_dev, device_to_use, SND_PCM_STREAM_PLAYBACK, 0); if (err < 0) { fprintf (stderr, "cannot open audio device "%s" (%s)\n", device_to_use, snd_strerror (err)) ; goto catch_error ; } ;
if (!opt_a) // no option or configuration audio plughw, have to create it from default { err = snd_pcm_info_malloc (&info_params); if (err < 0) { fprintf (stderr, "cannot allocate information parameter structure (%s)\n", snd_strerror (err)) ; goto catch_error ; } ;
err = snd_pcm_info (alsa_dev, info_params); // get info on the default card if (err < 0) { fprintf (stderr, "cannot get information for the default card (%s)\n", snd_strerror (err)) ; goto catch_error ; } ; if (!opt_q) // not quiet { /* RO/WR (control): device number */ fprintf (stderr, "Default device number (%u)\n", snd_pcm_info_get_device (info_params)); /* RO/WR (control): subdevice number */ fprintf (stderr, "Default subdevice number (%u)\n", snd_pcm_info_get_subdevice (info_params)); /* RO/WR (control): stream number */ fprintf (stderr, "Default stream number (%d)\n", snd_pcm_info_get_stream (info_params)); /* R: card number */ fprintf (stderr, "Default card number (%d)\n", snd_pcm_info_get_card (info_params)); /* ID (user selectable) */ fprintf (stderr, "Default id (%s)\n", snd_pcm_info_get_id (info_params)); /* name of this device */ fprintf (stderr, "Default name (%s)\n", snd_pcm_info_get_name (info_params)); /* subdevice name */ fprintf (stderr, "Default subname (%s)\n", snd_pcm_info_get_subdevice_name (info_params)); /* SNDRV_PCM_CLASS_* */ fprintf (stderr, "Default dev_class (%d)\n", snd_pcm_info_get_class (info_params)); /* SNDRV_PCM_SUBCLASS_* */ fprintf (stderr, "Default dev_subclass (%d)\n", snd_pcm_info_get_subclass (info_params)); fprintf (stderr, "Default subdevices_count (%u)\n", snd_pcm_info_get_subdevices_count (info_params)); fprintf (stderr, "Default subdevices_avail (%u)\n", snd_pcm_info_get_subdevices_avail (info_params)); } err = snd_pcm_close (alsa_dev) ; // close the device so we can create new direct plughw plugin if (err < 0) { fprintf (stderr, "Could not close audio device "%s" (%s)\n", device_to_use, snd_strerror (err)) ; goto catch_error ; } ;
char hw_from_default [32]; int cardno = snd_pcm_info_get_card (info_params); if (cardno < 0) // If default is user defined, this is set to actual card. cardno = 0; // If not, dmix leaves as -1 and defaults to card 0 (look at id in info). int devno = snd_pcm_info_get_device (info_params); if (devno < 0) // This appears to always be set, just here as insurance. devno = 0; int numchars = snprintf (hw_from_default, sizeof (hw_from_default), "plughw:%d,%d", cardno, devno); if (!opt_q) // not quiet fprintf (stderr, "Plughw %s numchars %d\n", hw_from_default, numchars); /* Now reopen and get feasible hardware parameters with plughw instead of default. * This will allow bypassing dmix in order to set higher rates than 48000. */ err = snd_pcm_open (&alsa_dev, hw_from_default, SND_PCM_STREAM_PLAYBACK, 0); if (err < 0) { fprintf (stderr, "cannot open audio device "%s" (%s)\n", hw_from_default, snd_strerror (err)) ; goto catch_error ; } ; snd_pcm_info_free (info_params) ; // done with info } err = snd_pcm_hw_params_malloc (&hw_params); if (err < 0) { fprintf (stderr, "cannot allocate hardware parameter structure (%s)\n", snd_strerror (err)) ; goto catch_error ; } ;
err = snd_pcm_hw_params_any (alsa_dev, hw_params); if (err < 0) { fprintf (stderr, "cannot initialize hardware parameter structure (%s)\n", snd_strerror (err)) ; goto catch_error ; } ; ... ... /* lock the sample rate to use only hardware * supported rates, avoid resampling */ err = snd_pcm_hw_params_set_rate_resample (alsa_dev, hw_params, 0); if (err < 0) { fprintf (stderr, "cannot block resample of sample rates (%s)\n", snd_strerror (err)) ; goto catch_error ; } ;
err = snd_pcm_hw_params_set_rate_near (alsa_dev, hw_params, &samplerate, 0); if (err < 0) { fprintf (stderr, "cannot set sample rate (%s)\n", snd_strerror (err)) ; goto catch_error ; } ;
participants (3)
-
stan
-
Takashi Iwai
-
tdavis@dsl-only.net