From: Andre Noll Date: Tue, 7 May 2013 09:15:07 +0000 (+0200) Subject: alsa: Set period time. X-Git-Tag: v0.5.3~22^2~4 X-Git-Url: http://git.tuebingen.mpg.de/?p=paraslash.git;a=commitdiff_plain;h=393c52c9e726570a2ee287e9f7e103b619a28f73;ds=sidebyside alsa: Set period time. This is probably not necessary, but since aplay from the alsa-utils package sets it in the same way, it can't hurt to do this. --- diff --git a/alsa_write.c b/alsa_write.c index 11e4504d..e75fa230 100644 --- a/alsa_write.c +++ b/alsa_write.c @@ -80,6 +80,7 @@ static int alsa_init(struct private_alsa_write_data *pad, unsigned buffer_time; int ret; const char *msg; + unsigned period_time; PARA_INFO_LOG("opening %s\n", conf->device_arg); msg = "unable to open pcm"; @@ -124,6 +125,13 @@ static int alsa_init(struct private_alsa_write_data *pad, &buffer_time, NULL); if (ret < 0) goto fail; + period_time = buffer_time / 4; + msg = "could not set period time"; + ret = snd_pcm_hw_params_set_period_time_near(pad->handle, hwparams, + &period_time, 0); + if (ret < 0) + goto fail; + msg = "unable to install hw params"; ret = snd_pcm_hw_params(pad->handle, hwparams); if (ret < 0)