* period_size and .asoundrc
@ 2009-05-25 13:12 Canella Matteo
2009-05-26 8:15 ` Takashi Iwai
0 siblings, 1 reply; 2+ messages in thread
From: Canella Matteo @ 2009-05-25 13:12 UTC (permalink / raw
To: alsa-devel@alsa-project.org
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.
Thanks
Matteo Canella
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: period_size and .asoundrc
2009-05-25 13:12 period_size and .asoundrc Canella Matteo
@ 2009-05-26 8:15 ` Takashi Iwai
0 siblings, 0 replies; 2+ messages in thread
From: Takashi Iwai @ 2009-05-26 8:15 UTC (permalink / raw
To: Canella Matteo; +Cc: alsa-devel@alsa-project.org
At Mon, 25 May 2009 15:12:17 +0200,
Canella Matteo wrote:
>
> 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.
You can call snd_config_search() with snd_config as root config.
For example,
snd_config_t *n;
long val;
if (snd_config_search(snd_config, "YOUR.CONFIG", &n) < 0)
error();
if (snd_config_get_integer(n, &val) < 0)
error();
Takashi
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2009-05-26 8:15 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-05-25 13:12 period_size and .asoundrc Canella Matteo
2009-05-26 8:15 ` Takashi Iwai
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.