aboutsummaryrefslogtreecommitdiff
path: root/App.gd
diff options
context:
space:
mode:
authorAndrew Lee <alee14498@protonmail.com>2023-08-07 13:37:19 -0400
committerAndrew Lee <alee14498@protonmail.com>2023-08-07 13:37:19 -0400
commit201a0de90faabe68f1eb701b67af30a4d11fa32b (patch)
treec396bec9a496876acc9a5b7bec55912a32c191c1 /App.gd
parent7f1cdc4663800fa9bdfddf888164826819d97e6e (diff)
downloaderable-godot-master.tar.gz
erable-godot-master.tar.bz2
erable-godot-master.zip
Public archiveHEADmaster
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")
+
+