[Command(12)] // 6.0.0+ // SetAudioOutVolume(s32) public ResultCode SetAudioOutVolume(ServiceCtx context) { float volume = context.RequestData.ReadSingle(); _audioOut.SetVolume(_track, volume); 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); }