diff options
Diffstat (limited to 'src/output/MultipleOutputs.cxx')
-rw-r--r-- | src/output/MultipleOutputs.cxx | 44 |
1 files changed, 16 insertions, 28 deletions
diff --git a/src/output/MultipleOutputs.cxx b/src/output/MultipleOutputs.cxx index 4251d8237..0d4e7c61e 100644 --- a/src/output/MultipleOutputs.cxx +++ b/src/output/MultipleOutputs.cxx @@ -58,14 +58,8 @@ try { AudioOutput *output = audio_output_new(event_loop, block, mixer_listener, pc, error); - if (output == nullptr) { - if (block.line > 0) - FormatFatalError("line %i: %s", - block.line, - error.GetMessage()); - else - FatalError(error); - } + if (output == nullptr) + throw std::runtime_error(error.GetMessage()); return output; } catch (const std::runtime_error &e) { @@ -192,32 +186,27 @@ MultipleOutputs::SetReplayGainMode(ReplayGainMode mode) ao->SetReplayGainMode(mode); } -bool -MultipleOutputs::Play(MusicChunk *chunk, Error &error) +void +MultipleOutputs::Play(MusicChunk *chunk) { assert(buffer != nullptr); assert(pipe != nullptr); assert(chunk != nullptr); assert(chunk->CheckFormat(input_audio_format)); - if (!Update()) { + if (!Update()) /* TODO: obtain real error */ - error.Set(output_domain, "Failed to open audio output"); - return false; - } + throw std::runtime_error("Failed to open audio output"); pipe->Push(chunk); for (auto ao : outputs) ao->LockPlay(); - - return true; } -bool +void MultipleOutputs::Open(const AudioFormat audio_format, - MusicBuffer &_buffer, - Error &error) + MusicBuffer &_buffer) { bool ret = false, enabled = false; @@ -251,17 +240,16 @@ MultipleOutputs::Open(const AudioFormat audio_format, ret = true; } - if (!enabled) - error.Set(output_domain, "All audio outputs are disabled"); - else if (!ret) - /* TODO: obtain real error */ - error.Set(output_domain, "Failed to open audio output"); - - if (!ret) + if (!enabled) { /* close all devices if there was an error */ Close(); - - return ret; + throw std::runtime_error("All audio outputs are disabled"); + } else if (!ret) { + /* close all devices if there was an error */ + Close(); + /* TODO: obtain real error */ + throw std::runtime_error("Failed to open audio output"); + } } /** |