output: moved code to audio_output_update()
Moved code from syncAudioDeviceStates() to audio_output_update().
This commit is contained in:
parent
678314534a
commit
0eae1c55ad
10
src/audio.c
10
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)
|
||||
|
|
|
@ -89,6 +89,16 @@ audio_output_open(struct audio_output *audioOutput,
|
|||
return ret;
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
|
|
|
@ -35,6 +35,13 @@ bool
|
|||
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
|
||||
|
|
Loading…
Reference in New Issue