add radio
This commit is contained in:
BIN
docs/museums/radio/lofi_01.ogg
Normal file
BIN
docs/museums/radio/lofi_01.ogg
Normal file
Binary file not shown.
19
docs/museums/radio/lofi_01.ogg.import
Normal file
19
docs/museums/radio/lofi_01.ogg.import
Normal file
@@ -0,0 +1,19 @@
|
||||
[remap]
|
||||
|
||||
importer="oggvorbisstr"
|
||||
type="AudioStreamOggVorbis"
|
||||
uid="uid://70cc8she43re"
|
||||
path="res://.godot/imported/lofi_01.ogg-0676fd488ea21d2d6695955666f7f91f.oggvorbisstr"
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://docs/museums/radio/lofi_01.ogg"
|
||||
dest_files=["res://.godot/imported/lofi_01.ogg-0676fd488ea21d2d6695955666f7f91f.oggvorbisstr"]
|
||||
|
||||
[params]
|
||||
|
||||
loop=false
|
||||
loop_offset=0
|
||||
bpm=0
|
||||
beat_count=0
|
||||
bar_beats=4
|
||||
28
docs/museums/radio/museum_radio.gd
Normal file
28
docs/museums/radio/museum_radio.gd
Normal file
@@ -0,0 +1,28 @@
|
||||
extends Node3D
|
||||
|
||||
@onready var radio: Radio = $Radio
|
||||
|
||||
|
||||
func _on_button_play_pressed() -> void:
|
||||
if !radio.playing:
|
||||
radio.play_track()
|
||||
|
||||
|
||||
func _on_button_pause_pressed() -> void:
|
||||
radio.toggle_pause()
|
||||
if radio.stream_paused:
|
||||
$Control/MarginContainer/VBoxContainer/Button_Pause_Resume.text = "Resume"
|
||||
else:
|
||||
$Control/MarginContainer/VBoxContainer/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()
|
||||
1
docs/museums/radio/museum_radio.gd.uid
Normal file
1
docs/museums/radio/museum_radio.gd.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://ew4b78u5tkiu
|
||||
57
docs/museums/radio/museum_radio.tscn
Normal file
57
docs/museums/radio/museum_radio.tscn
Normal file
@@ -0,0 +1,57 @@
|
||||
[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/museums/radio/museum_radio.gd" id="1_h5r8c"]
|
||||
[ext_resource type="AudioStream" uid="uid://70cc8she43re" path="res://docs/museums/radio/lofi_01.ogg" id="3_ltpvc"]
|
||||
|
||||
[node name="MuseumRadio" type="Node3D" unique_id=204859062]
|
||||
script = ExtResource("1_h5r8c")
|
||||
|
||||
[node name="Radio" parent="." unique_id=1234112225 instance=ExtResource("1_8yomj")]
|
||||
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="MarginContainer" type="MarginContainer" parent="Control" unique_id=2102712226]
|
||||
layout_mode = 0
|
||||
offset_right = 40.0
|
||||
offset_bottom = 40.0
|
||||
theme_override_constants/margin_left = 12
|
||||
theme_override_constants/margin_top = 12
|
||||
theme_override_constants/margin_right = 12
|
||||
theme_override_constants/margin_bottom = 12
|
||||
|
||||
[node name="VBoxContainer" type="VBoxContainer" parent="Control/MarginContainer" unique_id=2097365775]
|
||||
layout_mode = 2
|
||||
|
||||
[node name="Button_Play" type="Button" parent="Control/MarginContainer/VBoxContainer" unique_id=1422696340]
|
||||
layout_mode = 2
|
||||
text = "Play"
|
||||
|
||||
[node name="Button_Pause_Resume" type="Button" parent="Control/MarginContainer/VBoxContainer" unique_id=2016690081]
|
||||
layout_mode = 2
|
||||
text = "Pause"
|
||||
|
||||
[node name="Button_Stop" type="Button" parent="Control/MarginContainer/VBoxContainer" unique_id=61861870]
|
||||
layout_mode = 2
|
||||
text = "Stop"
|
||||
|
||||
[node name="Button_Next" type="Button" parent="Control/MarginContainer/VBoxContainer" unique_id=957606385]
|
||||
layout_mode = 2
|
||||
text = "Next"
|
||||
|
||||
[node name="Button_Previous" type="Button" parent="Control/MarginContainer/VBoxContainer" unique_id=929072518]
|
||||
layout_mode = 2
|
||||
text = "Previous"
|
||||
|
||||
[connection signal="pressed" from="Control/MarginContainer/VBoxContainer/Button_Play" to="." method="_on_button_play_pressed"]
|
||||
[connection signal="pressed" from="Control/MarginContainer/VBoxContainer/Button_Pause_Resume" to="." method="_on_button_pause_pressed"]
|
||||
[connection signal="pressed" from="Control/MarginContainer/VBoxContainer/Button_Stop" to="." method="_on_button_stop_pressed"]
|
||||
[connection signal="pressed" from="Control/MarginContainer/VBoxContainer/Button_Next" to="." method="_on_button_next_pressed"]
|
||||
[connection signal="pressed" from="Control/MarginContainer/VBoxContainer/Button_Previous" to="." method="_on_button_previous_pressed"]
|
||||
Reference in New Issue
Block a user