diff options
| author | Andrew Lee <alee14498@protonmail.com> | 2023-08-07 13:37:19 -0400 |
|---|---|---|
| committer | Andrew Lee <alee14498@protonmail.com> | 2023-08-07 13:37:19 -0400 |
| commit | 201a0de90faabe68f1eb701b67af30a4d11fa32b (patch) | |
| tree | c396bec9a496876acc9a5b7bec55912a32c191c1 /App.gd | |
| parent | 7f1cdc4663800fa9bdfddf888164826819d97e6e (diff) | |
| download | erable-godot-master.tar.gz erable-godot-master.tar.bz2 erable-godot-master.zip | |
Diffstat (limited to 'App.gd')
| -rw-r--r-- | App.gd | 21 |
1 files changed, 16 insertions, 5 deletions
@@ -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") + + |
