summaryrefslogtreecommitdiffstats
path: root/src/audio_core/audio_core.cpp
diff options
context:
space:
mode:
authorKelebek1 <eeeedddccc@hotmail.co.uk>2022-07-17 00:48:45 +0200
committerKelebek1 <eeeedddccc@hotmail.co.uk>2022-07-22 02:11:32 +0200
commit458da8a94877677f086f06cdeecf959ec4283a33 (patch)
tree583166d77602ad90a0d552f37de8729ad80fd6c1 /src/audio_core/audio_core.cpp
parentMerge pull request #8598 from Link4565/recv-dontwait (diff)
downloadyuzu-458da8a94877677f086f06cdeecf959ec4283a33.tar
yuzu-458da8a94877677f086f06cdeecf959ec4283a33.tar.gz
yuzu-458da8a94877677f086f06cdeecf959ec4283a33.tar.bz2
yuzu-458da8a94877677f086f06cdeecf959ec4283a33.tar.lz
yuzu-458da8a94877677f086f06cdeecf959ec4283a33.tar.xz
yuzu-458da8a94877677f086f06cdeecf959ec4283a33.tar.zst
yuzu-458da8a94877677f086f06cdeecf959ec4283a33.zip
Diffstat (limited to 'src/audio_core/audio_core.cpp')
-rw-r--r--src/audio_core/audio_core.cpp68
1 files changed, 68 insertions, 0 deletions
diff --git a/src/audio_core/audio_core.cpp b/src/audio_core/audio_core.cpp
new file mode 100644
index 000000000..78e615a10
--- /dev/null
+++ b/src/audio_core/audio_core.cpp
@@ -0,0 +1,68 @@
+// SPDX-FileCopyrightText: Copyright 2022 yuzu Emulator Project
+// SPDX-License-Identifier: GPL-2.0-or-later
+
+#include "audio_core/audio_core.h"
+#include "audio_core/sink/sink_details.h"
+#include "common/settings.h"
+#include "core/core.h"
+
+namespace AudioCore {
+
+AudioCore::AudioCore(Core::System& system) : audio_manager{std::make_unique<AudioManager>(system)} {
+ CreateSinks();
+ // Must be created after the sinks
+ adsp = std::make_unique<AudioRenderer::ADSP::ADSP>(system, *output_sink);
+}
+
+AudioCore ::~AudioCore() {
+ Shutdown();
+}
+
+void AudioCore::CreateSinks() {
+ const auto& sink_id{Settings::values.sink_id};
+ const auto& audio_output_device_id{Settings::values.audio_output_device_id};
+ const auto& audio_input_device_id{Settings::values.audio_input_device_id};
+
+ output_sink = Sink::CreateSinkFromID(sink_id.GetValue(), audio_output_device_id.GetValue());
+ input_sink = Sink::CreateSinkFromID(sink_id.GetValue(), audio_input_device_id.GetValue());
+}
+
+void AudioCore::Shutdown() {
+ audio_manager->Shutdown();
+}
+
+AudioManager& AudioCore::GetAudioManager() {
+ return *audio_manager;
+}
+
+Sink::Sink& AudioCore::GetOutputSink() {
+ return *output_sink;
+}
+
+Sink::Sink& AudioCore::GetInputSink() {
+ return *input_sink;
+}
+
+AudioRenderer::ADSP::ADSP& AudioCore::GetADSP() {
+ return *adsp;
+}
+
+void AudioCore::PauseSinks(const bool pausing) const {
+ if (pausing) {
+ output_sink->PauseStreams();
+ input_sink->PauseStreams();
+ } else {
+ output_sink->UnpauseStreams();
+ input_sink->UnpauseStreams();
+ }
+}
+
+u32 AudioCore::GetStreamQueue() const {
+ return estimated_queue.load();
+}
+
+void AudioCore::SetStreamQueue(u32 size) {
+ estimated_queue.store(size);
+}
+
+} // namespace AudioCore