I wasn’t 100% where to put this but my question is how to handle setting up a master volume slider. I understand how to hook up a variable to a slider. I guess more of the problem is I don’t know how to approach setting up audio and their special dedicated blueprints to make this work. I want to be able to have a couple sliders that work for different types of content so that say in game music has its own slider. Then maybe UI has its own volume slider. Then there would be a master slider that takes ALL of the sound levels and is able to adjust them. How exactly would this be setup?
You’re looking for Sound Classes.
But unfortunately the variables and functions you need are not exposed to Blueprints.
There are Sound Classes that already exist per default in UE4 and you can also create your own custom ones.
Then you can tell which class is a child of which one. Being a sound child class of another sound class means the volume ratio of the parent class is applied to all child classes.
Logically that means you’re going to have one Master Volume Class plugged to different child like Combat, FX, UI and whatnot, as you mention.
I just coded that yesterday in C++ for my A-RPG prototype. I want my prototype to be full Blueprint but I couldn’t find a way around that. I created a custom blueprint node accessible within my PlayerController. It’s far from being a clean solution but it’s good enough.
Here it is (don’t mind the Input functions, I had them on the same screenshots).
What I did: I created a custom PlayerController c++ class. Then I reparented my PlayerController class to that newly created C++ class. I then wrote down the few lines of code you can see in the screenshots and “voilà”. I have a custom blueprint node that allows me to dynamically change the volume of sound classes.
You can see the little dropdown menu on the node “change sound class volume”, when I expand it it gives me this:
These are all the sound classes available in the engine + the custom ones you created.
Here it is
PS: I think that you can achieve kind of the same results with Blueprints only using the Sound Mix Class but I don’t know anything about how it works.
Actually, in the latest release of UE4, there is now a Set Sound Mix Class Override function. This will allow you to re-define the settings of a SoundClass in realtime :). You can use it for settings or even to manipulate values in realtime in the game. We’re using this method to do exactly what you’re talking about- using a Blueprint Widget (UI) to set SoundClass volumes.