output: moved code to audio_output_update()
Moved code from syncAudioDeviceStates() to audio_output_update().
This commit is contained in:
10
src/audio.c
10
src/audio.c
@@ -214,19 +214,13 @@ static void audio_output_wait_all(void)
|
|||||||
|
|
||||||
static void syncAudioDeviceStates(void)
|
static void syncAudioDeviceStates(void)
|
||||||
{
|
{
|
||||||
struct audio_output *audioOutput;
|
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
|
|
||||||
if (!audio_format_defined(&input_audio_format))
|
if (!audio_format_defined(&input_audio_format))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
for (i = 0; i < audioOutputArraySize; ++i) {
|
for (i = 0; i < audioOutputArraySize; ++i)
|
||||||
audioOutput = &audioOutputArray[i];
|
audio_output_update(&audioOutputArray[i], &input_audio_format);
|
||||||
if (audioOutput->enabled)
|
|
||||||
audio_output_open(audioOutput, &input_audio_format);
|
|
||||||
else if (audio_output_is_open(audioOutput))
|
|
||||||
audio_output_close(audioOutput);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool playAudio(const char *buffer, size_t length)
|
bool playAudio(const char *buffer, size_t length)
|
||||||
|
@@ -89,6 +89,16 @@ audio_output_open(struct audio_output *audioOutput,
|
|||||||
return ret;
|
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
|
void
|
||||||
audio_output_signal(struct audio_output *ao)
|
audio_output_signal(struct audio_output *ao)
|
||||||
{
|
{
|
||||||
|
@@ -35,6 +35,13 @@ bool
|
|||||||
audio_output_open(struct audio_output *audioOutput,
|
audio_output_open(struct audio_output *audioOutput,
|
||||||
const struct audio_format *audioFormat);
|
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
|
* 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
|
* a deadlock bug, and should be removed as soon as the real cause is
|
||||||
|
Reference in New Issue
Block a user