1
Fork 0
mirror of https://github.com/RYGhub/the-cold-night.git synced 2024-11-22 12:44:20 +00:00

🔧 Mute music below a certain threshold

This commit is contained in:
Steffo 2022-04-03 01:56:32 +02:00
parent be3d7a9afc
commit f8ea6ebf0d
Signed by: steffo
GPG key ID: 6965406171929D01
4 changed files with 21 additions and 4 deletions

View file

@ -13,6 +13,10 @@ config_version=4
config/name="LD50" config/name="LD50"
run/main_scene="res://src/levels/Game.tscn" run/main_scene="res://src/levels/Game.tscn"
[audio]
default_bus_layout="res://src/default_bus_layout.tres"
[display] [display]
window/size/width=1280 window/size/width=1280

View file

@ -0,0 +1,9 @@
[gd_resource type="AudioBusLayout" format=2]
[resource]
bus/1/name = "Mute"
bus/1/solo = false
bus/1/mute = true
bus/1/bypass_fx = false
bus/1/volume_db = -80.0
bus/1/send = "Master"

View file

@ -24,17 +24,17 @@ fire_path = NodePath("../PhaseOneContainer/Fire")
[node name="Bell" type="AudioStreamPlayer" parent="PhaseOne/PhaseOneMusic"] [node name="Bell" type="AudioStreamPlayer" parent="PhaseOne/PhaseOneMusic"]
stream = ExtResource( 10 ) stream = ExtResource( 10 )
volume_db = -60.0 volume_db = -80.0
autoplay = true autoplay = true
[node name="Choir" type="AudioStreamPlayer" parent="PhaseOne/PhaseOneMusic"] [node name="Choir" type="AudioStreamPlayer" parent="PhaseOne/PhaseOneMusic"]
stream = ExtResource( 8 ) stream = ExtResource( 8 )
volume_db = -60.0 volume_db = -80.0
autoplay = true autoplay = true
[node name="Drum" type="AudioStreamPlayer" parent="PhaseOne/PhaseOneMusic"] [node name="Drum" type="AudioStreamPlayer" parent="PhaseOne/PhaseOneMusic"]
stream = ExtResource( 9 ) stream = ExtResource( 9 )
volume_db = -60.0 volume_db = -80.0
autoplay = true autoplay = true
[node name="PhaseOneContainer" type="Node2D" parent="PhaseOne"] [node name="PhaseOneContainer" type="Node2D" parent="PhaseOne"]

View file

@ -17,6 +17,10 @@ func _ready():
func _on_fire_intensity_changed(value): func _on_fire_intensity_changed(value):
$Choir.volume_db = (smoothstep(choir_min, choir_max, value) - 1) * 60 $Choir.volume_db = (smoothstep(choir_min, choir_max, value) - 1) * 60
$Choir.bus = "Master" if $Choir.volume_db > -60 else "Mute"
$Bell.volume_db = (smoothstep(bell_min, bell_max, value) - 1) * 60 $Bell.volume_db = (smoothstep(bell_min, bell_max, value) - 1) * 60
$Bell.bus = "Master" if $Choir.volume_db > -60 else "Mute"
$Drum.volume_db = (smoothstep(drum_min, drum_max, value) - 1) * 60 $Drum.volume_db = (smoothstep(drum_min, drum_max, value) - 1) * 60
pass $Drum.bus = "Master" if $Choir.volume_db > -60 else "Mute"