output/Internal: move the "open" flag to struct AudioOutputControl
This commit is contained in:
+22
-2
@@ -155,6 +155,16 @@ class AudioOutputControl {
|
||||
*/
|
||||
bool really_enabled = false;
|
||||
|
||||
/**
|
||||
* Is the device (already) open and functional?
|
||||
*
|
||||
* This attribute may only be modified by the output thread.
|
||||
* It is protected with #mutex: write accesses inside the
|
||||
* output thread and read accesses outside of it may only be
|
||||
* performed while the lock is held.
|
||||
*/
|
||||
bool open = false;
|
||||
|
||||
/**
|
||||
* Is the device paused? i.e. the output thread is in the
|
||||
* ao_pause() loop.
|
||||
@@ -202,6 +212,7 @@ public:
|
||||
assert(!fail_timer.IsDefined());
|
||||
assert(!thread.IsDefined());
|
||||
assert(output == nullptr);
|
||||
assert(!open);
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -240,8 +251,12 @@ public:
|
||||
*/
|
||||
bool LockToggleEnabled() noexcept;
|
||||
|
||||
gcc_pure
|
||||
bool IsOpen() const noexcept;
|
||||
/**
|
||||
* Caller must lock the mutex.
|
||||
*/
|
||||
bool IsOpen() const noexcept {
|
||||
return open;
|
||||
}
|
||||
|
||||
/**
|
||||
* Caller must lock the mutex.
|
||||
@@ -337,6 +352,11 @@ public:
|
||||
source.SetReplayGainMode(_mode);
|
||||
}
|
||||
|
||||
/**
|
||||
* Throws #std::runtime_error on error.
|
||||
*/
|
||||
void InternalOpen2(AudioFormat in_audio_format);
|
||||
|
||||
/**
|
||||
* Caller must lock the mutex.
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user