diff --git a/src/levels/PhaseOneMusic.gd b/src/levels/PhaseOneMusic.gd index 10d8f4d..490d7a8 100644 --- a/src/levels/PhaseOneMusic.gd +++ b/src/levels/PhaseOneMusic.gd @@ -7,26 +7,28 @@ export var bell_min: float = 0.20 export var bell_max: float = 0.60 export var drum_min: float = 0.40 export var drum_max: float = 0.80 -export var muted: bool = false setget set_mute +export var muted: bool setget set_mute, get_mute func _on_Fire_intensity_changed(value): $Choir.volume_db = (smoothstep(choir_min, choir_max, value) - 1) * 60 - $Choir.bus = "Master" if not muted and $Choir.volume_db > -60 else "Mute" + $Choir.bus = "Master" if $Choir.volume_db > -60 else "Mute" $Bell.volume_db = (smoothstep(bell_min, bell_max, value) - 1) * 60 - $Bell.bus = "Master" if not muted and $Bell.volume_db > -60 else "Mute" + $Bell.bus = "Master" if $Bell.volume_db > -60 else "Mute" $Drum.volume_db = (smoothstep(drum_min, drum_max, value) - 1) * 60 - $Drum.bus = "Master" if not muted and $Drum.volume_db > -60 else "Mute" + $Drum.bus = "Master" if $Drum.volume_db > -60 else "Mute" func set_mute(value): - muted = value - $Choir.bus = "Master" if not muted and $Choir.volume_db > -60 else "Mute" - $Bell.bus = "Master" if not muted and $Bell.volume_db > -60 else "Mute" - $Drum.bus = "Master" if not muted and $Drum.volume_db > -60 else "Mute" + var index = AudioServer.get_bus_index("Master") + AudioServer.set_bus_mute(index, value) + +func get_mute(): + var index = AudioServer.get_bus_index("Master") + return AudioServer.is_bus_mute(index) func _on_MuteButton_pressed(): - set_mute(not muted) + set_mute(not get_mute())