aboutsummaryrefslogtreecommitdiff
path: root/game/src/MusicConductor
diff options
context:
space:
mode:
author Hop311 <hop3114@gmail.com>2023-05-26 00:54:58 +0200
committer Hop311 <hop3114@gmail.com>2023-05-26 00:54:58 +0200
commit1406d5e2e2af94995735592eab1bba1e14e9a163 (patch)
tree3e6e6c1983d42c3d067c851fa833400f942f835f /game/src/MusicConductor
parentba3e974f30b8a2e7611b753ddc274dec8ff28283 (diff)
Added requirement comments
Diffstat (limited to 'game/src/MusicConductor')
-rw-r--r--game/src/MusicConductor/MusicConductor.gd11
-rw-r--r--game/src/MusicConductor/MusicPlayer.gd5
2 files changed, 12 insertions, 4 deletions
diff --git a/game/src/MusicConductor/MusicConductor.gd b/game/src/MusicConductor/MusicConductor.gd
index 08fa86a..98dd0eb 100644
--- a/game/src/MusicConductor/MusicConductor.gd
+++ b/game/src/MusicConductor/MusicConductor.gd
@@ -1,6 +1,7 @@
extends Node
-# SS-67
+# REQUIREMENTS
+# * SS-67
@export_dir var music_directory : String
@export var first_song_name : String
@@ -41,12 +42,14 @@ func start_current_song() -> void:
$AudioStreamPlayer.stream = _available_songs[_selected_track].song_stream
$AudioStreamPlayer.play()
-# SS-70
+# REQUIREMENTS
+# * SS-70
func start_song_by_index(id: int) -> void:
_selected_track = id
start_current_song()
-# SS-69
+# REQUIREMENTS
+# * SS-69
func select_next_song() -> void:
_selected_track = (_selected_track + 1) % len(_available_songs)
start_current_song()
@@ -55,6 +58,8 @@ func select_previous_song() -> void:
_selected_track = (len(_available_songs) - 1) if (_selected_track == 0) else (_selected_track - 1)
start_current_song()
+# REQUIREMENTS
+# * SND-2
func _ready():
var dir = DirAccess.open(music_directory)
for fname in dir.get_files():
diff --git a/game/src/MusicConductor/MusicPlayer.gd b/game/src/MusicConductor/MusicPlayer.gd
index b775b84..47be158 100644
--- a/game/src/MusicConductor/MusicPlayer.gd
+++ b/game/src/MusicConductor/MusicPlayer.gd
@@ -41,8 +41,9 @@ func _on_previous_song_button_pressed():
_update_song_name_visual()
_update_play_pause_button()
+# REQUIREMENTS
+# * UIFUN-92
func _on_option_button_item_selected(index):
- # UIFUN-92
MusicConductor.start_song_by_index(index)
_update_song_name_visual()
_update_play_pause_button()
@@ -66,5 +67,7 @@ func _set_music_player_visible(is_player_visible : bool) -> void:
_play_pause_button.visible = is_player_visible
_next_song_button.visible = is_player_visible
+# REQUIREMENTS
+# * UIFUN-91
func _on_music_ui_visibility_button_pressed():
_set_music_player_visible(not MusicConductor.is_music_player_visible)