-
-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ce04fc3
commit e669cac
Showing
12 changed files
with
113 additions
and
61 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
extends Node | ||
|
||
|
||
const AudioPlayerPool = preload("res://addons/sound_manager/audio_player_pool.gd") | ||
|
||
|
||
onready var audio_player_pool := AudioPlayerPool.new(["Sounds", "sounds", "SFX"]) | ||
onready var ui_audio_player_pool := AudioPlayerPool.new(["UI", "Interface", "interface", "Sounds", "sounds", "SFX"]) | ||
|
||
|
||
var bus: String = "Master" setget set_bus | ||
var ui_bus: String = "Master" setget set_ui_bus | ||
|
||
|
||
func _ready() -> void: | ||
add_child(audio_player_pool) | ||
|
||
bus = audio_player_pool.bus | ||
ui_bus = ui_audio_player_pool.bus | ||
|
||
|
||
func play(resource: AudioStream, override_bus: String = "") -> AudioStreamPlayer: | ||
return audio_player_pool.play(resource, override_bus) | ||
|
||
|
||
func play_ui(resource: AudioStream, override_bus: String = "") -> AudioStreamPlayer: | ||
return ui_audio_player_pool.play(resource, override_bus) | ||
|
||
|
||
### Setget | ||
|
||
|
||
func set_bus(value: String) -> void: | ||
audio_player_pool.bus = value | ||
|
||
|
||
func set_ui_bus(value: String) -> void: | ||
ui_audio_player_pool.bus = value |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
# Music | ||
|
||
- **`SoundManager.play_music(resource: AudioStream, crossfade_duration: int = 0, override_bus: String = "")`** | ||
|
||
Play some music with an optional fade in (or crossfade if something is already playing) and optionally specify which audio bus to use. | ||
|
||
This returns the `AudioStreamPlayer` that is playing the sound so you can make any other adjustments you need. | ||
|
||
- **`SoundManager.stop_music(fade_out_duration: int = 0)`** | ||
|
||
Stop any music that's playing with an optional fade out. | ||
|
||
- **`SoundManager.set_default_music_bus(bus: String)`** | ||
|
||
Sets the default audio bus used for playing music. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
# Sound effects | ||
|
||
Playing sound effects is broken up into playing general sounds (ie. in the game world) and playing user interface sounds. The reasoning behind this is that you might have your audio buses set up to include local modifiers (eg. being underwater) for local sounds where you wouldn't want your UI sounds being affected. | ||
|
||
- **`SoundManager.play_sound(resource: AudioStream, override_bus: String = "")`** | ||
|
||
Play an audio stream intended for an action within the game world. Optionally specify which audio bus you want to use for this sound. | ||
|
||
This returns the `AudioStreamPlayer` that is playing the sound so you can adjust the pitch or volume. | ||
|
||
- **`SoundManager.play_ui_sound(resource: AudioStream, override_bus: String = "")`** | ||
|
||
Play an audio stream intended for the user interface. Optionally specify which audio bus you want to use for this sound. | ||
|
||
This returns the `AudioStreamPlayer` that is playing the sound so you can adjust the pitch or volume. | ||
|
||
- **`SoundManager.set_default_sound_bus(bus: String)`** | ||
|
||
Sets the default audio bus used for playing sounds. | ||
|
||
- **`SoundManager.set_default_ui_sound_bus(bus: String)`** | ||
|
||
Sets the default audio bus used for playing UI sounds. |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
File renamed without changes
This file was deleted.
Oops, something went wrong.