summaryrefslogtreecommitdiff
path: root/src/audio.c
diff options
context:
space:
mode:
authorWarren Dukes <warren.dukes@gmail.com>2004-03-20 19:47:05 +0000
committerWarren Dukes <warren.dukes@gmail.com>2004-03-20 19:47:05 +0000
commit6436b0ac8a59914b9edf8987274ef66f69637f36 (patch)
tree1e10694ebb9933db385f0e93a4a98080028b7d76 /src/audio.c
parent115b0d06cda83dc6b34cc590ab61501120489a6b (diff)
close audio device on pause
git-svn-id: https://svn.musicpd.org/mpd/trunk@329 09075e82-0dd4-0310-85a5-a0d7c8717e4f
Diffstat (limited to 'src/audio.c')
-rw-r--r--src/audio.c17
1 files changed, 10 insertions, 7 deletions
diff --git a/src/audio.c b/src/audio.c
index d8abc5648..713519f5c 100644
--- a/src/audio.c
+++ b/src/audio.c
@@ -131,18 +131,21 @@ int isCurrentAudioFormat(AudioFormat * audioFormat) {
int initAudio(AudioFormat * audioFormat) {
ao_sample_format format;
- if(audio_device && !isCurrentAudioFormat(audioFormat)) {
+ if(audioFormat && audio_device && !isCurrentAudioFormat(audioFormat)) {
finishAudio();
}
if(!audio_device) {
- format.bits = audioFormat->bits;
- format.rate = audioFormat->sampleRate;
+ if(audioFormat) {
+ audio_format.bits = audioFormat->bits;
+ audio_format.sampleRate = audioFormat->sampleRate;
+ audio_format.channels = audioFormat->channels;
+ }
+
+ format.bits = audio_format.bits;
+ format.rate = audio_format.sampleRate;
format.byte_format = AO_FMT_NATIVE;
- format.channels = audioFormat->channels;
- audio_format.bits = format.bits;
- audio_format.sampleRate = format.rate;
- audio_format.channels = format.channels;
+ format.channels = audio_format.channels;
blockSignals();
audio_device = ao_open_live(audio_ao_driver_id, &format,