summaryrefslogtreecommitdiff
path: root/Source/Core/AudioCommon/Src/AlsaSoundStream.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'Source/Core/AudioCommon/Src/AlsaSoundStream.cpp')
-rw-r--r--Source/Core/AudioCommon/Src/AlsaSoundStream.cpp32
1 files changed, 16 insertions, 16 deletions
diff --git a/Source/Core/AudioCommon/Src/AlsaSoundStream.cpp b/Source/Core/AudioCommon/Src/AlsaSoundStream.cpp
index 710275d55a..d9b9016114 100644
--- a/Source/Core/AudioCommon/Src/AlsaSoundStream.cpp
+++ b/Source/Core/AudioCommon/Src/AlsaSoundStream.cpp
@@ -88,7 +88,7 @@ bool AlsaSound::AlsaInit()
snd_pcm_hw_params_t *hwparams;
snd_pcm_uframes_t buffer_size,buffer_size_max;
unsigned int periods;
-
+
err = snd_pcm_open(&handle, "default", SND_PCM_STREAM_PLAYBACK, 0);
if (err < 0)
{
@@ -97,7 +97,7 @@ bool AlsaSound::AlsaInit()
}
snd_pcm_hw_params_alloca(&hwparams);
-
+
err = snd_pcm_hw_params_any(handle, hwparams);
if (err < 0)
{
@@ -111,8 +111,8 @@ bool AlsaSound::AlsaInit()
ERROR_LOG(AUDIO, "Access type not available: %s\n", snd_strerror(err));
return false;
}
-
- err = snd_pcm_hw_params_set_format(handle, hwparams, SND_PCM_FORMAT_S16_LE);
+
+ err = snd_pcm_hw_params_set_format(handle, hwparams, SND_PCM_FORMAT_S16_LE);
if (err < 0)
{
ERROR_LOG(AUDIO, "Sample format not available: %s\n", snd_strerror(err));
@@ -126,14 +126,14 @@ bool AlsaSound::AlsaInit()
ERROR_LOG(AUDIO, "Rate not available: %s\n", snd_strerror(err));
return false;
}
-
- err = snd_pcm_hw_params_set_channels(handle, hwparams, 2);
+
+ err = snd_pcm_hw_params_set_channels(handle, hwparams, 2);
if (err < 0)
{
ERROR_LOG(AUDIO, "Channels count not available: %s\n", snd_strerror(err));
return false;
}
-
+
periods = BUFFER_SIZE_MAX / FRAME_COUNT_MIN;
err = snd_pcm_hw_params_set_periods_max(handle, hwparams, &periods, &dir);
if (err < 0)
@@ -153,10 +153,10 @@ bool AlsaSound::AlsaInit()
err = snd_pcm_hw_params(handle, hwparams);
if (err < 0)
{
- ERROR_LOG(AUDIO, "Unable to install hw params: %s\n", snd_strerror(err));
+ ERROR_LOG(AUDIO, "Unable to install hw params: %s\n", snd_strerror(err));
return false;
}
-
+
err = snd_pcm_hw_params_get_buffer_size(hwparams, &buffer_size);
if (err < 0)
{
@@ -176,10 +176,10 @@ bool AlsaSound::AlsaInit()
frames_to_deliver = buffer_size / periods;
//limit the minimum size. pulseaudio advertises a minimum of 32 samples.
if (frames_to_deliver < FRAME_COUNT_MIN)
- frames_to_deliver = FRAME_COUNT_MIN;
+ frames_to_deliver = FRAME_COUNT_MIN;
//it is probably a bad idea to try to send more than one buffer of data
if ((unsigned int)frames_to_deliver > buffer_size)
- frames_to_deliver = buffer_size;
+ frames_to_deliver = buffer_size;
NOTICE_LOG(AUDIO, "ALSA gave us a %ld sample \"hardware\" buffer with %d periods. Will send %d samples per fragments.\n", buffer_size, periods, frames_to_deliver);
snd_pcm_sw_params_alloca(&swparams);
@@ -187,21 +187,21 @@ bool AlsaSound::AlsaInit()
err = snd_pcm_sw_params_current(handle, swparams);
if (err < 0)
{
- ERROR_LOG(AUDIO, "cannot init sw params: %s\n", snd_strerror(err));
+ ERROR_LOG(AUDIO, "cannot init sw params: %s\n", snd_strerror(err));
return false;
}
-
+
err = snd_pcm_sw_params_set_start_threshold(handle, swparams, 0U);
if (err < 0)
{
- ERROR_LOG(AUDIO, "cannot set start thresh: %s\n", snd_strerror(err));
+ ERROR_LOG(AUDIO, "cannot set start thresh: %s\n", snd_strerror(err));
return false;
}
-
+
err = snd_pcm_sw_params(handle, swparams);
if (err < 0)
{
- ERROR_LOG(AUDIO, "cannot set sw params: %s\n", snd_strerror(err));
+ ERROR_LOG(AUDIO, "cannot set sw params: %s\n", snd_strerror(err));
return false;
}