How to change sound volume in C++?
How to change a sound class's volume in C++? I'm trying to build an audio options menu, where you can configure the Master (overall) volume, Effects volume, Music volume, Voice volume, etc.
I tried changing it via
I debugged the code and it was finding the sound classes (Master, SFX, etc.), and it was assigning the new values, but the volume didn't actually change.
asked Jul 12 '14 at 03:54 AM in C++ Programming
I'd like to suggest a small improvement I did on the function. As the finding class by name part uses FString::Find it could get the wrong class searching for a name that's part of another class. For example, it could give you SFX_Weapons while searching for SFX, as SFX_Weapons also contains SFX. So, instead, I look for the part after the . in the full name. The names are like Engine/Something/Sound.Master , so the class name we look for is right after the only . in the name. Splitting the name by the . and getting the right part, we have the class name only.
Code (tested on 4.10.4)
answered Mar 10 '16 at 10:17 PM
I've managed to achieve that by changing sound class volume property. Instead of
Also make sure there is only one "Master" sound class.
answered Jul 13 '14 at 10:31 PM
In the newer version of Unreal Engine FAudioDevice::SoundClasses has been made private. Instead the default USoundClass can be easily accessed from UAudioSettings or if the access of a custom USoundClass is desired it can be accessed by calling LoadObject<>().
answered Jan 13 '18 at 09:36 PM
Follow this question
Once you sign in you will be able to subscribe for any updates here