aboutsummaryrefslogtreecommitdiffstats
path: root/src/audio.c
diff options
context:
space:
mode:
authorEric Wong <normalperson@yhbt.net>2008-06-02 10:10:26 +0000
committerEric Wong <normalperson@yhbt.net>2008-06-02 10:10:26 +0000
commitf57be50d73a167500ee04135e15e0474a7532478 (patch)
treee7bc9082a93b57edba9d5ee8926b14a14bf66488 /src/audio.c
parent6ac1d797afac1f2ec6e89594516a1e7ffe8cfe8a (diff)
downloadmpd-f57be50d73a167500ee04135e15e0474a7532478.tar.gz
mpd-f57be50d73a167500ee04135e15e0474a7532478.tar.xz
mpd-f57be50d73a167500ee04135e15e0474a7532478.zip
remove audioDeviceStates from playerData and getPlayerData
git-svn-id: https://svn.musicpd.org/mpd/trunk@7372 09075e82-0dd4-0310-85a5-a0d7c8717e4f
Diffstat (limited to 'src/audio.c')
-rw-r--r--src/audio.c22
1 files changed, 13 insertions, 9 deletions
diff --git a/src/audio.c b/src/audio.c
index 3c5ef4478..50b54cb7d 100644
--- a/src/audio.c
+++ b/src/audio.c
@@ -37,14 +37,16 @@ static AudioFormat *audio_configFormat;
static AudioOutput *audioOutputArray;
static unsigned int audioOutputArraySize;
-#define DEVICE_OFF 0x00
-#define DEVICE_ENABLE 0x01 /* currently off, but to be turned on */
-#define DEVICE_ON 0x03
-#define DEVICE_DISABLE 0x04 /* currently on, but to be turned off */
+enum ad_state {
+ DEVICE_OFF = 0x00,
+ DEVICE_ENABLE = 0x01, /* currently off, but to be turned on */
+ DEVICE_ON = 0x03,
+ DEVICE_DISABLE = 0x04 /* currently on, but to be turned off */
+};
/* the audioEnabledArray should be stuck into shared memory, and then disable
and enable in playAudio() routine */
-static mpd_uint8 *audioDeviceStates;
+static enum ad_state *audioDeviceStates;
static mpd_uint8 audioOpened;
@@ -52,7 +54,7 @@ static size_t audioBufferSize;
static char *audioBuffer;
static size_t audioBufferPos;
-unsigned int audio_device_count(void)
+static unsigned int audio_output_count(void)
{
unsigned int nr = 0;
ConfigParam *param = NULL;
@@ -103,8 +105,9 @@ void initAudioDriver(void)
loadAudioDrivers();
- audioOutputArraySize = audio_device_count();
- audioDeviceStates = (getPlayerData())->audioDeviceStates;
+ audioOutputArraySize = audio_output_count();
+ audioDeviceStates = xmalloc(sizeof(enum ad_state) *
+ audioOutputArraySize);
audioOutputArray = xmalloc(sizeof(AudioOutput) * audioOutputArraySize);
for (i = 0; i < audioOutputArraySize; i++)
@@ -273,6 +276,8 @@ static void syncAudioDeviceStates(void)
for (i = 0; i < audioOutputArraySize; ++i) {
audioOutput = &audioOutputArray[i];
switch (audioDeviceStates[i]) {
+ case DEVICE_OFF:
+ break;
case DEVICE_ON:
/* This will reopen only if the audio format changed */
if (openAudioOutput(audioOutput, &audio_format) < 0)
@@ -286,7 +291,6 @@ static void syncAudioDeviceStates(void)
dropBufferedAudioOutput(audioOutput);
closeAudioOutput(audioOutput);
audioDeviceStates[i] = DEVICE_OFF;
- break;
}
}
}