]> git.tuebingen.mpg.de Git - paraslash.git/blobdiff - alsa_write.c
alsa: Set period time.
[paraslash.git] / alsa_write.c
index 11e4504d79e78c8e613fc33baec80ef168e72f20..e75fa23067380244cd451eedc1c523fae3fb004f 100644 (file)
@@ -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)