extends Node # Add asset here var ChordPlayer: AudioStreamPlayer var ChordAudio: AudioStreamOggVorbis # Called when the node enters the scene tree for the first time. func _ready(): ChordPlayer = get_node("/root/Control/ChordPlayer") var resource_string = "res://audio/%s/%s-chord.ogg" % [self.name, self.name] var resource = load(resource_string) ChordAudio = resource self.pressed.connect(button_pressed) Global.loop_changed.connect(loop_changed) func button_pressed(): # Play chord ChordPlayer.stream = ChordAudio ChordPlayer.play() Global.chord_changed.emit(self.name) func loop_changed(state: bool): ChordAudio.loop = state if (!state): ChordPlayer.stop()