diff options
| author | Ac_K <Acoustik666@gmail.com> | 2020-11-20 21:59:01 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-11-20 21:59:01 +0100 |
| commit | 57c4e6ef21d1f281b172aedcfd993a2ac43456ef (patch) | |
| tree | 8ee5e5b42ab14bd8df52e823f3fcb4027e5ed873 /Ryujinx.Audio/Renderers/DummyAudioOut.cs | |
| parent | 9493cdfe553d77d8f37927ef2acf87cfbab1c467 (diff) | |
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
Diffstat (limited to 'Ryujinx.Audio/Renderers/DummyAudioOut.cs')
| -rw-r--r-- | Ryujinx.Audio/Renderers/DummyAudioOut.cs | 16 |
1 files changed, 12 insertions, 4 deletions
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<int> _trackIds; private ConcurrentQueue<long> _buffers; private ConcurrentDictionary<int, ReleaseCallback> _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; } |
