audren_u.cpp 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549
  1. // SPDX-FileCopyrightText: Copyright 2018 yuzu Emulator Project
  2. // SPDX-License-Identifier: GPL-2.0-or-later
  3. #include <array>
  4. #include <memory>
  5. #include "audio_core/audio_core.h"
  6. #include "audio_core/common/audio_renderer_parameter.h"
  7. #include "audio_core/common/feature_support.h"
  8. #include "audio_core/renderer/audio_device.h"
  9. #include "audio_core/renderer/audio_renderer.h"
  10. #include "audio_core/renderer/voice/voice_info.h"
  11. #include "common/alignment.h"
  12. #include "common/bit_util.h"
  13. #include "common/common_funcs.h"
  14. #include "common/logging/log.h"
  15. #include "common/string_util.h"
  16. #include "core/core.h"
  17. #include "core/hle/ipc_helpers.h"
  18. #include "core/hle/kernel/k_event.h"
  19. #include "core/hle/kernel/k_process.h"
  20. #include "core/hle/kernel/k_transfer_memory.h"
  21. #include "core/hle/service/audio/audren_u.h"
  22. #include "core/hle/service/audio/errors.h"
  23. #include "core/memory.h"
  24. using namespace AudioCore::AudioRenderer;
  25. namespace Service::Audio {
  26. class IAudioRenderer final : public ServiceFramework<IAudioRenderer> {
  27. public:
  28. explicit IAudioRenderer(Core::System& system_, Manager& manager_,
  29. AudioCore::AudioRendererParameterInternal& params,
  30. Kernel::KTransferMemory* transfer_memory, u64 transfer_memory_size,
  31. u32 process_handle, u64 applet_resource_user_id, s32 session_id)
  32. : ServiceFramework{system_, "IAudioRenderer", ServiceThreadType::CreateNew},
  33. service_context{system_, "IAudioRenderer"}, rendered_event{service_context.CreateEvent(
  34. "IAudioRendererEvent")},
  35. manager{manager_}, impl{std::make_unique<Renderer>(system_, manager, rendered_event)} {
  36. // clang-format off
  37. static const FunctionInfo functions[] = {
  38. {0, &IAudioRenderer::GetSampleRate, "GetSampleRate"},
  39. {1, &IAudioRenderer::GetSampleCount, "GetSampleCount"},
  40. {2, &IAudioRenderer::GetMixBufferCount, "GetMixBufferCount"},
  41. {3, &IAudioRenderer::GetState, "GetState"},
  42. {4, &IAudioRenderer::RequestUpdate, "RequestUpdate"},
  43. {5, &IAudioRenderer::Start, "Start"},
  44. {6, &IAudioRenderer::Stop, "Stop"},
  45. {7, &IAudioRenderer::QuerySystemEvent, "QuerySystemEvent"},
  46. {8, &IAudioRenderer::SetRenderingTimeLimit, "SetRenderingTimeLimit"},
  47. {9, &IAudioRenderer::GetRenderingTimeLimit, "GetRenderingTimeLimit"},
  48. {10, &IAudioRenderer::RequestUpdate, "RequestUpdateAuto"},
  49. {11, nullptr, "ExecuteAudioRendererRendering"},
  50. {12, &IAudioRenderer::SetVoiceDropParameter, "SetVoiceDropParameter"},
  51. {13, &IAudioRenderer::GetVoiceDropParameter, "GetVoiceDropParameter"},
  52. };
  53. // clang-format on
  54. RegisterHandlers(functions);
  55. impl->Initialize(params, transfer_memory, transfer_memory_size, process_handle,
  56. applet_resource_user_id, session_id);
  57. }
  58. ~IAudioRenderer() override {
  59. impl->Finalize();
  60. service_context.CloseEvent(rendered_event);
  61. }
  62. private:
  63. void GetSampleRate(Kernel::HLERequestContext& ctx) {
  64. const auto sample_rate{impl->GetSystem().GetSampleRate()};
  65. LOG_DEBUG(Service_Audio, "called. Sample rate {}", sample_rate);
  66. IPC::ResponseBuilder rb{ctx, 3};
  67. rb.Push(ResultSuccess);
  68. rb.Push(sample_rate);
  69. }
  70. void GetSampleCount(Kernel::HLERequestContext& ctx) {
  71. const auto sample_count{impl->GetSystem().GetSampleCount()};
  72. LOG_DEBUG(Service_Audio, "called. Sample count {}", sample_count);
  73. IPC::ResponseBuilder rb{ctx, 3};
  74. rb.Push(ResultSuccess);
  75. rb.Push(sample_count);
  76. }
  77. void GetState(Kernel::HLERequestContext& ctx) {
  78. const u32 state{!impl->GetSystem().IsActive()};
  79. LOG_DEBUG(Service_Audio, "called, state {}", state);
  80. IPC::ResponseBuilder rb{ctx, 3};
  81. rb.Push(ResultSuccess);
  82. rb.Push(state);
  83. }
  84. void GetMixBufferCount(Kernel::HLERequestContext& ctx) {
  85. LOG_DEBUG(Service_Audio, "called");
  86. const auto buffer_count{impl->GetSystem().GetMixBufferCount()};
  87. IPC::ResponseBuilder rb{ctx, 3};
  88. rb.Push(ResultSuccess);
  89. rb.Push(buffer_count);
  90. }
  91. void RequestUpdate(Kernel::HLERequestContext& ctx) {
  92. LOG_TRACE(Service_Audio, "called");
  93. std::vector<u8> input{ctx.ReadBuffer(0)};
  94. // These buffers are written manually to avoid an issue with WriteBuffer throwing errors for
  95. // checking size 0. Performance size is 0 for most games.
  96. std::vector<u8> output{};
  97. std::vector<u8> performance{};
  98. auto is_buffer_b{ctx.BufferDescriptorB()[0].Size() != 0};
  99. if (is_buffer_b) {
  100. const auto buffersB{ctx.BufferDescriptorB()};
  101. output.resize(buffersB[0].Size(), 0);
  102. performance.resize(buffersB[1].Size(), 0);
  103. } else {
  104. const auto buffersC{ctx.BufferDescriptorC()};
  105. output.resize(buffersC[0].Size(), 0);
  106. performance.resize(buffersC[1].Size(), 0);
  107. }
  108. auto result = impl->RequestUpdate(input, performance, output);
  109. if (result.IsSuccess()) {
  110. if (is_buffer_b) {
  111. ctx.WriteBufferB(output.data(), output.size(), 0);
  112. ctx.WriteBufferB(performance.data(), performance.size(), 1);
  113. } else {
  114. ctx.WriteBufferC(output.data(), output.size(), 0);
  115. ctx.WriteBufferC(performance.data(), performance.size(), 1);
  116. }
  117. } else {
  118. LOG_ERROR(Service_Audio, "RequestUpdate failed error 0x{:02X}!", result.description);
  119. }
  120. IPC::ResponseBuilder rb{ctx, 2};
  121. rb.Push(result);
  122. }
  123. void Start(Kernel::HLERequestContext& ctx) {
  124. LOG_DEBUG(Service_Audio, "called");
  125. impl->Start();
  126. IPC::ResponseBuilder rb{ctx, 2};
  127. rb.Push(ResultSuccess);
  128. }
  129. void Stop(Kernel::HLERequestContext& ctx) {
  130. LOG_DEBUG(Service_Audio, "called");
  131. impl->Stop();
  132. IPC::ResponseBuilder rb{ctx, 2};
  133. rb.Push(ResultSuccess);
  134. }
  135. void QuerySystemEvent(Kernel::HLERequestContext& ctx) {
  136. LOG_DEBUG(Service_Audio, "called");
  137. if (impl->GetSystem().GetExecutionMode() == AudioCore::ExecutionMode::Manual) {
  138. IPC::ResponseBuilder rb{ctx, 2};
  139. rb.Push(ERR_NOT_SUPPORTED);
  140. return;
  141. }
  142. IPC::ResponseBuilder rb{ctx, 2, 1};
  143. rb.Push(ResultSuccess);
  144. rb.PushCopyObjects(rendered_event->GetReadableEvent());
  145. }
  146. void SetRenderingTimeLimit(Kernel::HLERequestContext& ctx) {
  147. LOG_DEBUG(Service_Audio, "called");
  148. IPC::RequestParser rp{ctx};
  149. auto limit = rp.PopRaw<u32>();
  150. auto& system_ = impl->GetSystem();
  151. system_.SetRenderingTimeLimit(limit);
  152. IPC::ResponseBuilder rb{ctx, 2};
  153. rb.Push(ResultSuccess);
  154. }
  155. void GetRenderingTimeLimit(Kernel::HLERequestContext& ctx) {
  156. LOG_DEBUG(Service_Audio, "called");
  157. auto& system_ = impl->GetSystem();
  158. auto time = system_.GetRenderingTimeLimit();
  159. IPC::ResponseBuilder rb{ctx, 3};
  160. rb.Push(ResultSuccess);
  161. rb.Push(time);
  162. }
  163. void ExecuteAudioRendererRendering(Kernel::HLERequestContext& ctx) {
  164. LOG_DEBUG(Service_Audio, "called");
  165. }
  166. void SetVoiceDropParameter(Kernel::HLERequestContext& ctx) {
  167. LOG_DEBUG(Service_Audio, "called");
  168. IPC::RequestParser rp{ctx};
  169. auto voice_drop_param{rp.Pop<f32>()};
  170. auto& system_ = impl->GetSystem();
  171. system_.SetVoiceDropParameter(voice_drop_param);
  172. IPC::ResponseBuilder rb{ctx, 2};
  173. rb.Push(ResultSuccess);
  174. }
  175. void GetVoiceDropParameter(Kernel::HLERequestContext& ctx) {
  176. LOG_DEBUG(Service_Audio, "called");
  177. auto& system_ = impl->GetSystem();
  178. auto voice_drop_param{system_.GetVoiceDropParameter()};
  179. IPC::ResponseBuilder rb{ctx, 3};
  180. rb.Push(ResultSuccess);
  181. rb.Push(voice_drop_param);
  182. }
  183. KernelHelpers::ServiceContext service_context;
  184. Kernel::KEvent* rendered_event;
  185. Manager& manager;
  186. std::unique_ptr<Renderer> impl;
  187. };
  188. class IAudioDevice final : public ServiceFramework<IAudioDevice> {
  189. public:
  190. explicit IAudioDevice(Core::System& system_, u64 applet_resource_user_id, u32 revision,
  191. u32 device_num)
  192. : ServiceFramework{system_, "IAudioDevice", ServiceThreadType::CreateNew},
  193. service_context{system_, "IAudioDevice"}, impl{std::make_unique<AudioDevice>(
  194. system_, applet_resource_user_id,
  195. revision)},
  196. event{service_context.CreateEvent(fmt::format("IAudioDeviceEvent-{}", device_num))} {
  197. static const FunctionInfo functions[] = {
  198. {0, &IAudioDevice::ListAudioDeviceName, "ListAudioDeviceName"},
  199. {1, &IAudioDevice::SetAudioDeviceOutputVolume, "SetAudioDeviceOutputVolume"},
  200. {2, &IAudioDevice::GetAudioDeviceOutputVolume, "GetAudioDeviceOutputVolume"},
  201. {3, &IAudioDevice::GetActiveAudioDeviceName, "GetActiveAudioDeviceName"},
  202. {4, &IAudioDevice::QueryAudioDeviceSystemEvent, "QueryAudioDeviceSystemEvent"},
  203. {5, &IAudioDevice::GetActiveChannelCount, "GetActiveChannelCount"},
  204. {6, &IAudioDevice::ListAudioDeviceName, "ListAudioDeviceNameAuto"},
  205. {7, &IAudioDevice::SetAudioDeviceOutputVolume, "SetAudioDeviceOutputVolumeAuto"},
  206. {8, &IAudioDevice::GetAudioDeviceOutputVolume, "GetAudioDeviceOutputVolumeAuto"},
  207. {10, &IAudioDevice::GetActiveAudioDeviceName, "GetActiveAudioDeviceNameAuto"},
  208. {11, &IAudioDevice::QueryAudioDeviceInputEvent, "QueryAudioDeviceInputEvent"},
  209. {12, &IAudioDevice::QueryAudioDeviceOutputEvent, "QueryAudioDeviceOutputEvent"},
  210. {13, &IAudioDevice::GetActiveAudioDeviceName, "GetActiveAudioOutputDeviceName"},
  211. {14, &IAudioDevice::ListAudioOutputDeviceName, "ListAudioOutputDeviceName"},
  212. };
  213. RegisterHandlers(functions);
  214. event->Signal();
  215. }
  216. ~IAudioDevice() override {
  217. service_context.CloseEvent(event);
  218. }
  219. private:
  220. void ListAudioDeviceName(Kernel::HLERequestContext& ctx) {
  221. const size_t in_count = ctx.GetWriteBufferSize() / sizeof(AudioDevice::AudioDeviceName);
  222. std::vector<AudioDevice::AudioDeviceName> out_names{};
  223. const u32 out_count = impl->ListAudioDeviceName(out_names, in_count);
  224. std::string out{};
  225. for (u32 i = 0; i < out_count; i++) {
  226. std::string a{};
  227. u32 j = 0;
  228. while (out_names[i].name[j] != '\0') {
  229. a += out_names[i].name[j];
  230. j++;
  231. }
  232. out += "\n\t" + a;
  233. }
  234. LOG_DEBUG(Service_Audio, "called.\nNames={}", out);
  235. IPC::ResponseBuilder rb{ctx, 3};
  236. ctx.WriteBuffer(out_names);
  237. rb.Push(ResultSuccess);
  238. rb.Push(out_count);
  239. }
  240. void SetAudioDeviceOutputVolume(Kernel::HLERequestContext& ctx) {
  241. IPC::RequestParser rp{ctx};
  242. const f32 volume = rp.Pop<f32>();
  243. const auto device_name_buffer = ctx.ReadBuffer();
  244. const std::string name = Common::StringFromBuffer(device_name_buffer);
  245. LOG_DEBUG(Service_Audio, "called. name={}, volume={}", name, volume);
  246. if (name == "AudioTvOutput") {
  247. impl->SetDeviceVolumes(volume);
  248. }
  249. IPC::ResponseBuilder rb{ctx, 2};
  250. rb.Push(ResultSuccess);
  251. }
  252. void GetAudioDeviceOutputVolume(Kernel::HLERequestContext& ctx) {
  253. const auto device_name_buffer = ctx.ReadBuffer();
  254. const std::string name = Common::StringFromBuffer(device_name_buffer);
  255. LOG_DEBUG(Service_Audio, "called. Name={}", name);
  256. f32 volume{1.0f};
  257. if (name == "AudioTvOutput") {
  258. volume = impl->GetDeviceVolume(name);
  259. }
  260. IPC::ResponseBuilder rb{ctx, 3};
  261. rb.Push(ResultSuccess);
  262. rb.Push(volume);
  263. }
  264. void GetActiveAudioDeviceName(Kernel::HLERequestContext& ctx) {
  265. const auto write_size = ctx.GetWriteBufferSize() / sizeof(char);
  266. std::string out_name{"AudioTvOutput"};
  267. LOG_DEBUG(Service_Audio, "(STUBBED) called. Name={}", out_name);
  268. out_name.resize(write_size);
  269. ctx.WriteBuffer(out_name);
  270. IPC::ResponseBuilder rb{ctx, 2};
  271. rb.Push(ResultSuccess);
  272. }
  273. void QueryAudioDeviceSystemEvent(Kernel::HLERequestContext& ctx) {
  274. LOG_DEBUG(Service_Audio, "(STUBBED) called");
  275. event->Signal();
  276. IPC::ResponseBuilder rb{ctx, 2, 1};
  277. rb.Push(ResultSuccess);
  278. rb.PushCopyObjects(event->GetReadableEvent());
  279. }
  280. void GetActiveChannelCount(Kernel::HLERequestContext& ctx) {
  281. const auto& sink{system.AudioCore().GetOutputSink()};
  282. u32 channel_count{sink.GetDeviceChannels()};
  283. LOG_DEBUG(Service_Audio, "(STUBBED) called. Channels={}", channel_count);
  284. IPC::ResponseBuilder rb{ctx, 3};
  285. rb.Push(ResultSuccess);
  286. rb.Push<u32>(channel_count);
  287. }
  288. void QueryAudioDeviceInputEvent(Kernel::HLERequestContext& ctx) {
  289. LOG_DEBUG(Service_Audio, "(STUBBED) called");
  290. IPC::ResponseBuilder rb{ctx, 2, 1};
  291. rb.Push(ResultSuccess);
  292. rb.PushCopyObjects(event->GetReadableEvent());
  293. }
  294. void QueryAudioDeviceOutputEvent(Kernel::HLERequestContext& ctx) {
  295. LOG_DEBUG(Service_Audio, "called");
  296. IPC::ResponseBuilder rb{ctx, 2, 1};
  297. rb.Push(ResultSuccess);
  298. rb.PushCopyObjects(event->GetReadableEvent());
  299. }
  300. void ListAudioOutputDeviceName(Kernel::HLERequestContext& ctx) {
  301. const size_t in_count = ctx.GetWriteBufferSize() / sizeof(AudioDevice::AudioDeviceName);
  302. std::vector<AudioDevice::AudioDeviceName> out_names{};
  303. const u32 out_count = impl->ListAudioOutputDeviceName(out_names, in_count);
  304. std::string out{};
  305. for (u32 i = 0; i < out_count; i++) {
  306. std::string a{};
  307. u32 j = 0;
  308. while (out_names[i].name[j] != '\0') {
  309. a += out_names[i].name[j];
  310. j++;
  311. }
  312. out += "\n\t" + a;
  313. }
  314. LOG_DEBUG(Service_Audio, "called.\nNames={}", out);
  315. IPC::ResponseBuilder rb{ctx, 3};
  316. ctx.WriteBuffer(out_names);
  317. rb.Push(ResultSuccess);
  318. rb.Push(out_count);
  319. }
  320. KernelHelpers::ServiceContext service_context;
  321. std::unique_ptr<AudioDevice> impl;
  322. Kernel::KEvent* event;
  323. };
  324. AudRenU::AudRenU(Core::System& system_)
  325. : ServiceFramework{system_, "audren:u", ServiceThreadType::CreateNew},
  326. service_context{system_, "audren:u"}, impl{std::make_unique<Manager>(system_)} {
  327. // clang-format off
  328. static const FunctionInfo functions[] = {
  329. {0, &AudRenU::OpenAudioRenderer, "OpenAudioRenderer"},
  330. {1, &AudRenU::GetWorkBufferSize, "GetWorkBufferSize"},
  331. {2, &AudRenU::GetAudioDeviceService, "GetAudioDeviceService"},
  332. {3, nullptr, "OpenAudioRendererForManualExecution"},
  333. {4, &AudRenU::GetAudioDeviceServiceWithRevisionInfo, "GetAudioDeviceServiceWithRevisionInfo"},
  334. };
  335. // clang-format on
  336. RegisterHandlers(functions);
  337. }
  338. AudRenU::~AudRenU() = default;
  339. void AudRenU::OpenAudioRenderer(Kernel::HLERequestContext& ctx) {
  340. IPC::RequestParser rp{ctx};
  341. AudioCore::AudioRendererParameterInternal params;
  342. rp.PopRaw<AudioCore::AudioRendererParameterInternal>(params);
  343. auto transfer_memory_handle = ctx.GetCopyHandle(0);
  344. auto process_handle = ctx.GetCopyHandle(1);
  345. auto transfer_memory_size = rp.Pop<u64>();
  346. auto applet_resource_user_id = rp.Pop<u64>();
  347. if (impl->GetSessionCount() + 1 > AudioCore::MaxRendererSessions) {
  348. LOG_ERROR(Service_Audio, "Too many AudioRenderer sessions open!");
  349. IPC::ResponseBuilder rb{ctx, 2};
  350. rb.Push(ERR_MAXIMUM_SESSIONS_REACHED);
  351. return;
  352. }
  353. const auto& handle_table{system.CurrentProcess()->GetHandleTable()};
  354. auto process{handle_table.GetObject<Kernel::KProcess>(process_handle)};
  355. auto transfer_memory{
  356. process->GetHandleTable().GetObject<Kernel::KTransferMemory>(transfer_memory_handle)};
  357. const auto session_id{impl->GetSessionId()};
  358. if (session_id == -1) {
  359. LOG_ERROR(Service_Audio, "Tried to open a session that's already in use!");
  360. IPC::ResponseBuilder rb{ctx, 2};
  361. rb.Push(ERR_MAXIMUM_SESSIONS_REACHED);
  362. return;
  363. }
  364. LOG_DEBUG(Service_Audio, "Opened new AudioRenderer session {} sessions open {}", session_id,
  365. impl->GetSessionCount());
  366. IPC::ResponseBuilder rb{ctx, 2, 0, 1};
  367. rb.Push(ResultSuccess);
  368. rb.PushIpcInterface<IAudioRenderer>(system, *impl, params, transfer_memory.GetPointerUnsafe(),
  369. transfer_memory_size, process_handle,
  370. applet_resource_user_id, session_id);
  371. }
  372. void AudRenU::GetWorkBufferSize(Kernel::HLERequestContext& ctx) {
  373. AudioCore::AudioRendererParameterInternal params;
  374. IPC::RequestParser rp{ctx};
  375. rp.PopRaw<AudioCore::AudioRendererParameterInternal>(params);
  376. u64 size{0};
  377. auto result = impl->GetWorkBufferSize(params, size);
  378. std::string output_info{};
  379. output_info += fmt::format("\tRevision {}", AudioCore::GetRevisionNum(params.revision));
  380. output_info +=
  381. fmt::format("\n\tSample Rate {}, Sample Count {}", params.sample_rate, params.sample_count);
  382. output_info += fmt::format("\n\tExecution Mode {}, Voice Drop Enabled {}",
  383. static_cast<u32>(params.execution_mode), params.voice_drop_enabled);
  384. output_info += fmt::format(
  385. "\n\tSizes: Effects {:04X}, Mixes {:04X}, Sinks {:04X}, Submixes {:04X}, Splitter Infos "
  386. "{:04X}, Splitter Destinations {:04X}, Voices {:04X}, Performance Frames {:04X} External "
  387. "Context {:04X}",
  388. params.effects, params.mixes, params.sinks, params.sub_mixes, params.splitter_infos,
  389. params.splitter_destinations, params.voices, params.perf_frames,
  390. params.external_context_size);
  391. LOG_DEBUG(Service_Audio, "called.\nInput params:\n{}\nOutput params:\n\tWorkbuffer size {:08X}",
  392. output_info, size);
  393. IPC::ResponseBuilder rb{ctx, 4};
  394. rb.Push(result);
  395. rb.Push<u64>(size);
  396. }
  397. void AudRenU::GetAudioDeviceService(Kernel::HLERequestContext& ctx) {
  398. IPC::RequestParser rp{ctx};
  399. const auto applet_resource_user_id = rp.Pop<u64>();
  400. LOG_DEBUG(Service_Audio, "called. Applet resource id {}", applet_resource_user_id);
  401. IPC::ResponseBuilder rb{ctx, 2, 0, 1};
  402. rb.Push(ResultSuccess);
  403. rb.PushIpcInterface<IAudioDevice>(system, applet_resource_user_id,
  404. ::Common::MakeMagic('R', 'E', 'V', '1'), num_audio_devices++);
  405. }
  406. void AudRenU::OpenAudioRendererForManualExecution(Kernel::HLERequestContext& ctx) {
  407. LOG_DEBUG(Service_Audio, "called");
  408. }
  409. void AudRenU::GetAudioDeviceServiceWithRevisionInfo(Kernel::HLERequestContext& ctx) {
  410. struct Parameters {
  411. u32 revision;
  412. u64 applet_resource_user_id;
  413. };
  414. IPC::RequestParser rp{ctx};
  415. const auto [revision, applet_resource_user_id] = rp.PopRaw<Parameters>();
  416. LOG_DEBUG(Service_Audio, "called. Revision {} Applet resource id {}",
  417. AudioCore::GetRevisionNum(revision), applet_resource_user_id);
  418. IPC::ResponseBuilder rb{ctx, 2, 0, 1};
  419. rb.Push(ResultSuccess);
  420. rb.PushIpcInterface<IAudioDevice>(system, applet_resource_user_id, revision,
  421. num_audio_devices++);
  422. }
  423. } // namespace Service::Audio