aboutsummaryrefslogtreecommitdiffstats
path: root/src/audioOutputs
diff options
context:
space:
mode:
authorEric Wong <normalperson@yhbt.net>2008-09-08 02:54:46 -0700
committerEric Wong <normalperson@yhbt.net>2008-09-08 02:54:46 -0700
commita50361f768f82480e608c3e56e2c47a7030bb705 (patch)
tree29a70dff07d0857e6001ce3e70b92ff4bc5b72d8 /src/audioOutputs
parent19b92086e66fffe5323c198e320602d38787a4b7 (diff)
downloadmpd-a50361f768f82480e608c3e56e2c47a7030bb705.tar.gz
mpd-a50361f768f82480e608c3e56e2c47a7030bb705.tar.xz
mpd-a50361f768f82480e608c3e56e2c47a7030bb705.zip
alsa: cleanup the mmap logic a bit
Diffstat (limited to 'src/audioOutputs')
-rw-r--r--src/audioOutputs/audioOutput_alsa.c14
1 files changed, 6 insertions, 8 deletions
diff --git a/src/audioOutputs/audioOutput_alsa.c b/src/audioOutputs/audioOutput_alsa.c
index 9bbe2ea77..831721080 100644
--- a/src/audioOutputs/audioOutput_alsa.c
+++ b/src/audioOutputs/audioOutput_alsa.c
@@ -189,19 +189,17 @@ configure_hw:
goto error;
if (ad->useMmap) {
- err = snd_pcm_hw_params_set_access(ad->pcmHandle, hwparams,
- SND_PCM_ACCESS_MMAP_INTERLEAVED);
- if (err < 0) {
+ if (!(err = snd_pcm_hw_params_set_access(ad->pcmHandle,
+ hwparams, SND_PCM_ACCESS_MMAP_INTERLEAVED))) {
+ ad->writei = snd_pcm_mmap_writei;
+ } else {
ERROR("ALSA cannot enable mmap on device \"%s\": %s. "
"Falling back to direct write mode\n",
ad->device, snd_strerror(-err));
ad->useMmap = 0;
}
- }
- if (ad->useMmap)
- ad->writei = snd_pcm_mmap_writei;
- else if ((err = E(snd_pcm_hw_params_set_access, ad->pcmHandle,
- hwparams, SND_PCM_ACCESS_RW_INTERLEAVED)) < 0)
+ } else if ((err = E(snd_pcm_hw_params_set_access, ad->pcmHandle,
+ hwparams, SND_PCM_ACCESS_RW_INTERLEAVED)) < 0)
goto error;
err = snd_pcm_hw_params_set_format(ad->pcmHandle, hwparams, bitformat);