aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Lee <alee14498@protonmail.com>2021-11-26 09:22:33 -0500
committerAndrew Lee <alee14498@protonmail.com>2021-11-26 09:22:33 -0500
commit7f1cdc4663800fa9bdfddf888164826819d97e6e (patch)
tree1f2149dbe8e4712977c6f0f396ac25061f80dff2
parent6cb9ecfd6f6c863cd873a1b5e77972d542dfb1bc (diff)
downloaderable-godot-7f1cdc4663800fa9bdfddf888164826819d97e6e.tar.gz
erable-godot-7f1cdc4663800fa9bdfddf888164826819d97e6e.tar.bz2
erable-godot-7f1cdc4663800fa9bdfddf888164826819d97e6e.zip
Almost got music playing
-rw-r--r--App.gd14
-rw-r--r--App.tscn24
2 files changed, 28 insertions, 10 deletions
diff --git a/App.gd b/App.gd
index 1986e1d..0cab0dd 100644
--- a/App.gd
+++ b/App.gd
@@ -4,24 +4,28 @@ extends Control
# var a = 2
# var b = "text"
-var audio;
+var audioURL
# Called when the node enters the scene tree for the first time.
func _ready():
print("Erable is ready")
- pass # Replace with function body.
# Called every frame. 'delta' is the elapsed time since the previous frame.
#func _process(delta):
# pass
func _on_PlayButton_pressed():
- pass # Replace with function body.
+ print("Now playing music")
+ $AudioStreamPlayer.stream = load(audioURL)
+ $AudioStreamPlayer.play()
func _on_BrowseButton_pressed():
- $FileDialog.popup()
+ print("Opening file dialog")
+ $FileDialog.popup_centered()
func _on_FileDialog_file_selected(path):
print(path)
- audio = path
+ audioURL = "file://" + path
+func _on_AudioStreamPlayer_finished():
+ print("Music has finished playing")
diff --git a/App.tscn b/App.tscn
index 81ab525..2d8fa80 100644
--- a/App.tscn
+++ b/App.tscn
@@ -43,11 +43,14 @@ margin_left = 160.0
margin_top = 112.0
margin_right = 792.0
margin_bottom = 488.0
-window_title = "Open a File"
+window_title = "Open an audio file"
mode = 0
access = 2
-current_dir = "/"
-current_path = "/"
+current_dir = "/run/media/storage/user-files/Projects/Erable"
+current_path = "/run/media/storage/user-files/Projects/Erable/"
+__meta__ = {
+"_edit_use_anchors_": false
+}
[node name="Label" type="Label" parent="."]
anchor_right = 1.0
@@ -55,8 +58,9 @@ margin_left = -120.0
margin_top = 8.0
margin_right = -3.0
margin_bottom = 22.0
-text = "Erable v0.1
-Powered by Godot"
+text = "Erable 0.1 Beta
+Powered by Godot
+Made by Andrew Lee"
align = 2
valign = 2
__meta__ = {
@@ -65,6 +69,16 @@ __meta__ = {
[node name="AudioStreamPlayer" type="AudioStreamPlayer" parent="."]
+[node name="ProgressSlider" type="HSlider" parent="."]
+margin_left = 8.0
+margin_top = 94.0
+margin_right = 656.0
+margin_bottom = 118.0
+__meta__ = {
+"_edit_use_anchors_": false
+}
+
[connection signal="pressed" from="PlayButton" to="." method="_on_PlayButton_pressed"]
[connection signal="pressed" from="BrowseButton" to="." method="_on_BrowseButton_pressed"]
[connection signal="file_selected" from="FileDialog" to="." method="_on_FileDialog_file_selected"]
+[connection signal="finished" from="AudioStreamPlayer" to="." method="_on_AudioStreamPlayer_finished"]