summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLuboš Doležel <lubos@dolezel.info>2018-11-29 16:09:37 +0100
committerGitHub <noreply@github.com>2018-11-29 16:09:37 +0100
commit089eb13bc642ea534601d0ac3709479ef3286e35 (patch)
treee0d947126ade55383f3078ea5a25692df35d963c
parentd76e5081aabf58d6fa66a78c0e3b6c81a6fe42dd (diff)
parente370021c685a2676786d2e742f05a81a8b708f1e (diff)
downloadtwinkle-089eb13bc642ea534601d0ac3709479ef3286e35.tar
twinkle-089eb13bc642ea534601d0ac3709479ef3286e35.tar.gz
twinkle-089eb13bc642ea534601d0ac3709479ef3286e35.tar.lz
twinkle-089eb13bc642ea534601d0ac3709479ef3286e35.tar.xz
twinkle-089eb13bc642ea534601d0ac3709479ef3286e35.zip
Merge pull request #136 from palinek/new_alsa_fix
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");
}