[alsa-devel] period_size and .asoundrc

Canella Matteo Matteo.Canella at mta.it
Mon May 25 15:12:17 CEST 2009

Hi everybody,
I'm writing a little software that play a tone on a pcm device.
In the hw param initialization I'm hardcoding the "periods" and "period_size" values:

                unsigned int periods = 4;
                if (snd_pcm_hw_params_set_periods_near(buzzer_device.pcm_handle, buzzer_device.hwparams, &periods, 0) < 0) {
                               fprintf(stderr, "Error setting periods.\n");
                               return 1;
                ///* set the period time */
                period_size = 8192;
                err = snd_pcm_hw_params_set_period_size_near(buzzer_device.pcm_handle, buzzer_device.hwparams, &period_size, 0);
                if (err < 0) {
                               printf("Unable to get period size for playback: %s\n", snd_strerror(err));
                               return err;

I'd like to read this parameter form the .asoundrc file, so I'm wondering if there were API that does this task.


Matteo Canella

More information about the Alsa-devel mailing list