diff options
| author | BigBrotherNii <nicochr1004@gmail.com> | 2024-07-25 15:10:40 +0200 | 
|---|---|---|
| committer | BigBrotherNii <nicochr1004@gmail.com> | 2024-07-25 15:10:40 +0200 | 
| commit | d292432a6b09a9d19659784d67faa410dac3ee18 (patch) | |
| tree | 740dd2f47bedd85abb8fa93f5c6839e3d7026790 | |
| parent | a01186bcaa702f6dc5cdd3254c0ab95eabaef1d7 (diff) | |
| download | hurrycurry-d292432a6b09a9d19659784d67faa410dac3ee18.tar hurrycurry-d292432a6b09a9d19659784d67faa410dac3ee18.tar.bz2 hurrycurry-d292432a6b09a9d19659784d67faa410dac3ee18.tar.zst | |
separated audio busses
| -rw-r--r-- | client/audio/sound.gd | 8 | ||||
| -rw-r--r-- | client/audio/sound.tscn | 4 | ||||
| -rw-r--r-- | client/default_bus_layout.tres | 15 | ||||
| -rw-r--r-- | client/global.gd | 10 | 
4 files changed, 30 insertions, 7 deletions
| diff --git a/client/audio/sound.gd b/client/audio/sound.gd index af23f0cd..90f1ef1e 100644 --- a/client/audio/sound.gd +++ b/client/audio/sound.gd @@ -34,13 +34,13 @@ func play_music(music : String): # If music == "stop", this stops all music  	else:  		music_node.get_node(music).play() -func set_volume(value:float): -	AudioServer.set_bus_volume_db(0, value) +func set_volume(bus : int, value:float): +	AudioServer.set_bus_volume_db(bus, value)  	if value == -30: -		AudioServer.set_bus_mute(0, true) +		AudioServer.set_bus_mute(bus, true)  	else: -		AudioServer.set_bus_mute(0, false) +		AudioServer.set_bus_mute(bus, false)  func play_click():  	click_sound.play() diff --git a/client/audio/sound.tscn b/client/audio/sound.tscn index f80a1927..5fd759ce 100644 --- a/client/audio/sound.tscn +++ b/client/audio/sound.tscn @@ -11,14 +11,18 @@ script = ExtResource("1_b0qb1")  [node name="Click" type="AudioStreamPlayer" parent="UI"]  stream = ExtResource("2_mhrce") +bus = &"SFX"  [node name="Hover" type="AudioStreamPlayer" parent="UI"]  stream = ExtResource("3_qft2s") +bus = &"SFX"  [node name="Music" type="Node" parent="."]  [node name="MainMenu" type="AudioStreamPlayer" parent="Music"]  volume_db = 1.0 +bus = &"Music"  [node name="Lobby" type="AudioStreamPlayer" parent="Music"]  volume_db = -3.5 +bus = &"Music" diff --git a/client/default_bus_layout.tres b/client/default_bus_layout.tres new file mode 100644 index 00000000..b578bec4 --- /dev/null +++ b/client/default_bus_layout.tres @@ -0,0 +1,15 @@ +[gd_resource type="AudioBusLayout" format=3 uid="uid://cco0uysin1okg"] + +[resource] +bus/1/name = &"Music" +bus/1/solo = false +bus/1/mute = false +bus/1/bypass_fx = false +bus/1/volume_db = 0.0 +bus/1/send = &"Master" +bus/2/name = &"SFX" +bus/2/solo = false +bus/2/mute = false +bus/2/bypass_fx = false +bus/2/volume_db = 0.0 +bus/2/send = &"Master" diff --git a/client/global.gd b/client/global.gd index 53049823..8849c4d6 100644 --- a/client/global.gd +++ b/client/global.gd @@ -41,7 +41,9 @@ var using_joypad := false  var default_settings := {  	"language": DropdownSetting.new(tr("Language"), 0, languages), -	"master_volume": RangeSetting.new(tr("Volume"), 0, -30, 0), +	"master_volume": RangeSetting.new(tr("Master Volume"), 0, -30, 0), +	"muisc_volume": RangeSetting.new(tr("Music Volume"), 0, -30, 0), +	"sfx_volume": RangeSetting.new(tr("SFX Volume"), 0, -30, 0),  	"fullscreen": DropdownSetting.new(tr("Fullscreen"), 0, [tr("Keep"), tr("Always"), tr("Never")]),  	"touch_controls": ToggleSetting.new(tr("Enable touch screen controls"), DisplayServer.is_touchscreen_available()),  	"interpolate_camera_rotation": ToggleSetting.new(tr("Interpolate the camera rotation"), true), @@ -148,8 +150,10 @@ func apply_settings():  		for k in profile["hints"].keys():  			set_hint(k, false) -	# Sets Volume -	Sound.set_volume(get_setting("master_volume")) +	# Sets all volumes +	Sound.set_volume(0, get_setting("master_volume")) +	Sound.set_volume(1, get_setting("music_volume")) +	Sound.set_volume(2, get_setting("sfx_volume"))  	emit_signal("settings_changed") | 
