stub/implement audren commands

This commit is contained in:
emmaus 2018-10-03 19:06:33 +00:00
parent 0254a84f90
commit 908d296c1a
2 changed files with 60 additions and 8 deletions

View file

@ -38,6 +38,8 @@ namespace Ryujinx.HLE.HOS.Services.Aud.AudioRenderer
private int Track;
private bool IsStarted;
public IAudioRenderer(
Horizon System,
AMemory Memory,
@ -46,10 +48,14 @@ namespace Ryujinx.HLE.HOS.Services.Aud.AudioRenderer
{
m_Commands = new Dictionary<int, ServiceProcessRequest>()
{
{ 4, RequestUpdateAudioRenderer },
{ 5, StartAudioRenderer },
{ 6, StopAudioRenderer },
{ 7, QuerySystemEvent }
{ 0, GetAudioRendererSampleRate },
{ 1, GetAudioRendererSampleCount },
{ 2, GetAudioRendererMixBufferCount },
{ 3, GetAudioRendererState },
{ 4, RequestUpdateAudioRenderer },
{ 5, StartAudioRenderer },
{ 6, StopAudioRenderer },
{ 7, QuerySystemEvent }
};
UpdateEvent = new KEvent(System);
@ -68,6 +74,38 @@ namespace Ryujinx.HLE.HOS.Services.Aud.AudioRenderer
Voices = CreateArray<VoiceContext>(Params.VoiceCount);
InitializeAudioOut();
IsStarted = false;
}
public long GetAudioRendererSampleRate(ServiceCtx Context)
{
Context.ResponseData.Write(Params.SampleRate);
return 0;
}
public long GetAudioRendererSampleCount(ServiceCtx Context)
{
Context.ResponseData.Write(Params.SampleCount);
return 0;
}
public long GetAudioRendererMixBufferCount(ServiceCtx Context)
{
Context.ResponseData.Write(Params.MixCount);
return 0;
}
private long GetAudioRendererState(ServiceCtx Context)
{
Context.ResponseData.Write(!IsStarted);
Context.Device.Log.PrintStub(LogClass.ServiceAudio, $"Stubbed. Renderer State = {(IsStarted? "Started":"Stopped")}");
return 0;
}
private void AudioCallback()
@ -206,6 +244,8 @@ namespace Ryujinx.HLE.HOS.Services.Aud.AudioRenderer
{
Context.Device.Log.PrintStub(LogClass.ServiceAudio, "Stubbed.");
IsStarted = true;
return 0;
}
@ -213,6 +253,8 @@ namespace Ryujinx.HLE.HOS.Services.Aud.AudioRenderer
{
Context.Device.Log.PrintStub(LogClass.ServiceAudio, "Stubbed.");
IsStarted = false;
return 0;
}

View file

@ -3,6 +3,7 @@ using Ryujinx.HLE.HOS.Ipc;
using Ryujinx.HLE.HOS.Services.Aud.AudioRenderer;
using Ryujinx.HLE.Logging;
using Ryujinx.HLE.Utilities;
using System;
using System.Collections.Generic;
using static Ryujinx.HLE.HOS.ErrorCode;
@ -28,9 +29,10 @@ namespace Ryujinx.HLE.HOS.Services.Aud
{
m_Commands = new Dictionary<int, ServiceProcessRequest>()
{
{ 0, OpenAudioRenderer },
{ 1, GetAudioRendererWorkBufferSize },
{ 2, GetAudioDevice }
{ 0, OpenAudioRenderer },
{ 1, GetAudioRendererWorkBufferSize },
{ 2, GetAudioDeviceService },
{ 4, GetAudioDeviceServiceWithRevisionInfo }
};
}
@ -161,7 +163,7 @@ namespace Ryujinx.HLE.HOS.Services.Aud
return Result / 8;
}
public long GetAudioDevice(ServiceCtx Context)
public long GetAudioDeviceService(ServiceCtx Context)
{
long UserId = Context.RequestData.ReadInt64();
@ -169,5 +171,13 @@ namespace Ryujinx.HLE.HOS.Services.Aud
return 0;
}
private long GetAudioDeviceServiceWithRevisionInfo(ServiceCtx Context)
{
Context.Device.Log.PrintStub(LogClass.ServiceAudio, "Stubbed.");
return GetAudioDeviceService(Context);
}
}
}