Initial Commit
This commit is contained in:
commit
fcce674b1c
18 changed files with 707 additions and 0 deletions
2
.gitattributes
vendored
Normal file
2
.gitattributes
vendored
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
# Normalize EOL for all files that Git considers text files.
|
||||||
|
* text=auto eol=lf
|
13
.gitignore
vendored
Normal file
13
.gitignore
vendored
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
# Godot 4+ specific ignores
|
||||||
|
.godot/
|
||||||
|
|
||||||
|
# Removing old system
|
||||||
|
old/
|
||||||
|
tracks/*
|
||||||
|
!tracks/base.gd
|
||||||
|
!tracks/example.gd
|
||||||
|
temp/
|
||||||
|
thumbnails/*
|
||||||
|
!thumbnails/example.bmp
|
||||||
|
music/*
|
||||||
|
!music/example
|
BIN
art/info-overlay.png
Normal file
BIN
art/info-overlay.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 948 B |
34
art/info-overlay.png.import
Normal file
34
art/info-overlay.png.import
Normal file
|
@ -0,0 +1,34 @@
|
||||||
|
[remap]
|
||||||
|
|
||||||
|
importer="texture"
|
||||||
|
type="CompressedTexture2D"
|
||||||
|
uid="uid://eagpwhcx63cx"
|
||||||
|
path="res://.godot/imported/info-overlay.png-b6cec6f320247a7cf5f2a0a4f1f042dd.ctex"
|
||||||
|
metadata={
|
||||||
|
"vram_texture": false
|
||||||
|
}
|
||||||
|
|
||||||
|
[deps]
|
||||||
|
|
||||||
|
source_file="res://art/info-overlay.png"
|
||||||
|
dest_files=["res://.godot/imported/info-overlay.png-b6cec6f320247a7cf5f2a0a4f1f042dd.ctex"]
|
||||||
|
|
||||||
|
[params]
|
||||||
|
|
||||||
|
compress/mode=0
|
||||||
|
compress/high_quality=false
|
||||||
|
compress/lossy_quality=0.7
|
||||||
|
compress/hdr_compression=1
|
||||||
|
compress/normal_map=0
|
||||||
|
compress/channel_pack=0
|
||||||
|
mipmaps/generate=false
|
||||||
|
mipmaps/limit=-1
|
||||||
|
roughness/mode=0
|
||||||
|
roughness/src_normal=""
|
||||||
|
process/fix_alpha_border=true
|
||||||
|
process/premult_alpha=false
|
||||||
|
process/normal_map_invert_y=false
|
||||||
|
process/hdr_as_srgb=false
|
||||||
|
process/hdr_clamp_exposure=false
|
||||||
|
process/size_limit=0
|
||||||
|
detect_3d/compress_to=1
|
BIN
art/overlay.png
Normal file
BIN
art/overlay.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 980 B |
34
art/overlay.png.import
Normal file
34
art/overlay.png.import
Normal file
|
@ -0,0 +1,34 @@
|
||||||
|
[remap]
|
||||||
|
|
||||||
|
importer="texture"
|
||||||
|
type="CompressedTexture2D"
|
||||||
|
uid="uid://d4ncsckbihfnr"
|
||||||
|
path="res://.godot/imported/overlay.png-8c2a5edc5a15584060fd8f76953f4577.ctex"
|
||||||
|
metadata={
|
||||||
|
"vram_texture": false
|
||||||
|
}
|
||||||
|
|
||||||
|
[deps]
|
||||||
|
|
||||||
|
source_file="res://art/overlay.png"
|
||||||
|
dest_files=["res://.godot/imported/overlay.png-8c2a5edc5a15584060fd8f76953f4577.ctex"]
|
||||||
|
|
||||||
|
[params]
|
||||||
|
|
||||||
|
compress/mode=0
|
||||||
|
compress/high_quality=false
|
||||||
|
compress/lossy_quality=0.7
|
||||||
|
compress/hdr_compression=1
|
||||||
|
compress/normal_map=0
|
||||||
|
compress/channel_pack=0
|
||||||
|
mipmaps/generate=false
|
||||||
|
mipmaps/limit=-1
|
||||||
|
roughness/mode=0
|
||||||
|
roughness/src_normal=""
|
||||||
|
process/fix_alpha_border=true
|
||||||
|
process/premult_alpha=false
|
||||||
|
process/normal_map_invert_y=false
|
||||||
|
process/hdr_as_srgb=false
|
||||||
|
process/hdr_clamp_exposure=false
|
||||||
|
process/size_limit=0
|
||||||
|
detect_3d/compress_to=1
|
9
default_bus_layout.tres
Normal file
9
default_bus_layout.tres
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
[gd_resource type="AudioBusLayout" format=3 uid="uid://bhditfneg33ml"]
|
||||||
|
|
||||||
|
[resource]
|
||||||
|
bus/1/name = &"Music"
|
||||||
|
bus/1/solo = false
|
||||||
|
bus/1/mute = false
|
||||||
|
bus/1/bypass_fx = false
|
||||||
|
bus/1/volume_db = -0.130497
|
||||||
|
bus/1/send = &"Master"
|
BIN
music/example/Study and Relax.mp3
Normal file
BIN
music/example/Study and Relax.mp3
Normal file
Binary file not shown.
19
music/example/Study and Relax.mp3.import
Normal file
19
music/example/Study and Relax.mp3.import
Normal file
|
@ -0,0 +1,19 @@
|
||||||
|
[remap]
|
||||||
|
|
||||||
|
importer="mp3"
|
||||||
|
type="AudioStreamMP3"
|
||||||
|
uid="uid://drnf5my5uvute"
|
||||||
|
path="res://.godot/imported/Study and Relax.mp3-46d69de7485638a01fd8a7dff9bcd796.mp3str"
|
||||||
|
|
||||||
|
[deps]
|
||||||
|
|
||||||
|
source_file="res://music/example/Study and Relax.mp3"
|
||||||
|
dest_files=["res://.godot/imported/Study and Relax.mp3-46d69de7485638a01fd8a7dff9bcd796.mp3str"]
|
||||||
|
|
||||||
|
[params]
|
||||||
|
|
||||||
|
loop=false
|
||||||
|
loop_offset=0
|
||||||
|
bpm=0
|
||||||
|
beat_count=0
|
||||||
|
bar_beats=4
|
108
project.godot
Normal file
108
project.godot
Normal file
|
@ -0,0 +1,108 @@
|
||||||
|
; Engine configuration file.
|
||||||
|
; It's best edited using the editor UI and not directly,
|
||||||
|
; since the parameters that go here are not all obvious.
|
||||||
|
;
|
||||||
|
; Format:
|
||||||
|
; [section] ; section goes between []
|
||||||
|
; param=value ; assign values to parameters
|
||||||
|
|
||||||
|
config_version=5
|
||||||
|
|
||||||
|
[application]
|
||||||
|
|
||||||
|
config/name="StreamMusic"
|
||||||
|
run/main_scene="res://src/Main.tscn"
|
||||||
|
config/features=PackedStringArray("4.3", "Forward Plus")
|
||||||
|
|
||||||
|
[autoload]
|
||||||
|
|
||||||
|
TwitchGod="res://old/addons/TwitchGod.tscn"
|
||||||
|
|
||||||
|
[display]
|
||||||
|
|
||||||
|
window/size/viewport_width=450
|
||||||
|
window/size/viewport_height=200
|
||||||
|
window/size/transparent=true
|
||||||
|
window/per_pixel_transparency/allowed=true
|
||||||
|
|
||||||
|
[editor_plugins]
|
||||||
|
|
||||||
|
enabled=PackedStringArray()
|
||||||
|
|
||||||
|
[input]
|
||||||
|
|
||||||
|
Play={
|
||||||
|
"deadzone": 0.5,
|
||||||
|
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":80,"key_label":0,"unicode":112,"location":0,"echo":false,"script":null)
|
||||||
|
]
|
||||||
|
}
|
||||||
|
Stop={
|
||||||
|
"deadzone": 0.5,
|
||||||
|
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":83,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null)
|
||||||
|
]
|
||||||
|
}
|
||||||
|
Vol0={
|
||||||
|
"deadzone": 0.5,
|
||||||
|
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":48,"key_label":0,"unicode":48,"location":0,"echo":false,"script":null)
|
||||||
|
]
|
||||||
|
}
|
||||||
|
Vol1={
|
||||||
|
"deadzone": 0.5,
|
||||||
|
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":49,"key_label":0,"unicode":49,"location":0,"echo":false,"script":null)
|
||||||
|
]
|
||||||
|
}
|
||||||
|
Vol2={
|
||||||
|
"deadzone": 0.5,
|
||||||
|
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":50,"key_label":0,"unicode":50,"location":0,"echo":false,"script":null)
|
||||||
|
]
|
||||||
|
}
|
||||||
|
Vol3={
|
||||||
|
"deadzone": 0.5,
|
||||||
|
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":51,"key_label":0,"unicode":51,"location":0,"echo":false,"script":null)
|
||||||
|
]
|
||||||
|
}
|
||||||
|
Vol4={
|
||||||
|
"deadzone": 0.5,
|
||||||
|
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":52,"key_label":0,"unicode":52,"location":0,"echo":false,"script":null)
|
||||||
|
]
|
||||||
|
}
|
||||||
|
Vol5={
|
||||||
|
"deadzone": 0.5,
|
||||||
|
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":53,"key_label":0,"unicode":53,"location":0,"echo":false,"script":null)
|
||||||
|
]
|
||||||
|
}
|
||||||
|
Vol6={
|
||||||
|
"deadzone": 0.5,
|
||||||
|
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":54,"key_label":0,"unicode":54,"location":0,"echo":false,"script":null)
|
||||||
|
]
|
||||||
|
}
|
||||||
|
Vol7={
|
||||||
|
"deadzone": 0.5,
|
||||||
|
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":55,"key_label":0,"unicode":55,"location":0,"echo":false,"script":null)
|
||||||
|
]
|
||||||
|
}
|
||||||
|
Vol8={
|
||||||
|
"deadzone": 0.5,
|
||||||
|
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":56,"key_label":0,"unicode":56,"location":0,"echo":false,"script":null)
|
||||||
|
]
|
||||||
|
}
|
||||||
|
Vol9={
|
||||||
|
"deadzone": 0.5,
|
||||||
|
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":57,"key_label":0,"unicode":57,"location":0,"echo":false,"script":null)
|
||||||
|
]
|
||||||
|
}
|
||||||
|
Display={
|
||||||
|
"deadzone": 0.5,
|
||||||
|
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":68,"key_label":0,"unicode":100,"location":0,"echo":false,"script":null)
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
||||||
|
[twitch]
|
||||||
|
|
||||||
|
auth/broadcaster_id="977414152"
|
||||||
|
auth/client_id="6s7phhstect7oac8jxcuu94ypyei6x"
|
||||||
|
auth/client_secret="6s7phhstect7oac8jxcuu94ypyei6x"
|
||||||
|
auth/scopes/chat=3
|
||||||
|
auth/scopes/channel=2097152
|
||||||
|
eventsub/channel_poll_begin/subscribed=true
|
||||||
|
eventsub/channel_poll_begin/broadcaster_user_id="977414152"
|
25
src/Main.tscn
Normal file
25
src/Main.tscn
Normal file
|
@ -0,0 +1,25 @@
|
||||||
|
[gd_scene load_steps=3 format=3 uid="uid://da7wkuvgwgkib"]
|
||||||
|
|
||||||
|
[ext_resource type="Script" path="res://src/main.gd" id="1_bmrmv"]
|
||||||
|
[ext_resource type="PackedScene" uid="uid://bgu71uk1ax8p1" path="res://src/MusicDisplay.tscn" id="2_hsyxi"]
|
||||||
|
|
||||||
|
[node name="Main" type="CanvasLayer"]
|
||||||
|
script = ExtResource("1_bmrmv")
|
||||||
|
|
||||||
|
[node name="AudioStreamPlayer" type="AudioStreamPlayer" parent="."]
|
||||||
|
bus = &"Music"
|
||||||
|
|
||||||
|
[node name="MusicDisplay" parent="." instance=ExtResource("2_hsyxi")]
|
||||||
|
anchors_preset = 8
|
||||||
|
anchor_left = 0.5
|
||||||
|
anchor_top = 0.5
|
||||||
|
anchor_right = 0.5
|
||||||
|
anchor_bottom = 0.5
|
||||||
|
offset_left = -200.5
|
||||||
|
offset_right = 200.5
|
||||||
|
grow_horizontal = 2
|
||||||
|
grow_vertical = 2
|
||||||
|
|
||||||
|
[node name="MusicPicker" type="Node" parent="."]
|
||||||
|
|
||||||
|
[connection signal="finished" from="AudioStreamPlayer" to="." method="_on_audio_stream_player_finished"]
|
252
src/MusicDisplay.tscn
Normal file
252
src/MusicDisplay.tscn
Normal file
|
@ -0,0 +1,252 @@
|
||||||
|
[gd_scene load_steps=6 format=3 uid="uid://bgu71uk1ax8p1"]
|
||||||
|
|
||||||
|
[ext_resource type="Texture2D" uid="uid://7dlyvcd62df" path="res://old/oldthumbnails/t6wexov4.bmp" id="1_cxepj"]
|
||||||
|
[ext_resource type="Script" path="res://src/music_display.gd" id="1_g11yo"]
|
||||||
|
[ext_resource type="Texture2D" uid="uid://d4ncsckbihfnr" path="res://art/overlay.png" id="2_q8ma0"]
|
||||||
|
[ext_resource type="Texture2D" uid="uid://eagpwhcx63cx" path="res://art/info-overlay.png" id="4_64o3x"]
|
||||||
|
[ext_resource type="Script" path="res://src/music_bar.gd" id="5_rd85y"]
|
||||||
|
|
||||||
|
[node name="MusicDisplay" type="Control"]
|
||||||
|
layout_mode = 3
|
||||||
|
anchors_preset = 0
|
||||||
|
offset_left = -202.0
|
||||||
|
offset_top = -49.0
|
||||||
|
offset_right = 199.0
|
||||||
|
offset_bottom = 49.0
|
||||||
|
pivot_offset = Vector2(202, 49)
|
||||||
|
script = ExtResource("1_g11yo")
|
||||||
|
|
||||||
|
[node name="Thumbnail" type="Control" parent="."]
|
||||||
|
layout_mode = 1
|
||||||
|
anchors_preset = 8
|
||||||
|
anchor_left = 0.5
|
||||||
|
anchor_top = 0.5
|
||||||
|
anchor_right = 0.5
|
||||||
|
anchor_bottom = 0.5
|
||||||
|
offset_left = -200.0
|
||||||
|
offset_top = -50.0
|
||||||
|
offset_right = -100.0
|
||||||
|
offset_bottom = 50.0
|
||||||
|
grow_horizontal = 2
|
||||||
|
grow_vertical = 2
|
||||||
|
|
||||||
|
[node name="ThumbnailShape" type="TextureRect" parent="Thumbnail"]
|
||||||
|
clip_children = 1
|
||||||
|
layout_mode = 1
|
||||||
|
anchors_preset = 8
|
||||||
|
anchor_left = 0.5
|
||||||
|
anchor_top = 0.5
|
||||||
|
anchor_right = 0.5
|
||||||
|
anchor_bottom = 0.5
|
||||||
|
offset_left = -50.0
|
||||||
|
offset_top = -50.0
|
||||||
|
offset_right = 50.0
|
||||||
|
offset_bottom = 50.0
|
||||||
|
grow_horizontal = 2
|
||||||
|
grow_vertical = 2
|
||||||
|
texture = ExtResource("2_q8ma0")
|
||||||
|
|
||||||
|
[node name="ThumbnailTexture" type="TextureRect" parent="Thumbnail/ThumbnailShape"]
|
||||||
|
layout_mode = 1
|
||||||
|
anchors_preset = 8
|
||||||
|
anchor_left = 0.5
|
||||||
|
anchor_top = 0.5
|
||||||
|
anchor_right = 0.5
|
||||||
|
anchor_bottom = 0.5
|
||||||
|
offset_left = -50.0
|
||||||
|
offset_top = -50.0
|
||||||
|
offset_right = 50.0
|
||||||
|
offset_bottom = 50.0
|
||||||
|
grow_horizontal = 2
|
||||||
|
grow_vertical = 2
|
||||||
|
texture = ExtResource("1_cxepj")
|
||||||
|
expand_mode = 1
|
||||||
|
stretch_mode = 6
|
||||||
|
|
||||||
|
[node name="Info" type="Control" parent="."]
|
||||||
|
layout_mode = 1
|
||||||
|
anchors_preset = 8
|
||||||
|
anchor_left = 0.5
|
||||||
|
anchor_top = 0.5
|
||||||
|
anchor_right = 0.5
|
||||||
|
anchor_bottom = 0.5
|
||||||
|
offset_left = -100.0
|
||||||
|
offset_top = -35.0
|
||||||
|
offset_right = 200.0
|
||||||
|
offset_bottom = 35.0
|
||||||
|
grow_horizontal = 2
|
||||||
|
grow_vertical = 2
|
||||||
|
|
||||||
|
[node name="InfoShape" type="TextureRect" parent="Info"]
|
||||||
|
clip_children = 1
|
||||||
|
layout_mode = 0
|
||||||
|
offset_right = 200.0
|
||||||
|
offset_bottom = 50.0
|
||||||
|
texture = ExtResource("4_64o3x")
|
||||||
|
|
||||||
|
[node name="ColorRect" type="ColorRect" parent="Info/InfoShape"]
|
||||||
|
layout_mode = 1
|
||||||
|
anchors_preset = 15
|
||||||
|
anchor_right = 1.0
|
||||||
|
anchor_bottom = 1.0
|
||||||
|
grow_horizontal = 2
|
||||||
|
grow_vertical = 2
|
||||||
|
color = Color(0, 0, 0, 1)
|
||||||
|
|
||||||
|
[node name="InfoBackground" type="TextureRect" parent="Info/InfoShape"]
|
||||||
|
modulate = Color(1, 1, 1, 0.427451)
|
||||||
|
layout_mode = 1
|
||||||
|
anchors_preset = 8
|
||||||
|
anchor_left = 0.5
|
||||||
|
anchor_top = 0.5
|
||||||
|
anchor_right = 0.5
|
||||||
|
anchor_bottom = 0.5
|
||||||
|
offset_left = -157.0
|
||||||
|
offset_top = -138.0
|
||||||
|
offset_right = 279.0
|
||||||
|
offset_bottom = 308.0
|
||||||
|
grow_horizontal = 2
|
||||||
|
grow_vertical = 2
|
||||||
|
texture = ExtResource("1_cxepj")
|
||||||
|
expand_mode = 1
|
||||||
|
stretch_mode = 6
|
||||||
|
|
||||||
|
[node name="InfoTrack" type="RichTextLabel" parent="Info/InfoShape"]
|
||||||
|
layout_mode = 1
|
||||||
|
anchors_preset = 4
|
||||||
|
anchor_top = 0.5
|
||||||
|
anchor_bottom = 0.5
|
||||||
|
offset_left = 8.0
|
||||||
|
offset_top = -24.0
|
||||||
|
offset_right = 299.0
|
||||||
|
offset_bottom = -1.0
|
||||||
|
grow_vertical = 2
|
||||||
|
theme_override_colors/font_outline_color = Color(0, 0, 0, 0.631373)
|
||||||
|
theme_override_colors/font_shadow_color = Color(0, 0, 0, 0.431373)
|
||||||
|
theme_override_constants/outline_size = 6
|
||||||
|
theme_override_constants/shadow_offset_y = 2
|
||||||
|
theme_override_constants/shadow_offset_x = 1
|
||||||
|
text = "Example Title"
|
||||||
|
|
||||||
|
[node name="InfoArtist" type="RichTextLabel" parent="Info/InfoShape"]
|
||||||
|
layout_mode = 1
|
||||||
|
anchors_preset = 4
|
||||||
|
anchor_top = 0.5
|
||||||
|
anchor_bottom = 0.5
|
||||||
|
offset_left = 8.0
|
||||||
|
offset_top = 3.0
|
||||||
|
offset_right = 299.0
|
||||||
|
offset_bottom = 26.0
|
||||||
|
grow_vertical = 2
|
||||||
|
theme_override_colors/font_outline_color = Color(0, 0, 0, 0.631373)
|
||||||
|
theme_override_colors/font_shadow_color = Color(0, 0, 0, 0.431373)
|
||||||
|
theme_override_constants/outline_size = 6
|
||||||
|
theme_override_constants/shadow_offset_y = 2
|
||||||
|
theme_override_constants/shadow_offset_x = 1
|
||||||
|
theme_override_font_sizes/normal_font_size = 12
|
||||||
|
text = "Example Artist"
|
||||||
|
|
||||||
|
[node name="Bars" type="Control" parent="."]
|
||||||
|
layout_mode = 1
|
||||||
|
anchors_preset = 6
|
||||||
|
anchor_left = 1.0
|
||||||
|
anchor_top = 0.5
|
||||||
|
anchor_right = 1.0
|
||||||
|
anchor_bottom = 0.5
|
||||||
|
offset_left = -55.0
|
||||||
|
offset_top = -25.0
|
||||||
|
offset_right = -18.0
|
||||||
|
offset_bottom = 25.0
|
||||||
|
grow_horizontal = 0
|
||||||
|
grow_vertical = 2
|
||||||
|
|
||||||
|
[node name="ColorRect" type="ColorRect" parent="Bars"]
|
||||||
|
layout_mode = 1
|
||||||
|
anchors_preset = 6
|
||||||
|
anchor_left = 1.0
|
||||||
|
anchor_top = 0.5
|
||||||
|
anchor_right = 1.0
|
||||||
|
anchor_bottom = 0.5
|
||||||
|
offset_left = -4.0
|
||||||
|
offset_top = -24.0
|
||||||
|
offset_bottom = 24.0
|
||||||
|
grow_horizontal = 0
|
||||||
|
grow_vertical = 2
|
||||||
|
pivot_offset = Vector2(2, 48)
|
||||||
|
color = Color(0, 0, 0, 1)
|
||||||
|
script = ExtResource("5_rd85y")
|
||||||
|
|
||||||
|
[node name="ColorRect4" type="ColorRect" parent="Bars/ColorRect"]
|
||||||
|
layout_mode = 1
|
||||||
|
anchors_preset = 8
|
||||||
|
anchor_left = 0.5
|
||||||
|
anchor_top = 0.5
|
||||||
|
anchor_right = 0.5
|
||||||
|
anchor_bottom = 0.5
|
||||||
|
offset_left = -1.0
|
||||||
|
offset_top = -22.0
|
||||||
|
offset_right = 1.0
|
||||||
|
offset_bottom = 22.0
|
||||||
|
grow_horizontal = 2
|
||||||
|
grow_vertical = 2
|
||||||
|
pivot_offset = Vector2(1, 44)
|
||||||
|
|
||||||
|
[node name="ColorRect2" type="ColorRect" parent="Bars"]
|
||||||
|
layout_mode = 1
|
||||||
|
anchors_preset = 8
|
||||||
|
anchor_left = 0.5
|
||||||
|
anchor_top = 0.5
|
||||||
|
anchor_right = 0.5
|
||||||
|
anchor_bottom = 0.5
|
||||||
|
offset_left = -2.0
|
||||||
|
offset_top = -24.0
|
||||||
|
offset_right = 2.0
|
||||||
|
offset_bottom = 24.0
|
||||||
|
grow_horizontal = 2
|
||||||
|
grow_vertical = 2
|
||||||
|
pivot_offset = Vector2(2, 48)
|
||||||
|
color = Color(0, 0, 0, 1)
|
||||||
|
script = ExtResource("5_rd85y")
|
||||||
|
|
||||||
|
[node name="ColorRect4" type="ColorRect" parent="Bars/ColorRect2"]
|
||||||
|
layout_mode = 1
|
||||||
|
anchors_preset = 8
|
||||||
|
anchor_left = 0.5
|
||||||
|
anchor_top = 0.5
|
||||||
|
anchor_right = 0.5
|
||||||
|
anchor_bottom = 0.5
|
||||||
|
offset_left = -1.0
|
||||||
|
offset_top = -22.0
|
||||||
|
offset_right = 1.0
|
||||||
|
offset_bottom = 22.0
|
||||||
|
grow_horizontal = 2
|
||||||
|
grow_vertical = 2
|
||||||
|
pivot_offset = Vector2(1, 44)
|
||||||
|
|
||||||
|
[node name="ColorRect3" type="ColorRect" parent="Bars"]
|
||||||
|
layout_mode = 1
|
||||||
|
anchors_preset = 4
|
||||||
|
anchor_top = 0.5
|
||||||
|
anchor_bottom = 0.5
|
||||||
|
offset_top = -24.0
|
||||||
|
offset_right = 4.0
|
||||||
|
offset_bottom = 24.0
|
||||||
|
grow_vertical = 2
|
||||||
|
pivot_offset = Vector2(2, 48)
|
||||||
|
color = Color(0, 0, 0, 1)
|
||||||
|
script = ExtResource("5_rd85y")
|
||||||
|
|
||||||
|
[node name="ColorRect4" type="ColorRect" parent="Bars/ColorRect3"]
|
||||||
|
layout_mode = 1
|
||||||
|
anchors_preset = 8
|
||||||
|
anchor_left = 0.5
|
||||||
|
anchor_top = 0.5
|
||||||
|
anchor_right = 0.5
|
||||||
|
anchor_bottom = 0.5
|
||||||
|
offset_left = -1.0
|
||||||
|
offset_top = -22.0
|
||||||
|
offset_right = 1.0
|
||||||
|
offset_bottom = 22.0
|
||||||
|
grow_horizontal = 2
|
||||||
|
grow_vertical = 2
|
||||||
|
pivot_offset = Vector2(1, 44)
|
74
src/main.gd
Normal file
74
src/main.gd
Normal file
|
@ -0,0 +1,74 @@
|
||||||
|
extends CanvasLayer
|
||||||
|
|
||||||
|
@onready var music_display = $"MusicDisplay"
|
||||||
|
@onready var audio_stream_player = $"AudioStreamPlayer"
|
||||||
|
|
||||||
|
var music_bus = AudioServer.get_bus_index("Music")
|
||||||
|
|
||||||
|
var _tracks = []
|
||||||
|
|
||||||
|
|
||||||
|
func _ready():
|
||||||
|
get_viewport().transparent_bg = true
|
||||||
|
AudioServer.set_bus_volume_db(music_bus, linear_to_db(0.5))
|
||||||
|
_load_tracks()
|
||||||
|
|
||||||
|
|
||||||
|
func _process(delta):
|
||||||
|
if Input.is_action_just_pressed("Play"):
|
||||||
|
_play()
|
||||||
|
elif Input.is_action_just_pressed("Stop"):
|
||||||
|
_stop()
|
||||||
|
elif Input.is_action_just_pressed("Display"):
|
||||||
|
_display()
|
||||||
|
|
||||||
|
for i in range(0, 10):
|
||||||
|
if Input.is_action_just_pressed("Vol%d" % [i]):
|
||||||
|
AudioServer.set_bus_volume_db(music_bus, linear_to_db(float(i)/9))
|
||||||
|
|
||||||
|
|
||||||
|
func _play():
|
||||||
|
var song = _get_track()
|
||||||
|
audio_stream_player.stream = load(song.track)
|
||||||
|
audio_stream_player.play()
|
||||||
|
music_display.show_song(song)
|
||||||
|
|
||||||
|
|
||||||
|
func _stop():
|
||||||
|
audio_stream_player.stop()
|
||||||
|
music_display.hide_song()
|
||||||
|
|
||||||
|
|
||||||
|
func _display():
|
||||||
|
music_display.show_song()
|
||||||
|
|
||||||
|
|
||||||
|
func _get_track():
|
||||||
|
return _tracks.pick_random()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
func _load_tracks():
|
||||||
|
_load_directory("res://tracks")
|
||||||
|
print("Loaded music")
|
||||||
|
|
||||||
|
|
||||||
|
func _load_directory(path: String):
|
||||||
|
var dir = DirAccess.open(path)
|
||||||
|
|
||||||
|
if dir:
|
||||||
|
dir.list_dir_begin()
|
||||||
|
var file_name = dir.get_next()
|
||||||
|
|
||||||
|
while file_name != "":
|
||||||
|
if not dir.current_is_dir():
|
||||||
|
var file = load("res://tracks/%s" % [file_name])
|
||||||
|
var instance = file.new()
|
||||||
|
var new_tracks = instance.get_tracks()
|
||||||
|
|
||||||
|
for track in new_tracks:
|
||||||
|
_tracks.push_back(track)
|
||||||
|
else:
|
||||||
|
_load_directory("res://tracks/%s" % [file_name])
|
||||||
|
|
||||||
|
file_name = dir.get_next()
|
29
src/music_bar.gd
Normal file
29
src/music_bar.gd
Normal file
|
@ -0,0 +1,29 @@
|
||||||
|
extends ColorRect
|
||||||
|
|
||||||
|
func _ready():
|
||||||
|
var max1 = randf_range(0.35, 1)
|
||||||
|
var max2 = randf_range(0.35, 1)
|
||||||
|
var max3 = randf_range(0.35, 1)
|
||||||
|
var max4 = randf_range(0.35, 1)
|
||||||
|
var max5 = randf_range(0.35, 1)
|
||||||
|
var time = randf_range(0.25, 1)
|
||||||
|
var min1 = randf_range(0, 0.25)
|
||||||
|
var min2 = randf_range(0, 0.25)
|
||||||
|
var min3 = randf_range(0, 0.25)
|
||||||
|
var min4 = randf_range(0, 0.25)
|
||||||
|
var min5 = randf_range(0, 0.25)
|
||||||
|
|
||||||
|
scale.y = 0
|
||||||
|
|
||||||
|
var tween = create_tween()
|
||||||
|
tween.set_loops()
|
||||||
|
tween.tween_property(self, "scale:y", max1, time)
|
||||||
|
tween.tween_property(self, "scale:y", min1, time)
|
||||||
|
tween.tween_property(self, "scale:y", max2, time)
|
||||||
|
tween.tween_property(self, "scale:y", min2, time)
|
||||||
|
tween.tween_property(self, "scale:y", max3, time)
|
||||||
|
tween.tween_property(self, "scale:y", min3, time)
|
||||||
|
tween.tween_property(self, "scale:y", max4, time)
|
||||||
|
tween.tween_property(self, "scale:y", min4, time)
|
||||||
|
tween.tween_property(self, "scale:y", max5, time)
|
||||||
|
tween.tween_property(self, "scale:y", min5, time)
|
70
src/music_display.gd
Normal file
70
src/music_display.gd
Normal file
|
@ -0,0 +1,70 @@
|
||||||
|
extends Control
|
||||||
|
|
||||||
|
# -- References
|
||||||
|
@onready var thumbnail = $"Thumbnail"
|
||||||
|
@onready var thumbnail_texture = $"Thumbnail/ThumbnailShape/ThumbnailTexture"
|
||||||
|
@onready var info_texture = $"Info/InfoShape/InfoBackground"
|
||||||
|
@onready var info_artist = $"Info/InfoShape/InfoArtist"
|
||||||
|
@onready var info_track = $"Info/InfoShape/InfoTrack"
|
||||||
|
|
||||||
|
# -- Onready vars
|
||||||
|
@onready var _start_position = position
|
||||||
|
|
||||||
|
# -- Constants
|
||||||
|
const MOVE_IN_TIME = 1
|
||||||
|
const MOVE_WAIT_TIME = 10
|
||||||
|
const MOVE_OUT_TIME = 1
|
||||||
|
const MOVE_AMOUNT = 160
|
||||||
|
const MOVE_SCALE_DIFF = 0.25
|
||||||
|
|
||||||
|
# -- Variables
|
||||||
|
var move_tween = null
|
||||||
|
|
||||||
|
|
||||||
|
# -- Built in Functions
|
||||||
|
|
||||||
|
|
||||||
|
func _ready():
|
||||||
|
position.y = _start_position.y + MOVE_AMOUNT
|
||||||
|
scale = Vector2.ONE * (1 - MOVE_SCALE_DIFF)
|
||||||
|
|
||||||
|
|
||||||
|
# -- Public Functions
|
||||||
|
|
||||||
|
|
||||||
|
## Show the display for a song
|
||||||
|
func show_song(song = null):
|
||||||
|
if song:
|
||||||
|
thumbnail_texture.texture = song.thumbnail
|
||||||
|
info_texture.texture = song.thumbnail
|
||||||
|
info_track.text = " " + song.name
|
||||||
|
info_artist.text = " " + song.artist
|
||||||
|
|
||||||
|
if move_tween:
|
||||||
|
move_tween.kill()
|
||||||
|
|
||||||
|
move_tween = create_tween()
|
||||||
|
move_tween.set_parallel()
|
||||||
|
move_tween.set_trans(Tween.TRANS_BACK)
|
||||||
|
move_tween.set_ease(Tween.EASE_OUT)
|
||||||
|
move_tween.tween_property(self, "position:y", _start_position.y, MOVE_IN_TIME)
|
||||||
|
move_tween.tween_property(self, "scale", Vector2.ONE, MOVE_IN_TIME)
|
||||||
|
move_tween.chain()
|
||||||
|
move_tween.tween_interval(MOVE_WAIT_TIME)
|
||||||
|
move_tween.chain()
|
||||||
|
move_tween.set_ease(Tween.EASE_IN)
|
||||||
|
move_tween.tween_property(self, "position:y", _start_position.y + MOVE_AMOUNT, MOVE_OUT_TIME)
|
||||||
|
move_tween.tween_property(self, "scale", Vector2.ONE * (1 - MOVE_SCALE_DIFF), MOVE_IN_TIME)
|
||||||
|
|
||||||
|
|
||||||
|
## Hide the display for a song
|
||||||
|
func hide_song():
|
||||||
|
if move_tween:
|
||||||
|
move_tween.kill()
|
||||||
|
|
||||||
|
move_tween = create_tween()
|
||||||
|
move_tween.set_parallel()
|
||||||
|
move_tween.set_trans(Tween.TRANS_BACK)
|
||||||
|
move_tween.set_ease(Tween.EASE_IN)
|
||||||
|
move_tween.tween_property(self, "position:y", _start_position.y + MOVE_AMOUNT, MOVE_OUT_TIME)
|
||||||
|
move_tween.tween_property(self, "scale", Vector2.ONE * (1 - MOVE_SCALE_DIFF), MOVE_IN_TIME)
|
BIN
thumbnails/example.bmp
Normal file
BIN
thumbnails/example.bmp
Normal file
Binary file not shown.
After Width: | Height: | Size: 3.2 MiB |
21
tracks/base.gd
Normal file
21
tracks/base.gd
Normal file
|
@ -0,0 +1,21 @@
|
||||||
|
extends Node
|
||||||
|
class_name BaseTrack
|
||||||
|
|
||||||
|
var _default = null
|
||||||
|
var _tracks = null
|
||||||
|
|
||||||
|
func get_tracks():
|
||||||
|
if not _tracks:
|
||||||
|
return []
|
||||||
|
|
||||||
|
var tracks = _tracks.duplicate()
|
||||||
|
|
||||||
|
if not _default:
|
||||||
|
return tracks
|
||||||
|
|
||||||
|
for track in tracks:
|
||||||
|
for key in _default:
|
||||||
|
if not track.has(key):
|
||||||
|
track[key] = _default[key]
|
||||||
|
|
||||||
|
return tracks
|
17
tracks/example.gd
Normal file
17
tracks/example.gd
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
extends BaseTrack
|
||||||
|
|
||||||
|
func _init():
|
||||||
|
_default = {
|
||||||
|
"artist": "Kevin MacLeod",
|
||||||
|
"thumbnail": preload("res://thumbnails/example.bmp"),
|
||||||
|
"source": "https://incompetech.com/",
|
||||||
|
}
|
||||||
|
|
||||||
|
_tracks = [
|
||||||
|
{
|
||||||
|
"name": "Study and Relax",
|
||||||
|
"track": "res://music/example/Study and Relax.mp3"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
|
||||||
|
# Each track can redifine things set in _default. The two get merged giving priority to things set in tracks
|
Loading…
Reference in a new issue