aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/audio.c10
-rw-r--r--src/output_control.c10
-rw-r--r--src/output_control.h7
3 files changed, 19 insertions, 8 deletions
diff --git a/src/audio.c b/src/audio.c
index 5eebc02dd..3d4cf1a48 100644
--- a/src/audio.c
+++ b/src/audio.c
@@ -214,19 +214,13 @@ static void audio_output_wait_all(void)
static void syncAudioDeviceStates(void)
{
- struct audio_output *audioOutput;
unsigned int i;
if (!audio_format_defined(&input_audio_format))
return;
- for (i = 0; i < audioOutputArraySize; ++i) {
- audioOutput = &audioOutputArray[i];
- if (audioOutput->enabled)
- audio_output_open(audioOutput, &input_audio_format);
- else if (audio_output_is_open(audioOutput))
- audio_output_close(audioOutput);
- }
+ for (i = 0; i < audioOutputArraySize; ++i)
+ audio_output_update(&audioOutputArray[i], &input_audio_format);
}
bool playAudio(const char *buffer, size_t length)
diff --git a/src/output_control.c b/src/output_control.c
index 9193e92eb..142ac765e 100644
--- a/src/output_control.c
+++ b/src/output_control.c
@@ -90,6 +90,16 @@ audio_output_open(struct audio_output *audioOutput,
}
void
+audio_output_update(struct audio_output *ao,
+ const struct audio_format *audio_format)
+{
+ if (ao->enabled)
+ audio_output_open(ao, audio_format);
+ else if (audio_output_is_open(ao))
+ audio_output_close(ao);
+}
+
+void
audio_output_signal(struct audio_output *ao)
{
notify_signal(&ao->notify);
diff --git a/src/output_control.h b/src/output_control.h
index b2b9a6c64..62e88eb0f 100644
--- a/src/output_control.h
+++ b/src/output_control.h
@@ -36,6 +36,13 @@ audio_output_open(struct audio_output *audioOutput,
const struct audio_format *audioFormat);
/**
+ * Opens or closes the device, depending on the "enabled" flag.
+ */
+void
+audio_output_update(struct audio_output *ao,
+ const struct audio_format *audio_format);
+
+/**
* Wakes up the audio output thread. This is part of a workaround for
* a deadlock bug, and should be removed as soon as the real cause is
* fixed. XXX