aboutsummaryrefslogtreecommitdiff
path: root/Ryujinx.HLE/HOS/Services
diff options
context:
space:
mode:
authorAc_K <Acoustik666@gmail.com>2020-11-20 21:59:01 +0100
committerGitHub <noreply@github.com>2020-11-20 21:59:01 +0100
commit57c4e6ef21d1f281b172aedcfd993a2ac43456ef (patch)
tree8ee5e5b42ab14bd8df52e823f3fcb4027e5ed873 /Ryujinx.HLE/HOS/Services
parent9493cdfe553d77d8f37927ef2acf87cfbab1c467 (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.HLE/HOS/Services')
-rw-r--r--Ryujinx.HLE/HOS/Services/Audio/AudioOutManager/IAudioOut.cs43
1 files changed, 36 insertions, 7 deletions
diff --git a/Ryujinx.HLE/HOS/Services/Audio/AudioOutManager/IAudioOut.cs b/Ryujinx.HLE/HOS/Services/Audio/AudioOutManager/IAudioOut.cs
index d75fecf2..eaf644f6 100644
--- a/Ryujinx.HLE/HOS/Services/Audio/AudioOutManager/IAudioOut.cs
+++ b/Ryujinx.HLE/HOS/Services/Audio/AudioOutManager/IAudioOut.cs
@@ -149,17 +149,46 @@ namespace Ryujinx.HLE.HOS.Services.Audio.AudioOutManager
return ResultCode.Success;
}
+ [Command(9)] // 4.0.0+
+ // GetAudioOutBufferCount() -> u32
+ public ResultCode GetAudioOutBufferCount(ServiceCtx context)
+ {
+ uint bufferCount = _audioOut.GetBufferCount(_track);
+
+ context.ResponseData.Write(bufferCount);
+
+ return ResultCode.Success;
+ }
+
+ [Command(10)] // 4.0.0+
+ // GetAudioOutPlayedSampleCount() -> u64
+ public ResultCode GetAudioOutPlayedSampleCount(ServiceCtx context)
+ {
+ ulong playedSampleCount = _audioOut.GetPlayedSampleCount(_track);
+
+ context.ResponseData.Write(playedSampleCount);
+
+ return ResultCode.Success;
+ }
+
+ [Command(11)] // 4.0.0+
+ // FlushAudioOutBuffers() -> b8
+ public ResultCode FlushAudioOutBuffers(ServiceCtx context)
+ {
+ bool heldBuffers = _audioOut.FlushBuffers(_track);
+
+ context.ResponseData.Write(heldBuffers);
+
+ return ResultCode.Success;
+ }
+
[Command(12)] // 6.0.0+
// SetAudioOutVolume(s32)
public ResultCode SetAudioOutVolume(ServiceCtx context)
{
- // Games send a gain value here, so we need to apply it on the current volume value.
-
- float gain = context.RequestData.ReadSingle();
- float currentVolume = _audioOut.GetVolume();
- float newVolume = Math.Clamp(currentVolume + gain, 0.0f, 1.0f);
+ float volume = context.RequestData.ReadSingle();
- _audioOut.SetVolume(newVolume);
+ _audioOut.SetVolume(_track, volume);
return ResultCode.Success;
}
@@ -168,7 +197,7 @@ namespace Ryujinx.HLE.HOS.Services.Audio.AudioOutManager
// GetAudioOutVolume() -> s32
public ResultCode GetAudioOutVolume(ServiceCtx context)
{
- float volume = _audioOut.GetVolume();
+ float volume = _audioOut.GetVolume(_track);
context.ResponseData.Write(volume);