Here's the right way to let the user adjust the volume of different types of audio in your game. Sample project: github.com/the... Text version: shaggydev.com/... Further reading - docs.godotengi... - docs.godotengi...
I have spent all fucking week trying to find a solution and here late at night at 01:23 on friday, with a new Indev releases every Saturday, thank you so much for literally de-stressing my whole week. You just earned a sub, like and a pin on my bookmark bar
I see Shaggy Dev in my feed, and I click. Your tutorials are still some of my favorite on RU-vid! Especially love some of your more technical videos! Keep doing what you do dude!
I was breaking my head for a solid hour or two around this trying to interpolate slider ratio to decibel value, I think godot cannot work with these long log numbers (or I'm too dumb to work with logs). Then I found your video and almost had a stroke when I saw that db_to_linear()... THANK YOU SO MUCH !!! for my own knowledge is there something theoretically wrong with this ? : var ratio = inverse_lerp( pow(10, min_db), pow(10, max_db), pow(10, target_db))
Hi, I can't able to customise the sliders, I used flatbox in style to customise but it didn't work only I can change grabber by using own texture, but slider is working fine thanks to this tutorial ❤
If the issue is that you can't see the bar when using a flat stylebox, try increasing the Content Margins of it. The sliders on their own don't have any width to show, but setting the Content Margins will allow you to pad things out enough to see.
Go to Editor Settings (under the Editor menu at the top of Godot) > Text Editor > Completion and check "Add type hints". Makes things so much better! That and a few other editor setup items here if you're interested: shaggydev.com/2022/03/25/godot-code-editor-settings/
I created a volume slider and modified the db linearly, which as you mentioned sucks. linear_to_db is the key here to not have your volume slider be terrible.
Excellent stuff! Do you also have a video on how to create a pause menu and an options screen? Also how do I make it so that my options remain when I restart the game?
Afraid not, but I'll keep those ideas in mind for the future. If you want options to persist, you'll have to look into saving your options data and loading it back in when you start the game up. For options, I like to keep it simple and use ConfigFile: docs.godotengine.org/en/stable/classes/class_configfile.html
im currently using File as my Config file like saving a Name Profile, by creating a new 'File.new()' the name will be persistent.. i also applied it to change the value of the Translation, where a user presssed English, it will create a new file called 'lang.cfg' and by using the lang it will keep the settings persistent... I dont know how to use the Config
As someone who hasn't even touched audio yet in my game: How does godot handle having audio tracks set to sfx and master, or is the first one just always going to be everything regardless?
It's like any DAW/audio editor: you can create as many audio buses as you want, apply effects to each bus individually, send the audio from one bus to another, and in the end the Master receives the audio from all the buses. Godot's audio system is great.
That error means there's a missing ")" somewhere. Double check your code that you've got the same number of "(" as ")" and possibly check the code from my site or GitHub (both linked in the description) to double check everything.
Audio buses are global, so the volume can be controlled from anywhere in the application and all audio in the game will respect the changes in volume. If you're asking about how to make an options menu, or something like that, afraid that's out of the scope of this video.
i have a problem which i cant solve when i use a linear_to_db(AudioServer.get_bus_volume_db(music_bus_i)) its returning NaN or -inf (music_bus_i is just a variable storing index of music bus)
This error occured to me until I wrote the func _on_value_changed portion of the script which is normal. Do you still get the error once you have written the function a few lines below?
I'm not sure there's a straightforward way to do that. A tween could do it since you could throw the volume code in a method and use the `tween_method` call, so maybe you could sync the two together in some way?
May want to check your code against the sample project and double check everything. If you're still having problems, share the error here and I can try and take a stab at it.
Dude, the video is very concise, it's only 3 minutes long and says what it needs to say. Maybe The Shaggy Dev's teaching style is not for you. I suggest you check out a few different Godot youtubers until you find the ones that work best with your learning style. Happy trails!