]> git.tuebingen.mpg.de Git - paraslash.git/commitdiff
alsa: Set period time.
authorAndre Noll <maan@systemlinux.org>
Tue, 7 May 2013 09:15:07 +0000 (11:15 +0200)
committerAndre Noll <maan@systemlinux.org>
Sat, 8 Mar 2014 13:45:09 +0000 (14:45 +0100)
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.

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)