#AudioManager
1 messages · Page 1 of 1 (latest)
I personally have written a small AudioManager that manages the volume settings and typical sound effects. Level music "subscribes" to it so I can easily blend it over
I usually have my managers as a child node of my main GameManager which is a singleton, so I only need one and can access all managers (audio, level transition etc)
@cursive musk So your singleton is not added to the autoload? Is there a specific reason for this? How do you achieve access in all scenes that are not directly together?
I believe I'm doing it a bit different because I work with C#. I have my GameManager as an Autoload scene with a script that defines the GameManager Singleton.
Then I can use it like GameManager.Instance.LevelManager.TransitionToScene('scene.tscn');
I would say having a global audio manager being a good idea depends on your game
If you only ever need to play sounds non-positionally it could be a good idea to make one
In my case I only have an autoload for a music player, since usually multiple music tracks do not play at the same time
while having separate audio systems that can get created for a player character and so on
Definitely a good idea for things like UI sounds
Do you also have a global settings singleton or are you storing audio settings specifically in the audio manager? I would imagine audio settings would be something you put in a settings singleton, then listen for changes in the audio maanager to those fields.
I have one settings manager that applies the audio settings to the AudioManager, this way the settings can be previewed without written to the settings file.
This is also how I do it personally
I like to have a function for play(sound_name, position) and have a player be instantiated and freed automatically
I get a lot of use out of it for fast lazy implementation
Thank you guys. If someone can share his manager or at least basic part of it, It help me a lot.
Singletons are great for audio for reusing audio streamers... but it's not the performance I care about, it's about knowing when these streamers were previously used because audio overlapping is a serious problem and if not managed can create some ear piercing sounds when too much is happening. So, having them managed in a singleton allows you to keep track of when these streamers were played previously.
Godot actually does have options per streamer to prevent such overlap, but you can always handle it more discreetly yourself.
Using an autoload/singleton music manager as well primarily so the music is consistent and keeps playing between scenes.
Also in my case the music is adaptive to the gameplay so theres 2 Audioplayers that will play prerendered music samples with one volume off the other on, so I can tween between them (at the beat cue) so that the transition is smooth and happens over some time.
I guess similar as to @cursive musk
For audio effects I have another Audio Manager where you can just queue/register a sound effect to which then has a pool of audio players to use, but I dont have to worry about the specifics.
If you want "nice" transitions I ported StefanoPizzolato's GodotWebAudioEngine to godot4 btw. Its like an FMOD light for Godot: https://github.com/graphific/GodotWebAudioEngine letting you transition between music samples only on the beat, or at the end of a bar
Adding to these answers, I think having an autoload/singleton for music is very common. I've seen it in other projects, a well-known template for game jams, and I wrote my own simplified audio/music manager singleton that I use for dynamic music
Actually just saw this which makes all of the transition stuff you'd build yourself or use FMOD or WWISE for possible with 3 new audiostreams in godot 4.3: https://github.com/godotengine/godot/pull/64488 
Might not include the switching on the beat etc but is a good start of any adaptive audio system.