1
0
Fork 0
mirror of https://github.com/Ryujinx/Ryujinx.git synced 2024-12-13 13:02:02 +00:00
Ryujinx/Ryujinx.HLE/HOS/Services/Audio/AudioRendererManager.cs
gdkchan cf6cd71488
IPC refactor part 2: Use ReplyAndReceive on HLE services and remove special handling from kernel (#1458)
* IPC refactor part 2: Use ReplyAndReceive on HLE services and remove special handling from kernel

* Fix for applet transfer memory + some nits

* Keep handles if possible to avoid server handle table exhaustion

* Fix IPC ZeroFill bug

* am: Correctly implement CreateManagedDisplayLayer and implement CreateManagedDisplaySeparableLayer

CreateManagedDisplaySeparableLayer is requires since 10.x+ when appletResourceUserId != 0

* Make it exit properly

* Make ServiceNotImplementedException show the full message again

* Allow yielding execution to avoid starving other threads

* Only wait if active

* Merge IVirtualMemoryManager and IAddressSpaceManager

* Fix Ro loading data from the wrong process

Co-authored-by: Thog <me@thog.eu>
2020-12-02 00:23:43 +01:00

52 lines
2 KiB
C#

using Ryujinx.Audio.Renderer.Device;
using Ryujinx.Audio.Renderer.Parameter;
using Ryujinx.Audio.Renderer.Server;
using Ryujinx.HLE.HOS.Kernel.Memory;
using Ryujinx.HLE.HOS.Services.Audio.AudioRenderer;
using AudioRendererManagerImpl = Ryujinx.Audio.Renderer.Server.AudioRendererManager;
namespace Ryujinx.HLE.HOS.Services.Audio
{
class AudioRendererManager : IAudioRendererManager
{
private AudioRendererManagerImpl _impl;
private VirtualDeviceSessionRegistry _registry;
public AudioRendererManager(AudioRendererManagerImpl impl, VirtualDeviceSessionRegistry registry)
{
_impl = impl;
_registry = registry;
}
public ResultCode GetAudioDeviceServiceWithRevisionInfo(ServiceCtx context, out IAudioDevice outObject, int revision, ulong appletResourceUserId)
{
outObject = new AudioDevice(_registry, context.Device.System.KernelContext, appletResourceUserId, revision);
return ResultCode.Success;
}
public ulong GetWorkBufferSize(ref AudioRendererConfiguration parameter)
{
return AudioRendererManagerImpl.GetWorkBufferSize(ref parameter);
}
public ResultCode OpenAudioRenderer(ServiceCtx context, out IAudioRenderer obj, ref AudioRendererConfiguration parameter, ulong workBufferSize, ulong appletResourceUserId, KTransferMemory workBufferTransferMemory, uint processHandle)
{
var memoryManager = context.Process.HandleTable.GetKProcess((int)processHandle).CpuMemory;
ResultCode result = (ResultCode)_impl.OpenAudioRenderer(out AudioRenderSystem renderer, memoryManager, ref parameter, appletResourceUserId, workBufferTransferMemory.Address, workBufferTransferMemory.Size, processHandle);
if (result == ResultCode.Success)
{
obj = new AudioRenderer.AudioRenderer(renderer);
}
else
{
obj = null;
}
return result;
}
}
}