Тёмный
No video :(

Creating volume sliders in Godot 4 

The Shaggy Dev
Подписаться 19 тыс.
Просмотров 23 тыс.
50% 1

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...

Опубликовано:

 

23 авг 2024

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 58   
@Astro_retired
@Astro_retired Год назад
Damn, this is what a tutorial is supposed to look like. Short, informative and useful. Good job!
@blendingsentinel4797
@blendingsentinel4797 3 месяца назад
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
@Zyjin
@Zyjin Год назад
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!
@joelgomes1994
@joelgomes1994 Год назад
Me too, any video from him is pure gold.
@TheShaggyDev
@TheShaggyDev Год назад
Thank you! Means a lot :) Got some more technical videos in the works I think you'll like... if I can ever finish them, haha.
@Zyjin
@Zyjin Год назад
@@TheShaggyDev Awesome, glad to hear ;), one step at a time like everything else!
@itsmidge
@itsmidge 6 месяцев назад
Very helpful, informative, and concise. Helped me do what I was trying to do quickly, thank you!
@lxyacht
@lxyacht 4 месяца назад
fantastic video. I very much appreciated the explanation for converting linear to db. Really handy information.
@IcarusGravitas
@IcarusGravitas 2 месяца назад
On the next to last day of my first game jam. You are my HERO!
@brinley5642
@brinley5642 10 месяцев назад
Great tutorial! Short and sweet and good quality
@thirteen3678
@thirteen3678 25 дней назад
Thanks man, this really helped!
@Failfer
@Failfer 8 месяцев назад
Extrmely well done and informative thank you very much!
@3bears744
@3bears744 Месяц назад
Woot! Much easier than in unity IMO :D Great tutorial, I was able to get this running fast!
@MemasMaklas
@MemasMaklas 8 месяцев назад
Great tutorial! Exactly what I need! Thank you!
@rarefox
@rarefox 2 месяца назад
Great Video. Thanks.
@simonsaysgray
@simonsaysgray 11 месяцев назад
super video, thank you so much!
@SheepUndefined
@SheepUndefined Год назад
2:18 Without is literally just how Discord handles it.
@notreallycow
@notreallycow 11 месяцев назад
Thanks!! Firstly, I tried to make DB to linear conversion by my own ... But it gone very wrong.. My ears almost exploded.
@sheepcommander_
@sheepcommander_ 10 месяцев назад
THANK YOU
@Cacapoulette
@Cacapoulette 9 месяцев назад
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))
@fictionalaudio
@fictionalaudio 7 месяцев назад
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 ❤
@fictionalaudio
@fictionalaudio 7 месяцев назад
Any solution?
@TheShaggyDev
@TheShaggyDev 7 месяцев назад
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.
@fictionalaudio
@fictionalaudio 7 месяцев назад
@@TheShaggyDev Yes exactly, I can't see the bar when using flat stylebox, I will try this tomorrow, and thanks for instant reply 👍
@FaeKitty
@FaeKitty 10 месяцев назад
How about a tutorial on key bindings/input remapping in Godot 4?
@TheShaggyDev
@TheShaggyDev 10 месяцев назад
Not a bad suggestion! I'll keep that in mind as I plan out future videos.
@mcaped
@mcaped Год назад
off topic but how do you get you ready function to autofill with the void type. mine always autofills without a type and have to manually add it
@TheShaggyDev
@TheShaggyDev Год назад
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/
@mcaped
@mcaped Год назад
oh alright thanks a lot :D
@a.b.s-studios
@a.b.s-studios Год назад
@@TheShaggyDev thanks for this...
@Sil0_
@Sil0_ Год назад
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.
@Betegfos
@Betegfos Год назад
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?
@TheShaggyDev
@TheShaggyDev Год назад
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
@a.b.s-studios
@a.b.s-studios Год назад
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
@Kio_Kurashi
@Kio_Kurashi Год назад
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?
@joelgomes1994
@joelgomes1994 Год назад
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.
@superguerrerodragon
@superguerrerodragon 2 месяца назад
for some reason, on line 10 "value_changed.connect()" is not working for me. It says "not declared in the current Scope".
@XolarisYT
@XolarisYT 2 месяца назад
if the HSlider isn't the root node, then you need to specify the path, right before ".value_changed.connect()"
@TheLudicrousLuv
@TheLudicrousLuv 8 дней назад
@@XolarisYT and how would you do that?
@barbodrz8645
@barbodrz8645 4 месяца назад
good
@Kirbystarallies1
@Kirbystarallies1 7 месяцев назад
How do I fix the 9th and 10th line? It says "expected closing ")" after all arguments" and I typed it exactly like you did
@TheShaggyDev
@TheShaggyDev 7 месяцев назад
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.
@zenzo4506
@zenzo4506 7 месяцев назад
yeah but how do i have the slider in a menu but change the volume on the game scene but having the slider in a different scene
@TheShaggyDev
@TheShaggyDev 7 месяцев назад
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.
@rybomen_
@rybomen_ 5 месяцев назад
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)
@odachi4000
@odachi4000 8 месяцев назад
Line 9:Identifier "bus_value_changed" not declared in the current scope.
@TheShaggyDev
@TheShaggyDev 8 месяцев назад
Hmm, going to need a little bit more to help you, but sounds like a function hasn't been declared somewhere?
@casachezdoom2588
@casachezdoom2588 11 дней назад
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?
@kzuuuukyuu9317
@kzuuuukyuu9317 5 месяцев назад
How can you adjust audio using animation player?
@TheShaggyDev
@TheShaggyDev 4 месяца назад
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?
@definitelynotje
@definitelynotje 4 месяца назад
bro it has errors pls help
@TheShaggyDev
@TheShaggyDev 4 месяца назад
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.
@definitelynotje
@definitelynotje 4 месяца назад
@@TheShaggyDev i made it work bro, thanks for ur help i joined my first game jam and thanks to u
@TheShaggyDev
@TheShaggyDev 4 месяца назад
@@definitelynotje That's awesome! Good luck!!
@phonkmaster6051
@phonkmaster6051 2 месяца назад
Программировать научись сын сам знаешь кого
@saumonmeme7951
@saumonmeme7951 4 месяца назад
talked and talked, but said nothing
@casachezdoom2588
@casachezdoom2588 11 дней назад
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!
@kieranjames2344
@kieranjames2344 Месяц назад
Nice