2021-02-25 16:11:56 -08:00
|
|
|
|
using Ryujinx.Audio.Common;
|
|
|
|
|
using Ryujinx.Audio.Output;
|
|
|
|
|
using Ryujinx.HLE.HOS.Services.Audio.AudioOut;
|
|
|
|
|
|
|
|
|
|
using AudioOutManagerImpl = Ryujinx.Audio.Output.AudioOutputManager;
|
|
|
|
|
|
|
|
|
|
namespace Ryujinx.HLE.HOS.Services.Audio
|
|
|
|
|
{
|
|
|
|
|
class AudioOutManager : IAudioOutManager
|
|
|
|
|
{
|
|
|
|
|
private AudioOutManagerImpl _impl;
|
|
|
|
|
|
|
|
|
|
public AudioOutManager(AudioOutManagerImpl impl)
|
|
|
|
|
{
|
|
|
|
|
_impl = impl;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public string[] ListAudioOuts()
|
|
|
|
|
{
|
|
|
|
|
return _impl.ListAudioOuts();
|
|
|
|
|
}
|
|
|
|
|
|
2021-12-23 08:33:56 -08:00
|
|
|
|
public ResultCode OpenAudioOut(ServiceCtx context, out string outputDeviceName, out AudioOutputConfiguration outputConfiguration, out IAudioOut obj, string inputDeviceName, ref AudioInputConfiguration parameter, ulong appletResourceUserId, uint processHandle, float volume)
|
2021-02-25 16:11:56 -08:00
|
|
|
|
{
|
|
|
|
|
var memoryManager = context.Process.HandleTable.GetKProcess((int)processHandle).CpuMemory;
|
|
|
|
|
|
2021-12-23 08:33:56 -08:00
|
|
|
|
ResultCode result = (ResultCode)_impl.OpenAudioOut(out outputDeviceName, out outputConfiguration, out AudioOutputSystem outSystem, memoryManager, inputDeviceName, SampleFormat.PcmInt16, ref parameter, appletResourceUserId, processHandle, volume);
|
2021-02-25 16:11:56 -08:00
|
|
|
|
|
|
|
|
|
if (result == ResultCode.Success)
|
|
|
|
|
{
|
|
|
|
|
obj = new AudioOut.AudioOut(outSystem, context.Device.System.KernelContext, processHandle);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
obj = null;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|