aboutsummaryrefslogtreecommitdiff
path: root/App.gd
diff options
context:
space:
mode:
Diffstat (limited to 'App.gd')
-rw-r--r--App.gd21
1 files changed, 16 insertions, 5 deletions
diff --git a/App.gd b/App.gd
index 0cab0dd..ea1011a 100644
--- a/App.gd
+++ b/App.gd
@@ -5,6 +5,7 @@ extends Control
# var b = "text"
var audioURL
+var audioFile = File.new()
# Called when the node enters the scene tree for the first time.
func _ready():
@@ -15,17 +16,27 @@ func _ready():
# pass
func _on_PlayButton_pressed():
- print("Now playing music")
- $AudioStreamPlayer.stream = load(audioURL)
- $AudioStreamPlayer.play()
+ 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):
- print(path)
- audioURL = "file://" + path
+ audioFile.open(path, File.READ).get_as_text().close()
+ $AudioStreamPlayer.stream = load(audioFile)
+
func _on_AudioStreamPlayer_finished():
print("Music has finished playing")
+
+