diff --git a/src/output/Init.cxx b/src/output/Init.cxx index 447ff5279..683999e6d 100644 --- a/src/output/Init.cxx +++ b/src/output/Init.cxx @@ -58,6 +58,15 @@ AudioOutput::AudioOutput(const AudioOutputPlugin &_plugin) assert(plugin.play != nullptr); } +AudioOutput::AudioOutput(const AudioOutputPlugin &_plugin, + const ConfigBlock &block) + :AudioOutput(_plugin) +{ + Error error; + if (!Configure(block, error)) + throw std::runtime_error(error.GetMessage()); +} + static const AudioOutputPlugin * audio_output_detect(Error &error) { diff --git a/src/output/Internal.hxx b/src/output/Internal.hxx index da6a1bc5c..053a7db0c 100644 --- a/src/output/Internal.hxx +++ b/src/output/Internal.hxx @@ -283,6 +283,13 @@ struct AudioOutput { bool current_chunk_finished; AudioOutput(const AudioOutputPlugin &_plugin); + + /** + * Throws #std::runtime_error on error. + */ + AudioOutput(const AudioOutputPlugin &_plugin, + const ConfigBlock &block); + ~AudioOutput(); bool Configure(const ConfigBlock &block, Error &error);