From 57c4e6ef21d1f281b172aedcfd993a2ac43456ef Mon Sep 17 00:00:00 2001 From: Ac_K Date: Fri, 20 Nov 2020 21:59:01 +0100 Subject: audout: Implement and fix some calls (#1725) * audout: Implement GetAudioOutBufferCount, GetAudioOutPlayedSampleCount and FlushAudioOutBuffers This PR implement audout service calls: - GetAudioOutBufferCount - GetAudioOutPlayedSampleCount - FlushAudioOutBuffers The RE calls just give some hints about no extra checks. Since we use a totally different implementation because of our backend, I can't do something better for now. SetAudioOutVolume and GetAudioOutVolume are fixed too by set/get the volume of the current opened track, previous implementation was wrong. This fix #1133, fix #1258 and fix #1519. Thanks to @jduncanator for this help during the implementation and all his precious advices. * Fix some debug leftovers * Address jD feedback --- Ryujinx.Audio/Renderers/DummyAudioOut.cs | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) (limited to 'Ryujinx.Audio/Renderers/DummyAudioOut.cs') diff --git a/Ryujinx.Audio/Renderers/DummyAudioOut.cs b/Ryujinx.Audio/Renderers/DummyAudioOut.cs index 2698b928..cd197592 100644 --- a/Ryujinx.Audio/Renderers/DummyAudioOut.cs +++ b/Ryujinx.Audio/Renderers/DummyAudioOut.cs @@ -1,5 +1,4 @@ -using System; -using System.Collections.Concurrent; +using System.Collections.Concurrent; using System.Collections.Generic; namespace Ryujinx.Audio @@ -15,6 +14,7 @@ namespace Ryujinx.Audio private ConcurrentQueue _trackIds; private ConcurrentQueue _buffers; private ConcurrentDictionary _releaseCallbacks; + private ulong _playedSampleCount; public DummyAudioOut() { @@ -76,6 +76,8 @@ namespace Ryujinx.Audio { _buffers.Enqueue(bufferTag); + _playedSampleCount += (ulong)buffer.Length; + if (_releaseCallbacks.TryGetValue(trackId, out var callback)) { callback?.Invoke(); @@ -86,9 +88,15 @@ namespace Ryujinx.Audio public void Stop(int trackId) { } - public float GetVolume() => _volume; + public uint GetBufferCount(int trackId) => (uint)_buffers.Count; + + public ulong GetPlayedSampleCount(int trackId) => _playedSampleCount; + + public bool FlushBuffers(int trackId) => false; + + public float GetVolume(int trackId) => _volume; - public void SetVolume(float volume) + public void SetVolume(int trackId, float volume) { _volume = volume; } -- cgit v1.2.3