ServiceAudOut.cs 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. using ChocolArm64.Memory;
  2. using Ryujinx.Core.OsHle.Ipc;
  3. using System.Collections.Generic;
  4. using System.Text;
  5. using static Ryujinx.Core.OsHle.IpcServices.ObjHelper;
  6. namespace Ryujinx.Core.OsHle.IpcServices.Aud
  7. {
  8. class ServiceAudOut : IIpcService
  9. {
  10. private Dictionary<int, ServiceProcessRequest> m_Commands;
  11. public IReadOnlyDictionary<int, ServiceProcessRequest> Commands => m_Commands;
  12. public ServiceAudOut()
  13. {
  14. m_Commands = new Dictionary<int, ServiceProcessRequest>()
  15. {
  16. { 0, ListAudioOuts },
  17. { 1, OpenAudioOut },
  18. };
  19. }
  20. public long ListAudioOuts(ServiceCtx Context)
  21. {
  22. long Position = Context.Request.ReceiveBuff[0].Position;
  23. AMemoryHelper.WriteBytes(Context.Memory, Position, Encoding.ASCII.GetBytes("iface"));
  24. Context.ResponseData.Write(1);
  25. return 0;
  26. }
  27. public long OpenAudioOut(ServiceCtx Context)
  28. {
  29. MakeObject(Context, new IAudioOut());
  30. Context.ResponseData.Write(48000); //Sample Rate
  31. Context.ResponseData.Write(2); //Channel Count
  32. Context.ResponseData.Write(2); //PCM Format
  33. /*
  34. 0 - Invalid
  35. 1 - INT8
  36. 2 - INT16
  37. 3 - INT24
  38. 4 - INT32
  39. 5 - PCM Float
  40. 6 - ADPCM
  41. */
  42. Context.ResponseData.Write(0); //Unknown
  43. return 0;
  44. }
  45. }
  46. }