add ai, photo_mode and radio

This commit was merged in pull request #11.
This commit is contained in:
2026-05-05 20:33:00 +00:00
parent 72d06560b1
commit 70d3dfe15c
66 changed files with 1531 additions and 0 deletions

View File

@@ -0,0 +1,35 @@
extends Node3D
@onready var radio: Radio = $%Radio
@onready var button_pause_resume: Button = $%Button_Pause_Resume
@onready var settings_menu: SettingsMenu = $%SettingsMenu
func _on_button_play_pressed() -> void:
if !radio.playing:
radio.play_track()
func _on_button_pause_pressed() -> void:
radio.toggle_pause()
if !button_pause_resume:
button_pause_resume = $%Button_Pause_Resume
if radio.stream_paused:
button_pause_resume.text = "Resume"
else:
button_pause_resume.text = "Pause"
func _on_button_stop_pressed() -> void:
radio.stop_radio()
func _on_button_next_pressed() -> void:
radio.next_track()
func _on_button_previous_pressed() -> void:
radio.prev_track()
func _on_button_settings_menu_pressed() -> void:
settings_menu.visible = !settings_menu.visible

View File

@@ -0,0 +1 @@
uid://ew4b78u5tkiu

View File

@@ -0,0 +1,104 @@
[gd_scene format=3 uid="uid://bdkdhn1oallke"]
[ext_resource type="PackedScene" uid="uid://cpeyt1dgrtglc" path="res://core/radio/radio.tscn" id="1_8yomj"]
[ext_resource type="Script" uid="uid://ew4b78u5tkiu" path="res://docs/gyms/radio/gym_radio.gd" id="1_h5r8c"]
[ext_resource type="AudioStream" uid="uid://70cc8she43re" path="res://docs/gyms/radio/lofi_01.ogg" id="3_ltpvc"]
[ext_resource type="PackedScene" uid="uid://caqf471x0kttc" path="res://core/audio/settings/settings_menu.tscn" id="4_8pw2j"]
[node name="GymRadio" type="Node3D" unique_id=204859062]
script = ExtResource("1_h5r8c")
[node name="Radio" parent="." unique_id=1234112225 instance=ExtResource("1_8yomj")]
unique_name_in_owner = true
playlist = Array[AudioStream]([ExtResource("3_ltpvc")])
[node name="Control" type="Control" parent="." unique_id=1232082176]
layout_mode = 3
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
[node name="SettingsMenu" parent="Control" unique_id=1639777294 instance=ExtResource("4_8pw2j")]
unique_name_in_owner = true
visible = false
layout_mode = 1
anchors_preset = 8
anchor_left = 0.5
anchor_top = 0.5
anchor_right = 0.5
anchor_bottom = 0.5
[node name="VBoxContainer2" type="VBoxContainer" parent="Control" unique_id=2092627240]
layout_mode = 1
anchors_preset = 9
anchor_bottom = 1.0
offset_right = 229.0
grow_vertical = 2
[node name="VBoxContainer" type="VBoxContainer" parent="Control/VBoxContainer2" unique_id=2097365775]
layout_mode = 2
[node name="Button_Play" type="Button" parent="Control/VBoxContainer2/VBoxContainer" unique_id=1422696340]
layout_mode = 2
text = "Play"
[node name="Button_Pause_Resume" type="Button" parent="Control/VBoxContainer2/VBoxContainer" unique_id=2016690081]
unique_name_in_owner = true
layout_mode = 2
text = "Pause"
[node name="Button_Stop" type="Button" parent="Control/VBoxContainer2/VBoxContainer" unique_id=61861870]
layout_mode = 2
text = "Stop"
[node name="Button_Next" type="Button" parent="Control/VBoxContainer2/VBoxContainer" unique_id=957606385]
layout_mode = 2
text = "Next"
[node name="Button_Previous" type="Button" parent="Control/VBoxContainer2/VBoxContainer" unique_id=929072518]
layout_mode = 2
text = "Previous"
[node name="Button_SettingsMenu" type="Button" parent="Control/VBoxContainer2/VBoxContainer" unique_id=431867154]
layout_mode = 2
text = "SettingsMenu"
[node name="PanelContainer" type="PanelContainer" parent="Control/VBoxContainer2" unique_id=1558442050]
layout_mode = 2
size_flags_vertical = 3
[node name="ScrollContainer" type="ScrollContainer" parent="Control/VBoxContainer2/PanelContainer" unique_id=7789304]
layout_mode = 2
[node name="Label" type="Label" parent="Control/VBoxContainer2/PanelContainer/ScrollContainer" unique_id=2043293564]
custom_minimum_size = Vector2(1, 1)
layout_mode = 2
size_flags_horizontal = 3
size_flags_vertical = 1
text = "System Logic:
- The system is an extension of AudioStreamPlayer designed to manage sequential audio playback.
- It automatically triggers the next track in the sequence when the current one finishes via the finished signal.
Core Functionality:
- Playlist Management: Stores a list of AudioStream resources and tracks the current song index.
- Track Navigation: Allows cycling forward and backward through the playlist with index wrapping (loops back to start/end).
- Playback Control: Supports jumping to specific tracks, toggling the pause state, and stopping the stream.
- Audio Settings: If the Music bus exists, the Settings menu can be used to test and adjust playback volume.
Key Methods:
- play_track: Loads a specific stream from the playlist and begins playback.
- next_track / prev_track: Increments or decrements the index to navigate the playlist.
- toggle_pause: Resumes or pauses the current stream without resetting its position.
Adjustable Parameters:
- Playlist: An Array in the inspector where you can assign one or more AudioStream resources."
autowrap_mode = 2
[connection signal="pressed" from="Control/VBoxContainer2/VBoxContainer/Button_Play" to="." method="_on_button_play_pressed"]
[connection signal="pressed" from="Control/VBoxContainer2/VBoxContainer/Button_Pause_Resume" to="." method="_on_button_pause_pressed"]
[connection signal="pressed" from="Control/VBoxContainer2/VBoxContainer/Button_Stop" to="." method="_on_button_stop_pressed"]
[connection signal="pressed" from="Control/VBoxContainer2/VBoxContainer/Button_Next" to="." method="_on_button_next_pressed"]
[connection signal="pressed" from="Control/VBoxContainer2/VBoxContainer/Button_Previous" to="." method="_on_button_previous_pressed"]
[connection signal="pressed" from="Control/VBoxContainer2/VBoxContainer/Button_SettingsMenu" to="." method="_on_button_settings_menu_pressed"]

BIN
docs/gyms/radio/lofi_01.ogg Normal file

Binary file not shown.

View File

@@ -0,0 +1,19 @@
[remap]
importer="oggvorbisstr"
type="AudioStreamOggVorbis"
uid="uid://70cc8she43re"
path="res://.godot/imported/lofi_01.ogg-0aacd597266806080412021811923091.oggvorbisstr"
[deps]
source_file="res://docs/gyms/radio/lofi_01.ogg"
dest_files=["res://.godot/imported/lofi_01.ogg-0aacd597266806080412021811923091.oggvorbisstr"]
[params]
loop=false
loop_offset=0
bpm=0
beat_count=0
bar_beats=4