21 lines
552 B
GDScript
21 lines
552 B
GDScript
extends Node
|
|
|
|
var NotePlayer: AudioStreamPlayer
|
|
var NoteAudio: AudioStreamOggVorbis
|
|
|
|
# Called when the node enters the scene tree for the first time.
|
|
func _ready():
|
|
NotePlayer = get_node("/root/Control/NotePlayer")
|
|
Global.chord_changed.connect(chord_changed)
|
|
self.pressed.connect(button_pressed)
|
|
|
|
func button_pressed():
|
|
# Play chord
|
|
NotePlayer.stream = NoteAudio
|
|
NotePlayer.play()
|
|
|
|
func chord_changed(chord):
|
|
var resource_string = "res://audio/%s/%s%s.ogg" % [chord, chord, self.name]
|
|
var resource = load(resource_string)
|
|
NoteAudio = resource
|