Code Monkey home page Code Monkey logo

godot_sound_manager's Introduction

Nathan Hoad

The code that powers https://nathanhoad.net

Writing posts

Create a folder in the /posts directory and name it what your slug/url is going to be (eg. posts/just-start-now).

Now create a .text file of the same name as the folder and put it in that folder (eg. posts/just-start-now/just-start-now.text).

The first lines of the post will be its title, followed by a list of its headers:

# Just start now

- published: 2018-03-06
- tags: games, painting
- share: some-image.jpg

There is a long road between a dream and reality. The path is not well worn and sometimes hard to see.

...

Developing

To run the server just do npm start. Posts will be compiled statically and then a simple asset server will spin up.

In development mode (NODE_ENV !== 'production') the server will watch for changes to posts and templates and recompile/restart when needed.

godot_sound_manager's People

Contributors

daelonsuzuka avatar dicemaster5 avatar dillyo09 avatar geowarin avatar jaybaird avatar minoqi avatar nathanhoad avatar nbumgardner avatar shomykohai avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

godot_sound_manager's Issues

Continuous sounds

Is your feature request related to a problem? Please describe.
A way to play a looping sound that needs to be turned on or off. Examples include footsteps, rain, whooshing sounds, water ambience, jetpacks and rockets. For all of these, there is a looping sound that in some cases should be on, and in others should fade out.

Describe the solution you'd like
A function to ‘set_continuous_sound_active’, which takes in the sound, a bool and optionally a fade time. When set to true, that sound will fade in. When set to false, the sound will fade out. Multiple different continuous sounds can be played at the same time. In the process function I could have something like the following:
SoundManager.set_continuous_sound_active(footsteps, player.is_walking, 0.1)

Describe alternatives you've considered
Tried using the music system to handle these continuous sounds, however it seems only one music track can be running at once. If music were used, this would play on the wrong bus by default and would require a line to turn it on and another to turn it off (rather than a single line that takes in a bool).

How to resume the music

Is there a way to stop/resume the music without relying on godot pause? I mean the SoundManager.music_process_mode you mention. If not, I think it would be a good addition in order to have more control over the music.

Thanks in advance!

[Bugs] Set volume too early crash the game

I make a data.gd file (that save and load the game settings) and set it to autoload:

const _DATA_PATH := "user://data.cfg"


var music_volume := 100:
	get:
		return music_volume
	set(value):
		music_volume = value
		
		SoundManager.set_music_volume(float(value) / 100)

var sound_volume := 100:
	get:
		return sound_volume
	set(value):
		sound_volume = value
		
		SoundManager.set_sound_volume(float(value) / 100)


var _data = ConfigFile.new()


func _ready():
	var err := _data.load(_DATA_PATH)
	
	if err != OK:
		return
	
	music_volume = _data.get_value("settings", "music_volume", music_volume)
	sound_volume = _data.get_value("settings", "sound_volume", sound_volume)

When start the game, it returned this error:

Invalid get index 'bus' (on base: 'Nil').

image

[Bugs] `SoundManager.set_sound_volume` also `SoundManager.set_music_volume`

vid.mp4

Note Listen to the music in the video

The code:

I make a data.gd file (that save and load the game settings) and set it to autoload (name Data):

var music_volume := 100:
	get:
		return music_volume
	set(value):
		music_volume = value
		
		SoundManager.set_music_volume(float(value) / 100)

var sound_volume := 100:
	get:
		return sound_volume
	set(value):
		sound_volume = value
		
		SoundManager.set_sound_volume(float(value) / 100)

In options_sheet.gd:

func _on_spin_box_music_value_changed(value: float) -> void:
	Data.music_volume = int(value)
	printt(Data.music_volume, Data.sound_volume)


func _on_spin_box_sound_value_changed(value: float) -> void:
	Data.sound_volume = int(value)
	printt(Data.music_volume, Data.sound_volume)

Emit signal when playback of SFX ends?

Is your feature request related to a problem? Please describe.
I want to playback random sound effects in a folder and start a timer after the sound effect ends. They are variable length so I can't just add that to the timer as a buffer. I want to be able to play sound effects at a set interval.

Describe the solution you'd like
There's a finished signal for AudioStreamPlayer, even being able to tap into that would work

Describe alternatives you've considered
Setting a longer timer, it's what I will do for now.

Support for AudioStreamRandomizer

Is your feature request related to a problem? Please describe.
The standard AudioStreamPlayer will play a different stream each time it plays when given an AudioStreamRandomizer. You can stop and start it multiple times in a row to get randomized streams. SoundManager does not not stop the current stream when treated similarly.

Describe the solution you'd like
I would like SoundManager to treat AudioStreamRandomizer as a special case, so that users can play the same AudioStreamRandomizer resource multiple times to get randomized results.

In particular, I think the combination of checking for currently playing resource and the crossfade timer make it hard to diagnose the problem for new users.

Describe alternatives you've considered
The user may wait longer than the crossfade timer between stop_music() and play_music(), and SoundManager will correctly pick up a randomized stream from AudioStreamRandomizer.

E.g. await get_tree().create_timer(0.2).timeout

Additional context
I'm new to the AudioStreamRandomizer resource and find it a bit limiting. I'm not sure if my difficulty here is my ignorance of SoundManager or the Randomizer. If you have best practices recommendations for a looping music player that randomly selects a new stream at the end of the previous stream, I'd love to learn about them!

Addon not working with Godot RC2 (Tween Interpolation)

I'm trying for the first time this addon and with Godot RC2 the function fade_volume when it gets called by play_music it does not work.
After looking at the code thanks to the error code and the Godot Docs, it seems that the method interpolate_property is not avaiable anymore.

Hope that you could fix it!

Images:
image
image

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.