DummyHardwareDeviceSessionInput.cs 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. using Ryujinx.Audio.Common;
  2. using Ryujinx.Audio.Integration;
  3. using Ryujinx.Memory;
  4. using System;
  5. namespace Ryujinx.Audio.Backends.Dummy
  6. {
  7. class DummyHardwareDeviceSessionInput : IHardwareDeviceSession
  8. {
  9. private float _volume;
  10. private IHardwareDeviceDriver _manager;
  11. private IVirtualMemoryManager _memoryManager;
  12. public DummyHardwareDeviceSessionInput(IHardwareDeviceDriver manager, IVirtualMemoryManager memoryManager, SampleFormat requestedSampleFormat, uint requestedSampleRate, uint requestedChannelCount)
  13. {
  14. _volume = 1.0f;
  15. _manager = manager;
  16. _memoryManager = memoryManager;
  17. }
  18. public void Dispose()
  19. {
  20. // Nothing to do.
  21. }
  22. public ulong GetPlayedSampleCount()
  23. {
  24. // Not implemented for input.
  25. throw new NotSupportedException();
  26. }
  27. public float GetVolume()
  28. {
  29. return _volume;
  30. }
  31. public void PrepareToClose() { }
  32. public void QueueBuffer(AudioBuffer buffer)
  33. {
  34. _memoryManager.Fill(buffer.DataPointer, buffer.DataSize, 0);
  35. _manager.GetUpdateRequiredEvent().Set();
  36. }
  37. public bool RegisterBuffer(AudioBuffer buffer)
  38. {
  39. return buffer.DataPointer != 0;
  40. }
  41. public void SetVolume(float volume)
  42. {
  43. _volume = volume;
  44. }
  45. public void Start() { }
  46. public void Stop() { }
  47. public void UnregisterBuffer(AudioBuffer buffer) { }
  48. public bool WasBufferFullyConsumed(AudioBuffer buffer)
  49. {
  50. return true;
  51. }
  52. }
  53. }