output/Control: fold Configure() into the constructor
This commit is contained in:
parent
bba144eca5
commit
2d03823283
@ -33,11 +33,15 @@
|
|||||||
static constexpr PeriodClock::Duration REOPEN_AFTER = std::chrono::seconds(10);
|
static constexpr PeriodClock::Duration REOPEN_AFTER = std::chrono::seconds(10);
|
||||||
|
|
||||||
AudioOutputControl::AudioOutputControl(std::unique_ptr<FilteredAudioOutput> _output,
|
AudioOutputControl::AudioOutputControl(std::unique_ptr<FilteredAudioOutput> _output,
|
||||||
AudioOutputClient &_client) noexcept
|
AudioOutputClient &_client,
|
||||||
|
const ConfigBlock &block)
|
||||||
:output(std::move(_output)),
|
:output(std::move(_output)),
|
||||||
name(output->GetName()),
|
name(output->GetName()),
|
||||||
client(_client),
|
client(_client),
|
||||||
thread(BIND_THIS_METHOD(Task))
|
thread(BIND_THIS_METHOD(Task)),
|
||||||
|
tags(block.GetBlockValue("tags", true)),
|
||||||
|
always_on(block.GetBlockValue("always_on", false)),
|
||||||
|
enabled(block.GetBlockValue("enabled", true))
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -57,14 +61,6 @@ AudioOutputControl::~AudioOutputControl() noexcept
|
|||||||
StopThread();
|
StopThread();
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
|
||||||
AudioOutputControl::Configure(const ConfigBlock &block)
|
|
||||||
{
|
|
||||||
tags = block.GetBlockValue("tags", true);
|
|
||||||
always_on = block.GetBlockValue("always_on", false);
|
|
||||||
enabled = block.GetBlockValue("enabled", true);
|
|
||||||
}
|
|
||||||
|
|
||||||
std::unique_ptr<FilteredAudioOutput>
|
std::unique_ptr<FilteredAudioOutput>
|
||||||
AudioOutputControl::Steal() noexcept
|
AudioOutputControl::Steal() noexcept
|
||||||
{
|
{
|
||||||
|
@ -249,8 +249,12 @@ public:
|
|||||||
*/
|
*/
|
||||||
mutable Mutex mutex;
|
mutable Mutex mutex;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Throws on error.
|
||||||
|
*/
|
||||||
AudioOutputControl(std::unique_ptr<FilteredAudioOutput> _output,
|
AudioOutputControl(std::unique_ptr<FilteredAudioOutput> _output,
|
||||||
AudioOutputClient &_client) noexcept;
|
AudioOutputClient &_client,
|
||||||
|
const ConfigBlock &block);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Move the contents of an existing instance, and convert that
|
* Move the contents of an existing instance, and convert that
|
||||||
@ -264,11 +268,6 @@ public:
|
|||||||
AudioOutputControl(const AudioOutputControl &) = delete;
|
AudioOutputControl(const AudioOutputControl &) = delete;
|
||||||
AudioOutputControl &operator=(const AudioOutputControl &) = delete;
|
AudioOutputControl &operator=(const AudioOutputControl &) = delete;
|
||||||
|
|
||||||
/**
|
|
||||||
* Throws on error.
|
|
||||||
*/
|
|
||||||
void Configure(const ConfigBlock &block);
|
|
||||||
|
|
||||||
[[gnu::pure]]
|
[[gnu::pure]]
|
||||||
const char *GetName() const noexcept;
|
const char *GetName() const noexcept;
|
||||||
|
|
||||||
|
@ -80,9 +80,8 @@ LoadOutputControl(EventLoop &event_loop, EventLoop &rt_event_loop,
|
|||||||
replay_gain_config,
|
replay_gain_config,
|
||||||
mixer_listener,
|
mixer_listener,
|
||||||
block, defaults, filter_factory);
|
block, defaults, filter_factory);
|
||||||
auto control = std::make_unique<AudioOutputControl>(std::move(output), client);
|
return std::make_unique<AudioOutputControl>(std::move(output),
|
||||||
control->Configure(block);
|
client, block);
|
||||||
return control;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
Loading…
Reference in New Issue
Block a user