aboutsummaryrefslogtreecommitdiff
path: root/Ryujinx.Audio/Backends/Dummy
diff options
context:
space:
mode:
authorTSR Berry <20988865+TSRBerry@users.noreply.github.com>2023-04-08 01:22:00 +0200
committerMary <thog@protonmail.com>2023-04-27 23:51:14 +0200
commitcee712105850ac3385cd0091a923438167433f9f (patch)
tree4a5274b21d8b7f938c0d0ce18736d3f2993b11b1 /Ryujinx.Audio/Backends/Dummy
parentcd124bda587ef09668a971fa1cac1c3f0cfc9f21 (diff)
Move solution and projects to src
Diffstat (limited to 'Ryujinx.Audio/Backends/Dummy')
-rw-r--r--Ryujinx.Audio/Backends/Dummy/DummyHardwareDeviceDriver.cs89
-rw-r--r--Ryujinx.Audio/Backends/Dummy/DummyHardwareDeviceSessionInput.cs67
-rw-r--r--Ryujinx.Audio/Backends/Dummy/DummyHardwareDeviceSessionOutput.cs62
3 files changed, 0 insertions, 218 deletions
diff --git a/Ryujinx.Audio/Backends/Dummy/DummyHardwareDeviceDriver.cs b/Ryujinx.Audio/Backends/Dummy/DummyHardwareDeviceDriver.cs
deleted file mode 100644
index 641640f0..00000000
--- a/Ryujinx.Audio/Backends/Dummy/DummyHardwareDeviceDriver.cs
+++ /dev/null
@@ -1,89 +0,0 @@
-using Ryujinx.Audio.Common;
-using Ryujinx.Audio.Integration;
-using Ryujinx.Memory;
-using System.Threading;
-
-using static Ryujinx.Audio.Integration.IHardwareDeviceDriver;
-
-namespace Ryujinx.Audio.Backends.Dummy
-{
- public class DummyHardwareDeviceDriver : IHardwareDeviceDriver
- {
- private ManualResetEvent _updateRequiredEvent;
- private ManualResetEvent _pauseEvent;
-
- public static bool IsSupported => true;
-
- public DummyHardwareDeviceDriver()
- {
- _updateRequiredEvent = new ManualResetEvent(false);
- _pauseEvent = new ManualResetEvent(true);
- }
-
- public IHardwareDeviceSession OpenDeviceSession(Direction direction, IVirtualMemoryManager memoryManager, SampleFormat sampleFormat, uint sampleRate, uint channelCount, float volume)
- {
- if (sampleRate == 0)
- {
- sampleRate = Constants.TargetSampleRate;
- }
-
- if (channelCount == 0)
- {
- channelCount = 2;
- }
-
- if (direction == Direction.Output)
- {
- return new DummyHardwareDeviceSessionOutput(this, memoryManager, sampleFormat, sampleRate, channelCount, volume);
- }
- else
- {
- return new DummyHardwareDeviceSessionInput(this, memoryManager, sampleFormat, sampleRate, channelCount);
- }
- }
-
- public ManualResetEvent GetUpdateRequiredEvent()
- {
- return _updateRequiredEvent;
- }
-
- public ManualResetEvent GetPauseEvent()
- {
- return _pauseEvent;
- }
-
- public void Dispose()
- {
- Dispose(true);
- }
-
- protected virtual void Dispose(bool disposing)
- {
- if (disposing)
- {
- // NOTE: The _updateRequiredEvent will be disposed somewhere else.
- _pauseEvent.Dispose();
- }
- }
-
- public bool SupportsSampleRate(uint sampleRate)
- {
- return true;
- }
-
- public bool SupportsSampleFormat(SampleFormat sampleFormat)
- {
- return true;
- }
-
- public bool SupportsDirection(Direction direction)
- {
- return direction == Direction.Output || direction == Direction.Input;
- }
-
- public bool SupportsChannelCount(uint channelCount)
- {
- return channelCount == 1 || channelCount == 2 || channelCount == 6;
- }
- }
-} \ No newline at end of file
diff --git a/Ryujinx.Audio/Backends/Dummy/DummyHardwareDeviceSessionInput.cs b/Ryujinx.Audio/Backends/Dummy/DummyHardwareDeviceSessionInput.cs
deleted file mode 100644
index 845713a1..00000000
--- a/Ryujinx.Audio/Backends/Dummy/DummyHardwareDeviceSessionInput.cs
+++ /dev/null
@@ -1,67 +0,0 @@
-using Ryujinx.Audio.Common;
-using Ryujinx.Audio.Integration;
-using Ryujinx.Memory;
-using System;
-
-namespace Ryujinx.Audio.Backends.Dummy
-{
- class DummyHardwareDeviceSessionInput : IHardwareDeviceSession
- {
- private float _volume;
- private IHardwareDeviceDriver _manager;
- private IVirtualMemoryManager _memoryManager;
-
- public DummyHardwareDeviceSessionInput(IHardwareDeviceDriver manager, IVirtualMemoryManager memoryManager, SampleFormat requestedSampleFormat, uint requestedSampleRate, uint requestedChannelCount)
- {
- _volume = 1.0f;
- _manager = manager;
- _memoryManager = memoryManager;
- }
-
- public void Dispose()
- {
- // Nothing to do.
- }
-
- public ulong GetPlayedSampleCount()
- {
- // Not implemented for input.
- throw new NotSupportedException();
- }
-
- public float GetVolume()
- {
- return _volume;
- }
-
- public void PrepareToClose() { }
-
- public void QueueBuffer(AudioBuffer buffer)
- {
- _memoryManager.Fill(buffer.DataPointer, buffer.DataSize, 0);
-
- _manager.GetUpdateRequiredEvent().Set();
- }
-
- public bool RegisterBuffer(AudioBuffer buffer)
- {
- return buffer.DataPointer != 0;
- }
-
- public void SetVolume(float volume)
- {
- _volume = volume;
- }
-
- public void Start() { }
-
- public void Stop() { }
-
- public void UnregisterBuffer(AudioBuffer buffer) { }
-
- public bool WasBufferFullyConsumed(AudioBuffer buffer)
- {
- return true;
- }
- }
-} \ No newline at end of file
diff --git a/Ryujinx.Audio/Backends/Dummy/DummyHardwareDeviceSessionOutput.cs b/Ryujinx.Audio/Backends/Dummy/DummyHardwareDeviceSessionOutput.cs
deleted file mode 100644
index 8e2c949e..00000000
--- a/Ryujinx.Audio/Backends/Dummy/DummyHardwareDeviceSessionOutput.cs
+++ /dev/null
@@ -1,62 +0,0 @@
-using Ryujinx.Audio.Backends.Common;
-using Ryujinx.Audio.Common;
-using Ryujinx.Audio.Integration;
-using Ryujinx.Memory;
-using System.Threading;
-
-namespace Ryujinx.Audio.Backends.Dummy
-{
- internal class DummyHardwareDeviceSessionOutput : HardwareDeviceSessionOutputBase
- {
- private float _volume;
- private IHardwareDeviceDriver _manager;
-
- private ulong _playedSampleCount;
-
- public DummyHardwareDeviceSessionOutput(IHardwareDeviceDriver manager, IVirtualMemoryManager memoryManager, SampleFormat requestedSampleFormat, uint requestedSampleRate, uint requestedChannelCount, float requestedVolume) : base(memoryManager, requestedSampleFormat, requestedSampleRate, requestedChannelCount)
- {
- _volume = requestedVolume;
- _manager = manager;
- }
-
- public override void Dispose()
- {
- // Nothing to do.
- }
-
- public override ulong GetPlayedSampleCount()
- {
- return Interlocked.Read(ref _playedSampleCount);
- }
-
- public override float GetVolume()
- {
- return _volume;
- }
-
- public override void PrepareToClose() { }
-
- public override void QueueBuffer(AudioBuffer buffer)
- {
- Interlocked.Add(ref _playedSampleCount, GetSampleCount(buffer));
-
- _manager.GetUpdateRequiredEvent().Set();
- }
-
- public override void SetVolume(float volume)
- {
- _volume = volume;
- }
-
- public override void Start() { }
-
- public override void Stop() { }
-
- public override void UnregisterBuffer(AudioBuffer buffer) { }
-
- public override bool WasBufferFullyConsumed(AudioBuffer buffer)
- {
- return true;
- }
- }
-} \ No newline at end of file