summaryrefslogtreecommitdiff
path: root/src/core/hle
diff options
context:
space:
mode:
authorGravatar bunnei2018-07-28 13:27:59 -0400
committerGravatar bunnei2018-07-30 18:44:16 -0400
commiteaf66b4c9f9517bcb4f417260ad460fca4254bec (patch)
tree9c7333809e56e4ad4e36fd25447afe7c6f51818a /src/core/hle
parentexternals: Add cubeb for audio output. (diff)
downloadyuzu-eaf66b4c9f9517bcb4f417260ad460fca4254bec.tar.gz
yuzu-eaf66b4c9f9517bcb4f417260ad460fca4254bec.tar.xz
yuzu-eaf66b4c9f9517bcb4f417260ad460fca4254bec.zip
audio_core: Move to audout_u impl.
- This is necessary so streams are created on the same thread.
Diffstat (limited to 'src/core/hle')
-rw-r--r--src/core/hle/service/audio/audout_u.cpp8
-rw-r--r--src/core/hle/service/audio/audout_u.h2
2 files changed, 6 insertions, 4 deletions
diff --git a/src/core/hle/service/audio/audout_u.cpp b/src/core/hle/service/audio/audout_u.cpp
index a15d53ff8..ab37c2a69 100644
--- a/src/core/hle/service/audio/audout_u.cpp
+++ b/src/core/hle/service/audio/audout_u.cpp
@@ -25,9 +25,8 @@ constexpr int DefaultSampleRate{48000};
25 25
26class IAudioOut final : public ServiceFramework<IAudioOut> { 26class IAudioOut final : public ServiceFramework<IAudioOut> {
27public: 27public:
28 IAudioOut(AudoutParams audio_params) 28 IAudioOut(AudoutParams audio_params, AudioCore::AudioOut& audio_core)
29 : ServiceFramework("IAudioOut"), audio_params(audio_params), 29 : ServiceFramework("IAudioOut"), audio_params(audio_params), audio_core(audio_core) {
30 audio_core(Core::System::GetInstance().AudioCore()) {
31 30
32 static const FunctionInfo functions[] = { 31 static const FunctionInfo functions[] = {
33 {0, &IAudioOut::GetAudioOutState, "GetAudioOutState"}, 32 {0, &IAudioOut::GetAudioOutState, "GetAudioOutState"},
@@ -195,7 +194,7 @@ void AudOutU::OpenAudioOutImpl(Kernel::HLERequestContext& ctx) {
195 // TODO(bunnei): Support more than one IAudioOut interface. When we add this, ListAudioOutsImpl 194 // TODO(bunnei): Support more than one IAudioOut interface. When we add this, ListAudioOutsImpl
196 // will likely need to be updated as well. 195 // will likely need to be updated as well.
197 ASSERT_MSG(!audio_out_interface, "Unimplemented"); 196 ASSERT_MSG(!audio_out_interface, "Unimplemented");
198 audio_out_interface = std::make_shared<IAudioOut>(std::move(params)); 197 audio_out_interface = std::make_shared<IAudioOut>(std::move(params), *audio_core);
199 198
200 IPC::ResponseBuilder rb{ctx, 6, 0, 1}; 199 IPC::ResponseBuilder rb{ctx, 6, 0, 1};
201 rb.Push(RESULT_SUCCESS); 200 rb.Push(RESULT_SUCCESS);
@@ -212,6 +211,7 @@ AudOutU::AudOutU() : ServiceFramework("audout:u") {
212 {2, &AudOutU::ListAudioOutsImpl, "ListAudioOutsAuto"}, 211 {2, &AudOutU::ListAudioOutsImpl, "ListAudioOutsAuto"},
213 {3, &AudOutU::OpenAudioOutImpl, "OpenAudioOutAuto"}}; 212 {3, &AudOutU::OpenAudioOutImpl, "OpenAudioOutAuto"}};
214 RegisterHandlers(functions); 213 RegisterHandlers(functions);
214 audio_core = std::make_unique<AudioCore::AudioOut>();
215} 215}
216 216
217} // namespace Service::Audio 217} // namespace Service::Audio
diff --git a/src/core/hle/service/audio/audout_u.h b/src/core/hle/service/audio/audout_u.h
index bc43f1f44..e5c2184d5 100644
--- a/src/core/hle/service/audio/audout_u.h
+++ b/src/core/hle/service/audio/audout_u.h
@@ -4,6 +4,7 @@
4 4
5#pragma once 5#pragma once
6 6
7#include "audio_core/audio_out.h"
7#include "core/hle/service/service.h" 8#include "core/hle/service/service.h"
8 9
9namespace Kernel { 10namespace Kernel {
@@ -33,6 +34,7 @@ public:
33 34
34private: 35private:
35 std::shared_ptr<IAudioOut> audio_out_interface; 36 std::shared_ptr<IAudioOut> audio_out_interface;
37 std::unique_ptr<AudioCore::AudioOut> audio_core;
36 38
37 void ListAudioOutsImpl(Kernel::HLERequestContext& ctx); 39 void ListAudioOutsImpl(Kernel::HLERequestContext& ctx);
38 void OpenAudioOutImpl(Kernel::HLERequestContext& ctx); 40 void OpenAudioOutImpl(Kernel::HLERequestContext& ctx);