X-Git-Url: http://git.tuebingen.mpg.de/?p=paraslash.git;a=blobdiff_plain;f=alsa_write.c;h=e75fa23067380244cd451eedc1c523fae3fb004f;hp=53854e08c012dd7952df4d94ce50dae987dc004a;hb=393c52c9e726570a2ee287e9f7e103b619a28f73;hpb=dc26e5bc49d839fd966b7ad6f596e444ac8908d3 diff --git a/alsa_write.c b/alsa_write.c index 53854e08..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) @@ -171,15 +179,16 @@ static int alsa_init(struct private_alsa_write_data *pad, if (ret == 0) { char *buf, *p; size_t sz; - PARA_INFO_LOG("dumping alsa configuration\n"); + PARA_DEBUG_LOG("dumping alsa configuration\n"); snd_pcm_dump(pad->handle, output_log); + snd_pcm_hw_params_dump(hwparams, output_log); sz = snd_output_buffer_string(output_log, &buf); for (p = buf; p < buf + sz;) { char *q = memchr(p, '\n', buf + sz - p); if (!q) break; *q = '\0'; - PARA_INFO_LOG("%s\n", p); + PARA_DEBUG_LOG("%s\n", p); p = q + 1; } snd_output_close(output_log);