From b29be3b39ea2d128f9b380fb8d079815ed707c7c Mon Sep 17 00:00:00 2001 From: Chris Robinson Date: Fri, 26 Apr 2019 16:20:27 -0700 Subject: Set the ALSA period size first --- Alc/backends/alsa.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'Alc/backends/alsa.cpp') diff --git a/Alc/backends/alsa.cpp b/Alc/backends/alsa.cpp index 969708ab..a2937658 100644 --- a/Alc/backends/alsa.cpp +++ b/Alc/backends/alsa.cpp @@ -734,12 +734,12 @@ ALCboolean AlsaPlayback::reset() else if(snd_pcm_hw_params_set_rate_resample(mPcmHandle, hp, 1) < 0) ERR("Failed to enable ALSA resampler\n"); CHECK(snd_pcm_hw_params_set_rate_near(mPcmHandle, hp, &rate, nullptr)); - /* set buffer time (implicitly constrains period/buffer parameters) */ - if((err=snd_pcm_hw_params_set_buffer_time_near(mPcmHandle, hp, &bufferLen, nullptr)) < 0) - ERR("snd_pcm_hw_params_set_buffer_time_near failed: %s\n", snd_strerror(err)); - /* set period time (implicitly sets buffer size/bytes/time and period size/bytes) */ + /* set period time (implicitly constrains period/buffer parameters) */ if((err=snd_pcm_hw_params_set_period_time_near(mPcmHandle, hp, &periodLen, nullptr)) < 0) ERR("snd_pcm_hw_params_set_period_time_near failed: %s\n", snd_strerror(err)); + /* set buffer time (implicitly sets buffer size/bytes/time and period size/bytes) */ + if((err=snd_pcm_hw_params_set_buffer_time_near(mPcmHandle, hp, &bufferLen, nullptr)) < 0) + ERR("snd_pcm_hw_params_set_buffer_time_near failed: %s\n", snd_strerror(err)); /* install and prepare hardware configuration */ CHECK(snd_pcm_hw_params(mPcmHandle, hp)); -- cgit v1.2.3