Merge pull request #1028 from ogniK5377/aoa

Added GetAudioRendererSampleRate, GetAudioRendererSampleCount & GetAudioRendererMixBufferCount
This commit is contained in:
bunnei 2018-08-12 13:33:08 -04:00 committed by GitHub
commit 68c44ca0ee
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 42 additions and 6 deletions

View file

@ -26,6 +26,18 @@ AudioRenderer::AudioRenderer(AudioRendererParameter params,
QueueMixedBuffer(2); QueueMixedBuffer(2);
} }
u32 AudioRenderer::GetSampleRate() const {
return worker_params.sample_rate;
}
u32 AudioRenderer::GetSampleCount() const {
return worker_params.sample_count;
}
u32 AudioRenderer::GetMixBufferCount() const {
return worker_params.mix_buffer_count;
}
std::vector<u8> AudioRenderer::UpdateAudioRenderer(const std::vector<u8>& input_params) { std::vector<u8> AudioRenderer::UpdateAudioRenderer(const std::vector<u8>& input_params) {
// Copy UpdateDataHeader struct // Copy UpdateDataHeader struct
UpdateDataHeader config{}; UpdateDataHeader config{};

View file

@ -26,7 +26,7 @@ enum class PlayState : u8 {
struct AudioRendererParameter { struct AudioRendererParameter {
u32_le sample_rate; u32_le sample_rate;
u32_le sample_count; u32_le sample_count;
u32_le unknown_8; u32_le mix_buffer_count;
u32_le unknown_c; u32_le unknown_c;
u32_le voice_count; u32_le voice_count;
u32_le sink_count; u32_le sink_count;
@ -160,6 +160,9 @@ public:
std::vector<u8> UpdateAudioRenderer(const std::vector<u8>& input_params); std::vector<u8> UpdateAudioRenderer(const std::vector<u8>& input_params);
void QueueMixedBuffer(Buffer::Tag tag); void QueueMixedBuffer(Buffer::Tag tag);
void ReleaseAndQueueBuffers(); void ReleaseAndQueueBuffers();
u32 GetSampleRate() const;
u32 GetSampleCount() const;
u32 GetMixBufferCount() const;
private: private:
class VoiceState { class VoiceState {

View file

@ -20,9 +20,9 @@ public:
explicit IAudioRenderer(AudioCore::AudioRendererParameter audren_params) explicit IAudioRenderer(AudioCore::AudioRendererParameter audren_params)
: ServiceFramework("IAudioRenderer") { : ServiceFramework("IAudioRenderer") {
static const FunctionInfo functions[] = { static const FunctionInfo functions[] = {
{0, nullptr, "GetAudioRendererSampleRate"}, {0, &IAudioRenderer::GetAudioRendererSampleRate, "GetAudioRendererSampleRate"},
{1, nullptr, "GetAudioRendererSampleCount"}, {1, &IAudioRenderer::GetAudioRendererSampleCount, "GetAudioRendererSampleCount"},
{2, nullptr, "GetAudioRendererMixBufferCount"}, {2, &IAudioRenderer::GetAudioRendererMixBufferCount, "GetAudioRendererMixBufferCount"},
{3, nullptr, "GetAudioRendererState"}, {3, nullptr, "GetAudioRendererState"},
{4, &IAudioRenderer::RequestUpdateAudioRenderer, "RequestUpdateAudioRenderer"}, {4, &IAudioRenderer::RequestUpdateAudioRenderer, "RequestUpdateAudioRenderer"},
{5, &IAudioRenderer::StartAudioRenderer, "StartAudioRenderer"}, {5, &IAudioRenderer::StartAudioRenderer, "StartAudioRenderer"},
@ -45,6 +45,27 @@ private:
system_event->Signal(); system_event->Signal();
} }
void GetAudioRendererSampleRate(Kernel::HLERequestContext& ctx) {
IPC::ResponseBuilder rb{ctx, 3};
rb.Push(RESULT_SUCCESS);
rb.Push<u32>(renderer->GetSampleRate());
LOG_DEBUG(Service_Audio, "called");
}
void GetAudioRendererSampleCount(Kernel::HLERequestContext& ctx) {
IPC::ResponseBuilder rb{ctx, 3};
rb.Push(RESULT_SUCCESS);
rb.Push<u32>(renderer->GetSampleCount());
LOG_DEBUG(Service_Audio, "called");
}
void GetAudioRendererMixBufferCount(Kernel::HLERequestContext& ctx) {
IPC::ResponseBuilder rb{ctx, 3};
rb.Push(RESULT_SUCCESS);
rb.Push<u32>(renderer->GetMixBufferCount());
LOG_DEBUG(Service_Audio, "called");
}
void RequestUpdateAudioRenderer(Kernel::HLERequestContext& ctx) { void RequestUpdateAudioRenderer(Kernel::HLERequestContext& ctx) {
ctx.WriteBuffer(renderer->UpdateAudioRenderer(ctx.ReadBuffer())); ctx.WriteBuffer(renderer->UpdateAudioRenderer(ctx.ReadBuffer()));
IPC::ResponseBuilder rb{ctx, 2}; IPC::ResponseBuilder rb{ctx, 2};
@ -189,7 +210,7 @@ void AudRenU::GetAudioRendererWorkBufferSize(Kernel::HLERequestContext& ctx) {
IPC::RequestParser rp{ctx}; IPC::RequestParser rp{ctx};
auto params = rp.PopRaw<AudioCore::AudioRendererParameter>(); auto params = rp.PopRaw<AudioCore::AudioRendererParameter>();
u64 buffer_sz = Common::AlignUp(4 * params.unknown_8, 0x40); u64 buffer_sz = Common::AlignUp(4 * params.mix_buffer_count, 0x40);
buffer_sz += params.unknown_c * 1024; buffer_sz += params.unknown_c * 1024;
buffer_sz += 0x940 * (params.unknown_c + 1); buffer_sz += 0x940 * (params.unknown_c + 1);
buffer_sz += 0x3F0 * params.voice_count; buffer_sz += 0x3F0 * params.voice_count;
@ -197,7 +218,7 @@ void AudRenU::GetAudioRendererWorkBufferSize(Kernel::HLERequestContext& ctx) {
buffer_sz += Common::AlignUp(8 * params.voice_count, 0x10); buffer_sz += Common::AlignUp(8 * params.voice_count, 0x10);
buffer_sz += buffer_sz +=
Common::AlignUp((0x3C0 * (params.sink_count + params.unknown_c) + 4 * params.sample_count) * Common::AlignUp((0x3C0 * (params.sink_count + params.unknown_c) + 4 * params.sample_count) *
(params.unknown_8 + 6), (params.mix_buffer_count + 6),
0x40); 0x40);
if (IsFeatureSupported(AudioFeatures::Splitter, params.revision)) { if (IsFeatureSupported(AudioFeatures::Splitter, params.revision)) {