extends Node

# load data from the file
var config = ConfigFile.new()
var err = config.load("config.txt")

# Called when the node enters the scene tree for the first time.
func _ready():
	# if there is no config file, create it with default values
	if err != OK:
		config.set_value("spin", "spin_channel_1", 2)
		config.set_value("spin", "spin_note_1", 10)
		config.set_value("spin", "spin_channel_2", 2)
		config.set_value("spin", "spin_note_2", 9)
		config.set_value("jog", "jog_channel", 2)
		config.set_value("jog", "jog_note", 8)
		config.set_value("beat", "beat_channel", 3)
		config.set_value("beat", "beat_note", 8)
		config.set_value("inverted", "is_inverted", true)
		config.save("config.txt")

# fetch the config data
var spin_channel_1: int = config.get_value("spin", "spin_channel_1", 2)
var spin_note_1: int = config.get_value("spin", "spin_note_1", 10)
var spin_channel_2: int = config.get_value("spin", "spin_channel_2", 2)
var spin_note_2: int = config.get_value("spin", "spin_note_2", 9)
var jog_channel: int = config.get_value("jog", "jog_channel", 2)
var jog_note: int = config.get_value("jog", "jog_note", 8)
var beat_channel: int = config.get_value("beat", "beat_channel", 3)
var beat_note: int = config.get_value("beat", "beat_note", 8)
var is_inverted: bool = config.get_value("inverted", "is_inverted", true)

func _process(_delta):
	pass
