output/Internal: move the "pause" flag to struct AudioOutputControl
This commit is contained in:
@@ -181,9 +181,9 @@ AudioOutputControl::Open(const AudioFormat audio_format,
|
|||||||
fail_timer.Reset();
|
fail_timer.Reset();
|
||||||
|
|
||||||
if (output->open && audio_format == request.audio_format) {
|
if (output->open && audio_format == request.audio_format) {
|
||||||
assert(request.pipe == &mp || (always_on && output->pause));
|
assert(request.pipe == &mp || (always_on && pause));
|
||||||
|
|
||||||
if (!output->pause)
|
if (!pause)
|
||||||
/* already open, already the right parameters
|
/* already open, already the right parameters
|
||||||
- nothing needs to be done */
|
- nothing needs to be done */
|
||||||
return true;
|
return true;
|
||||||
|
@@ -143,6 +143,12 @@ class AudioOutputControl {
|
|||||||
*/
|
*/
|
||||||
bool enabled = true;
|
bool enabled = true;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Is the device paused? i.e. the output thread is in the
|
||||||
|
* ao_pause() loop.
|
||||||
|
*/
|
||||||
|
bool pause = false;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* When this flag is set, the output thread will not do any
|
* When this flag is set, the output thread will not do any
|
||||||
* playback. It will wait until the flag is cleared.
|
* playback. It will wait until the flag is cleared.
|
||||||
|
@@ -69,12 +69,6 @@ struct AudioOutput {
|
|||||||
*/
|
*/
|
||||||
bool open = false;
|
bool open = false;
|
||||||
|
|
||||||
/**
|
|
||||||
* Is the device paused? i.e. the output thread is in the
|
|
||||||
* ao_pause() loop.
|
|
||||||
*/
|
|
||||||
bool pause = false;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The configured audio format.
|
* The configured audio format.
|
||||||
*/
|
*/
|
||||||
@@ -234,7 +228,6 @@ public:
|
|||||||
bool IteratePause() noexcept;
|
bool IteratePause() noexcept;
|
||||||
|
|
||||||
void EndPause() noexcept{
|
void EndPause() noexcept{
|
||||||
pause = false;
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@@ -385,12 +385,8 @@ AudioOutputControl::InternalPlay() noexcept
|
|||||||
inline void
|
inline void
|
||||||
AudioOutput::BeginPause() noexcept
|
AudioOutput::BeginPause() noexcept
|
||||||
{
|
{
|
||||||
{
|
const ScopeUnlock unlock(mutex);
|
||||||
const ScopeUnlock unlock(mutex);
|
ao_plugin_cancel(*this);
|
||||||
ao_plugin_cancel(*this);
|
|
||||||
}
|
|
||||||
|
|
||||||
pause = true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
inline bool
|
inline bool
|
||||||
@@ -417,6 +413,8 @@ inline void
|
|||||||
AudioOutputControl::InternalPause() noexcept
|
AudioOutputControl::InternalPause() noexcept
|
||||||
{
|
{
|
||||||
output->BeginPause();
|
output->BeginPause();
|
||||||
|
pause = true;
|
||||||
|
|
||||||
CommandFinished();
|
CommandFinished();
|
||||||
|
|
||||||
do {
|
do {
|
||||||
@@ -427,6 +425,7 @@ AudioOutputControl::InternalPause() noexcept
|
|||||||
break;
|
break;
|
||||||
} while (command == Command::NONE);
|
} while (command == Command::NONE);
|
||||||
|
|
||||||
|
pause = false;
|
||||||
output->EndPause();
|
output->EndPause();
|
||||||
|
|
||||||
skip_delay = true;
|
skip_delay = true;
|
||||||
|
Reference in New Issue
Block a user