output/Internal: convert audio_output_command to strictly-typed enum
This commit is contained in:
@@ -46,7 +46,7 @@ AudioOutput::WaitForCommand()
|
||||
}
|
||||
|
||||
void
|
||||
AudioOutput::CommandAsync(audio_output_command cmd)
|
||||
AudioOutput::CommandAsync(AudioOutputCommand cmd)
|
||||
{
|
||||
assert(IsCommandFinished());
|
||||
|
||||
@@ -55,14 +55,14 @@ AudioOutput::CommandAsync(audio_output_command cmd)
|
||||
}
|
||||
|
||||
void
|
||||
AudioOutput::CommandWait(audio_output_command cmd)
|
||||
AudioOutput::CommandWait(AudioOutputCommand cmd)
|
||||
{
|
||||
CommandAsync(cmd);
|
||||
WaitForCommand();
|
||||
}
|
||||
|
||||
void
|
||||
AudioOutput::LockCommandWait(audio_output_command cmd)
|
||||
AudioOutput::LockCommandWait(AudioOutputCommand cmd)
|
||||
{
|
||||
const ScopeLock protect(mutex);
|
||||
CommandWait(cmd);
|
||||
@@ -92,7 +92,7 @@ AudioOutput::LockEnableWait()
|
||||
StartThread();
|
||||
}
|
||||
|
||||
LockCommandWait(AO_COMMAND_ENABLE);
|
||||
LockCommandWait(AudioOutputCommand::ENABLE);
|
||||
}
|
||||
|
||||
void
|
||||
@@ -109,7 +109,7 @@ AudioOutput::LockDisableWait()
|
||||
return;
|
||||
}
|
||||
|
||||
LockCommandWait(AO_COMMAND_DISABLE);
|
||||
LockCommandWait(AudioOutputCommand::DISABLE);
|
||||
}
|
||||
|
||||
inline bool
|
||||
@@ -134,7 +134,7 @@ AudioOutput::Open(const AudioFormat audio_format, const MusicPipe &mp)
|
||||
|
||||
/* we're not using audio_output_cancel() here,
|
||||
because that function is asynchronous */
|
||||
CommandWait(AO_COMMAND_CANCEL);
|
||||
CommandWait(AudioOutputCommand::CANCEL);
|
||||
}
|
||||
|
||||
return true;
|
||||
@@ -148,7 +148,9 @@ AudioOutput::Open(const AudioFormat audio_format, const MusicPipe &mp)
|
||||
if (!thread.IsDefined())
|
||||
StartThread();
|
||||
|
||||
CommandWait(open ? AO_COMMAND_REOPEN : AO_COMMAND_OPEN);
|
||||
CommandWait(open
|
||||
? AudioOutputCommand::REOPEN
|
||||
: AudioOutputCommand::OPEN);
|
||||
const bool open2 = open;
|
||||
|
||||
if (open2 && mixer != nullptr) {
|
||||
@@ -172,7 +174,7 @@ AudioOutput::CloseWait()
|
||||
assert(!open || !fail_timer.IsDefined());
|
||||
|
||||
if (open)
|
||||
CommandWait(AO_COMMAND_CLOSE);
|
||||
CommandWait(AudioOutputCommand::CLOSE);
|
||||
else
|
||||
fail_timer.Reset();
|
||||
}
|
||||
@@ -219,7 +221,7 @@ AudioOutput::LockPauseAsync()
|
||||
|
||||
assert(allow_play);
|
||||
if (IsOpen())
|
||||
CommandAsync(AO_COMMAND_PAUSE);
|
||||
CommandAsync(AudioOutputCommand::PAUSE);
|
||||
}
|
||||
|
||||
void
|
||||
@@ -229,7 +231,7 @@ AudioOutput::LockDrainAsync()
|
||||
|
||||
assert(allow_play);
|
||||
if (IsOpen())
|
||||
CommandAsync(AO_COMMAND_DRAIN);
|
||||
CommandAsync(AudioOutputCommand::DRAIN);
|
||||
}
|
||||
|
||||
void
|
||||
@@ -239,7 +241,7 @@ AudioOutput::LockCancelAsync()
|
||||
|
||||
if (IsOpen()) {
|
||||
allow_play = false;
|
||||
CommandAsync(AO_COMMAND_CANCEL);
|
||||
CommandAsync(AudioOutputCommand::CANCEL);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -277,7 +279,7 @@ AudioOutput::StopThread()
|
||||
assert(thread.IsDefined());
|
||||
assert(allow_play);
|
||||
|
||||
LockCommandWait(AO_COMMAND_KILL);
|
||||
LockCommandWait(AudioOutputCommand::KILL);
|
||||
thread.Join();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user