summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPalo Kisa <palo.kisa@gmail.com>2018-11-29 15:36:17 +0100
committerPalo Kisa <palo.kisa@gmail.com>2018-11-29 15:36:17 +0100
commite370021c685a2676786d2e742f05a81a8b708f1e (patch)
treee0d947126ade55383f3078ea5a25692df35d963c
parentd76e5081aabf58d6fa66a78c0e3b6c81a6fe42dd (diff)
downloadtwinkle-e370021c685a2676786d2e742f05a81a8b708f1e.tar
twinkle-e370021c685a2676786d2e742f05a81a8b708f1e.tar.gz
twinkle-e370021c685a2676786d2e742f05a81a8b708f1e.tar.lz
twinkle-e370021c685a2676786d2e742f05a81a8b708f1e.tar.xz
twinkle-e370021c685a2676786d2e742f05a81a8b708f1e.zip
audio: Fix parameter setting failure with alsa v1.1.7
-rw-r--r--src/audio/audio_device.cpp8
1 files changed, 3 insertions, 5 deletions
diff --git a/src/audio/audio_device.cpp b/src/audio/audio_device.cpp
index 593c0d8..dd61e8d 100644
--- a/src/audio/audio_device.cpp
+++ b/src/audio/audio_device.cpp
@@ -540,7 +540,6 @@ bool t_alsa_io::open(const string& device, bool playback, bool capture, bool blo
// Note: The buffersize is in FRAMES, not BYTES (one frame = sizeof(sample) * channels)
snd_pcm_uframes_t buffersize;
unsigned int periods = 8; // Double buffering
- int dir = 1;
// Set the size of one period in samples
if (short_latency) {
@@ -553,7 +552,7 @@ bool t_alsa_io::open(const string& device, bool playback, bool capture, bool blo
buffersize = 1024;
}
if ((err = snd_pcm_hw_params_set_period_size_near (pcm_ptr, hw_params,
- &buffersize, &dir)) < 0)
+ &buffersize, nullptr)) < 0)
{
HANDLE_ALSA_ERROR("snd_pcm_hw_params_set_period_size_near");
}
@@ -569,10 +568,9 @@ bool t_alsa_io::open(const string& device, bool playback, bool capture, bool blo
periods *= 4;
}
- dir = 1;
- if ((err = snd_pcm_hw_params_set_periods(pcm_ptr, hw_params, periods, dir)) < 0) {
+ if ((err = snd_pcm_hw_params_set_periods(pcm_ptr, hw_params, periods, 1)) < 0) {
if ((err = snd_pcm_hw_params_set_periods_near(pcm_ptr, hw_params,
- &periods, &dir)) < 0)
+ &periods, nullptr)) < 0)
{
HANDLE_ALSA_ERROR("snd_pcm_hw_params_set_periods");
}