diff options
author | Lioncash <mathew1800@gmail.com> | 2018-12-13 16:23:31 -0500 |
---|---|---|
committer | Lioncash <mathew1800@gmail.com> | 2018-12-13 16:44:32 -0500 |
commit | 6beb823f150c965adf057c3fd423aa23dcb77997 (patch) | |
tree | ba63f98b43c3d674aa719b018cf1fb4faa70a650 /src/audio_core/audio_out.cpp | |
parent | 3b1043c58a743fa5efbd2d33f0080691114de964 (diff) |
audio_core: Make g_sink_details internally linked
We can hide the direct array from external view and instead provide
functions to retrieve the necessary info. This has the benefit of
completely hiding the makeup of the SinkDetails structure from the rest
of the code.
Given that this makes the array hidden, we can also make the array
constexpr by altering the members slightly. This gets rid of several
static constructor calls related to std::vector and std::function.
Now we don't have heap allocations here that need to occur before the
program can even enter main(). It also has the benefit of saving a
little bit of heap space, but this doesn't matter too much, since the
savings in that regard are pretty tiny.
Diffstat (limited to 'src/audio_core/audio_out.cpp')
-rw-r--r-- | src/audio_core/audio_out.cpp | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/src/audio_core/audio_out.cpp b/src/audio_core/audio_out.cpp index 0c8f5b18e0..cbba17632f 100644 --- a/src/audio_core/audio_out.cpp +++ b/src/audio_core/audio_out.cpp @@ -30,8 +30,7 @@ static Stream::Format ChannelsToStreamFormat(u32 num_channels) { StreamPtr AudioOut::OpenStream(u32 sample_rate, u32 num_channels, std::string&& name, Stream::ReleaseCallback&& release_callback) { if (!sink) { - const SinkDetails& sink_details = GetSinkDetails(Settings::values.sink_id); - sink = sink_details.factory(Settings::values.audio_device_id); + sink = CreateSinkFromID(Settings::values.sink_id, Settings::values.audio_device_id); } return std::make_shared<Stream>( |