-
Notifications
You must be signed in to change notification settings - Fork 6
/
audio_core.cpp
58 lines (44 loc) · 1.46 KB
/
audio_core.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
// SPDX-FileCopyrightText: Copyright 2022 yuzu Emulator Project
// SPDX-License-Identifier: MPL-2.0
#include <audio_core/audio_core.h>
#include <audio_core/sink/sink_details.h>
#include <audio_core/common/settings.h>
#include <core/core.h>
namespace AudioCore {
AudioCore::AudioCore(Core::System& system) : audio_manager{std::make_unique<AudioManager>()} {
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::SetNVDECActive(bool active) {
nvdec_active = active;
}
bool AudioCore::IsNVDECActive() const {
return nvdec_active;
}
} // namespace AudioCore