extends Node2D var pid_of_dlserver = 0 var capture_device = "Default" var playback_device = "Default" var audio_delay_seconds = 0.0 var config_loaded = false var config = ConfigFile.new() # Declare member variables here. Examples: # var a = 2 # var b = "text" # Called when the node enters the scene tree for the first time. func _ready(): pass # Replace with function body. # Called every frame. 'delta' is the elapsed time since the previous frame. #func _process(delta): # pass func _notification(what): if what == MainLoop.NOTIFICATION_WM_QUIT_REQUEST: print("Killing dl-server, pid ",pid_of_dlserver) OS.kill(pid_of_dlserver) get_tree().quit() # default behavior func loadConfig(): if !config_loaded: config.load("user://settings.cfg") if not config.has_section_key("audio","playback_device"): config.set_value("audio","playback_device","Default") playback_device = config.get_value("audio","playback_device","Default") AudioServer.set_device(playback_device) if not config.has_section_key("audio","capture_device"): config.set_value("audio","capture_device","Default") capture_device = config.get_value("audio","capture_device","Default") AudioServer.capture_set_device(capture_device) if not config.has_section_key("audio","audio_delay_seconds"): config.set_value("audio","audio_delay_seconds",0.0) audio_delay_seconds = config.get_value("audio","audio_delay_seconds",0.0) config.save("user://settings.cfg") config_loaded = true func saveConfig(): config.load("user://settings.cfg") config.set_value("audio","playback_device",playback_device) config.set_value("audio","capture_device",capture_device) config.set_value("audio","audio_delay_seconds",audio_delay_seconds) config.save("user://settings.cfg")