2018-01-15 03:29:11 +01:00
|
|
|
// Copyright 2018 yuzu emulator team
|
|
|
|
// Licensed under GPLv2 or any later version
|
|
|
|
// Refer to the license.txt file included.
|
|
|
|
|
|
|
|
#include "common/logging/log.h"
|
|
|
|
#include "core/hle/ipc_helpers.h"
|
2018-01-22 04:03:36 +01:00
|
|
|
#include "core/hle/kernel/hle_ipc.h"
|
2018-01-15 03:29:11 +01:00
|
|
|
#include "core/hle/service/audio/audout_u.h"
|
|
|
|
|
|
|
|
namespace Service {
|
|
|
|
namespace Audio {
|
|
|
|
|
2018-01-22 04:03:36 +01:00
|
|
|
class IAudioOut final : public ServiceFramework<IAudioOut> {
|
|
|
|
public:
|
|
|
|
IAudioOut() : ServiceFramework("IAudioOut") {
|
|
|
|
static const FunctionInfo functions[] = {
|
|
|
|
{0x0, nullptr, "GetAudioOutState"},
|
|
|
|
{0x1, nullptr, "StartAudioOut"},
|
|
|
|
{0x2, nullptr, "StopAudioOut"},
|
|
|
|
{0x3, nullptr, "AppendAudioOutBuffer_1"},
|
|
|
|
{0x4, nullptr, "RegisterBufferEvent"},
|
|
|
|
{0x5, nullptr, "GetReleasedAudioOutBuffer_1"},
|
|
|
|
{0x6, nullptr, "ContainsAudioOutBuffer"},
|
|
|
|
{0x7, nullptr, "AppendAudioOutBuffer_2"},
|
|
|
|
{0x8, nullptr, "GetReleasedAudioOutBuffer_2"},
|
|
|
|
};
|
|
|
|
RegisterHandlers(functions);
|
|
|
|
}
|
|
|
|
~IAudioOut() = default;
|
|
|
|
};
|
|
|
|
|
2018-01-15 03:29:11 +01:00
|
|
|
void AudOutU::ListAudioOuts(Kernel::HLERequestContext& ctx) {
|
|
|
|
LOG_WARNING(Service, "(STUBBED) called");
|
2018-01-22 04:03:36 +01:00
|
|
|
IPC::RequestParser rp{ctx};
|
|
|
|
|
|
|
|
auto& buffer = ctx.BufferDescriptorB()[0];
|
|
|
|
const std::string audio_interface = "AudioInterface";
|
|
|
|
|
|
|
|
Memory::WriteBlock(buffer.Address(), &audio_interface[0], audio_interface.size());
|
|
|
|
|
|
|
|
IPC::RequestBuilder rb = rp.MakeBuilder(3, 0, 0, 0);
|
|
|
|
|
2018-01-15 03:29:11 +01:00
|
|
|
rb.Push(RESULT_SUCCESS);
|
2018-01-22 04:03:36 +01:00
|
|
|
// TODO(st4rk): we're currently returning only one audio interface
|
|
|
|
// (stringlist size)
|
|
|
|
// however, it's highly possible to have more than one interface (despite that
|
|
|
|
// libtransistor
|
|
|
|
// requires only one).
|
|
|
|
rb.Push<u32>(1);
|
2018-01-15 03:29:11 +01:00
|
|
|
}
|
|
|
|
|
2018-01-22 21:27:55 +01:00
|
|
|
void AudOutU::OpenAudioOut(Kernel::HLERequestContext& ctx) {
|
|
|
|
LOG_WARNING(Service, "(STUBBED) called");
|
|
|
|
|
|
|
|
IPC::RequestBuilder rb{ctx, 6};
|
|
|
|
|
|
|
|
rb.Push(RESULT_SUCCESS);
|
|
|
|
rb.Push<u32>(48000); // Sample Rate
|
|
|
|
rb.Push<u32>(2); // Channels
|
|
|
|
rb.Push<u32>(2); // PCM Format (INT16)
|
|
|
|
rb.Push<u32>(0); // Unknown
|
|
|
|
rb.PushIpcInterface<Audio::IAudioOut>();
|
|
|
|
}
|
|
|
|
|
2018-01-15 03:29:11 +01:00
|
|
|
AudOutU::AudOutU() : ServiceFramework("audout:u") {
|
2018-01-22 04:03:36 +01:00
|
|
|
static const FunctionInfo functions[] = {{0x00000000, &AudOutU::ListAudioOuts, "ListAudioOuts"},
|
2018-01-22 21:27:55 +01:00
|
|
|
{0x00000001, &AudOutU::OpenAudioOut, "OpenAudioOut"},
|
2018-01-22 04:03:36 +01:00
|
|
|
{0x00000002, nullptr, "Unknown2"},
|
|
|
|
{0x00000003, nullptr, "Unknown3"}};
|
2018-01-15 03:29:11 +01:00
|
|
|
RegisterHandlers(functions);
|
|
|
|
}
|
|
|
|
|
|
|
|
} // namespace Audio
|
|
|
|
} // namespace Service
|