aboutsummaryrefslogtreecommitdiff
path: root/App.gd
blob: ea1011ad2d710b88072ff1541b901976e90eef0a (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
extends Control

# Declare member variables here. Examples:
# var a = 2
# var b = "text"

var audioURL
var audioFile = File.new()

# Called when the node enters the scene tree for the first time.
func _ready():
	print("Erable is ready")

# Called every frame. 'delta' is the elapsed time since the previous frame.
#func _process(delta):
#	pass

func _on_PlayButton_pressed():
	if !audioURL == null:
		$AudioStreamPlayer.play()
		print("Now playing " + audioURL)
	else:
		print("No music detected")
	
func _on_StopButton_pressed():
	pass # Replace with function body.


func _on_BrowseButton_pressed():
	print("Opening file dialog")
#	$FileDialog.filters
	$FileDialog.popup_centered()

func _on_FileDialog_file_selected(path):
	audioFile.open(path, File.READ).get_as_text().close()
	$AudioStreamPlayer.stream = load(audioFile)
	

func _on_AudioStreamPlayer_finished():
	print("Music has finished playing")