I propose integrating the NUI volume into the in-game audio settings, eliminating the need for a separate NUI volume control in the Windows Audio Mixer.
Issue: Currently, NUI sounds in most servers are set to maximum or a static volume level that does not adjust dynamically with the players’ game volume. As a result, players resort to changing the volume through the Windows Audio Mixer (FiveM Chromium subprocess). However, this causes a problem where any other NUI sounds will be adjusted based on the volume that annoyed them previously. Consequently, if a script want to play a sound that is appropriately balanced with the game, it won’t be adjusted correctly since the players have already lowered the volume for the entire process, resulting in the sound being quieter than intended.
Solutions: To address this issue, I have considered two potential solutions.
Solution 1: Remove the “FiveM Chromium subprocess” from the Windows Audio Mixer altogether. Instead, implement a built-in sound system within FiveM’s NUI that plays sound files and categorizes them as either SFX or music. This system would allow the volume to be adjusted both through the NUI interface and the player’s settings, ensuring proper audio balance.
Solution 2: Alternatively, adjust all NUI sounds based on the SFX volume setting. This approach would mean that if the SFX volume is set to 0.5, all NUI sounds would be adjusted relative to that value.
However, the specific volume for each NUI sound would still be determined by the NUI’s own volume setting. For example, if a NUI sound is set to 0.2 and the SFX volume is 0.5, the sound would play at 0.1 (0.2 * 0.5).
By implementing either of these solutions, we can ensure that NUI sounds are appropriately adjusted in conjunction with the game volume, providing a more seamless and balanced audio experience for players.
I believe you may have misunderstood the main issue. The crux of the problem lies in the fact that many other servers set the volume statically, prompting players to lower it. Consequently, if you attempt to implement dynamic volume adjustments independently (using the native features), the resulting sound would be quieter than intended.
This feature would greatly assist servers in determining the appropriate volume levels for playing sounds relative to their respective game volume. By implementing this functionality, players would be able to genuinely enjoy a well-balanced audio experience that seamlessly integrates both in-game sounds and NUI elements.
I would say the crux of the problem is that resources are poorly written and do not take game audio into account. You’re requesting Cfx officially support playing audio through NUI, which definitely isn’t going to happen.
I’ve given you a solution you can use today and it’s probably the best you’ll get (aside from use game audio).
We had something like this in 2019, in fact it’s what the ‘native audio’ functionality for VoIP is based on (and why it’s called NuiAudioSink.cpp still), and this same research is what a proper sound system loading random .ogg/.mp3/.m4a/whatever files – outside of NUI – would be based on as well once we actually get someone to try using a new API so we won’t ‘do it wrong’ yet again. People hated it as some use cases that they abused Chromium audio for broke (despite some tweaks to it to allow setting category) and they were extremely hostile when it came to providing repros, so it was reverted and never returned.
I believe we had this, but can’t find any use case of it - it might be this was merely planned. However, since ‘usage’ isn’t easy to split between SFX and music it’s difficult to tell which is which, and this would then at ‘worst’ cap at the highest of the two volume settings, but even 100% game volume is not the same as unattenuated browser volume either so this’d need a tuned curve by someone who’s actually experienced in this.
Basically, this is yet another case of ‘we don’t have enough info to work on this in a way that won’t break any existing use cases, because we simply don’t know anyone who can serve as a “focus group” for any such changes. similarly, we can’t make a proper audio API that’s easy to use either, because that’s even more needing a focus group.’