aboutsummaryrefslogtreecommitdiff
path: root/Ryujinx.HLE/HOS
diff options
context:
space:
mode:
authorAc_K <Acoustik666@gmail.com>2019-10-11 17:54:29 +0200
committerThomas Guillemard <me@thog.eu>2019-10-11 17:54:29 +0200
commitc17e1f99f0d9047681ead1d51ff498cd252c2b3c (patch)
tree0c75d8ba946ed149165b387e7d64002b508fc75d /Ryujinx.HLE/HOS
parent4210fe2b7bcd2ae92e83decac930f6dbe7fd3f65 (diff)
audout:u: Implement SetAudioOutVolume and GetAudioOutVolume (#781)
* audout:u: Implement SetAudioOutVolume and GetAudioOutVolume - Implementation of `audout:u` SetAudioOutVolume and GetAudioOutVolume (checked with RE). - Add Get and Set for Volume into audio backends. - Cleanup of all audio backends to follow the `IAalOutput` structure and .NET standard. - Split OpenAL backend into 2 files for consistency. * Address comments * Fix the volume calculation
Diffstat (limited to 'Ryujinx.HLE/HOS')
-rw-r--r--Ryujinx.HLE/HOS/Services/Audio/AudioOutManager/IAudioOut.cs26
1 files changed, 26 insertions, 0 deletions
diff --git a/Ryujinx.HLE/HOS/Services/Audio/AudioOutManager/IAudioOut.cs b/Ryujinx.HLE/HOS/Services/Audio/AudioOutManager/IAudioOut.cs
index 5b6983d6..11d8036c 100644
--- a/Ryujinx.HLE/HOS/Services/Audio/AudioOutManager/IAudioOut.cs
+++ b/Ryujinx.HLE/HOS/Services/Audio/AudioOutManager/IAudioOut.cs
@@ -147,6 +147,32 @@ namespace Ryujinx.HLE.HOS.Services.Audio.AudioOutManager
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);
+
+ _audioOut.SetVolume(newVolume);
+
+ return ResultCode.Success;
+ }
+
+ [Command(13)] // 6.0.0+
+ // GetAudioOutVolume() -> s32
+ public ResultCode GetAudioOutVolume(ServiceCtx context)
+ {
+ float volume = _audioOut.GetVolume();
+
+ context.ResponseData.Write(volume);
+
+ return ResultCode.Success;
+ }
+
public void Dispose()
{
Dispose(true);