extends AudioStreamPlayer

var mute_status : bool = false

var main_theme : AudioStreamOGGVorbis = preload("res://Audio/Music/SpaceMainTheme_r1_session.ogg")
var combat_theme : AudioStreamOGGVorbis = preload("res://Audio/Music/CombatThemeLBRY_r1_session.ogg")

var music_dict = {"main" : main_theme, "combat" : combat_theme}

func switch_theme(name : String) -> void:
	if name in music_dict.keys():
		stream = music_dict[name]
	else:
		get_parent().console_print("Could not find music of name, " + name)
	playing = true

func _process(delta : float) -> void:
	if Input.is_action_just_pressed("mute") :
		if mute_status:
			AudioServer.set_bus_mute(AudioServer.get_bus_index("Master"), false)
		else:
			AudioServer.set_bus_mute(AudioServer.get_bus_index("Master"), true)
		mute_status = !mute_status
	
