diff options
| author | TSR Berry <20988865+TSRBerry@users.noreply.github.com> | 2023-04-08 01:22:00 +0200 |
|---|---|---|
| committer | Mary <thog@protonmail.com> | 2023-04-27 23:51:14 +0200 |
| commit | cee712105850ac3385cd0091a923438167433f9f (patch) | |
| tree | 4a5274b21d8b7f938c0d0ce18736d3f2993b11b1 /Ryujinx.Audio/Backends/Common/HardwareDeviceSessionOutputBase.cs | |
| parent | cd124bda587ef09668a971fa1cac1c3f0cfc9f21 (diff) | |
Move solution and projects to src
Diffstat (limited to 'Ryujinx.Audio/Backends/Common/HardwareDeviceSessionOutputBase.cs')
| -rw-r--r-- | Ryujinx.Audio/Backends/Common/HardwareDeviceSessionOutputBase.cs | 79 |
1 files changed, 0 insertions, 79 deletions
diff --git a/Ryujinx.Audio/Backends/Common/HardwareDeviceSessionOutputBase.cs b/Ryujinx.Audio/Backends/Common/HardwareDeviceSessionOutputBase.cs deleted file mode 100644 index 6fb3bee0..00000000 --- a/Ryujinx.Audio/Backends/Common/HardwareDeviceSessionOutputBase.cs +++ /dev/null @@ -1,79 +0,0 @@ -using Ryujinx.Audio.Common; -using Ryujinx.Audio.Integration; -using Ryujinx.Memory; -using System.Runtime.CompilerServices; - -namespace Ryujinx.Audio.Backends.Common -{ - public abstract class HardwareDeviceSessionOutputBase : IHardwareDeviceSession - { - public IVirtualMemoryManager MemoryManager { get; } - public SampleFormat RequestedSampleFormat { get; } - public uint RequestedSampleRate { get; } - public uint RequestedChannelCount { get; } - - public HardwareDeviceSessionOutputBase(IVirtualMemoryManager memoryManager, SampleFormat requestedSampleFormat, uint requestedSampleRate, uint requestedChannelCount) - { - MemoryManager = memoryManager; - RequestedSampleFormat = requestedSampleFormat; - RequestedSampleRate = requestedSampleRate; - RequestedChannelCount = requestedChannelCount; - } - - private byte[] GetBufferSamples(AudioBuffer buffer) - { - if (buffer.DataPointer == 0) - { - return null; - } - - byte[] data = new byte[buffer.DataSize]; - - MemoryManager.Read(buffer.DataPointer, data); - - return data; - } - - protected ulong GetSampleCount(AudioBuffer buffer) - { - return GetSampleCount((int)buffer.DataSize); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - protected ulong GetSampleCount(int dataSize) - { - return (ulong)BackendHelper.GetSampleCount(RequestedSampleFormat, (int)RequestedChannelCount, dataSize); - } - - public abstract void Dispose(); - public abstract void PrepareToClose(); - public abstract void QueueBuffer(AudioBuffer buffer); - public abstract void SetVolume(float volume); - public abstract float GetVolume(); - public abstract void Start(); - public abstract void Stop(); - public abstract ulong GetPlayedSampleCount(); - public abstract bool WasBufferFullyConsumed(AudioBuffer buffer); - public virtual bool RegisterBuffer(AudioBuffer buffer) - { - return RegisterBuffer(buffer, GetBufferSamples(buffer)); - } - - public virtual bool RegisterBuffer(AudioBuffer buffer, byte[] samples) - { - if (samples == null) - { - return false; - } - - if (buffer.Data == null) - { - buffer.Data = samples; - } - - return true; - } - - public virtual void UnregisterBuffer(AudioBuffer buffer) { } - } -}
\ No newline at end of file |
