This commit is contained in:
Tabby 2025-07-08 15:06:09 +10:00
parent b94ff6acde
commit 264a43932c
31 changed files with 435 additions and 39 deletions

Binary file not shown.

View file

@ -0,0 +1,19 @@
[remap]
importer="mp3"
type="AudioStreamMP3"
uid="uid://bnuvjexc67wx0"
path="res://.godot/imported/Aspecty - Amb_01_Dark.mp3-98eb8afe080419570509f982cb762c3e.mp3str"
[deps]
source_file="res://Music/Aspecty - Amb_01_Dark.mp3"
dest_files=["res://.godot/imported/Aspecty - Amb_01_Dark.mp3-98eb8afe080419570509f982cb762c3e.mp3str"]
[params]
loop=false
loop_offset=0
bpm=0
beat_count=0
bar_beats=4

BIN
Music/Dark Loop.mp3 Normal file

Binary file not shown.

View file

@ -0,0 +1,19 @@
[remap]
importer="mp3"
type="AudioStreamMP3"
uid="uid://b4fqj3641cakh"
path="res://.godot/imported/Dark Loop.mp3-2874f94ce1a37aadafa3f2184640c541.mp3str"
[deps]
source_file="res://Music/Dark Loop.mp3"
dest_files=["res://.godot/imported/Dark Loop.mp3-2874f94ce1a37aadafa3f2184640c541.mp3str"]
[params]
loop=false
loop_offset=0
bpm=0
beat_count=0
bar_beats=4

BIN
Music/Factory.ogg Normal file

Binary file not shown.

19
Music/Factory.ogg.import Normal file
View file

@ -0,0 +1,19 @@
[remap]
importer="oggvorbisstr"
type="AudioStreamOggVorbis"
uid="uid://clb67g8fj0gok"
path="res://.godot/imported/Factory.ogg-fe0b77569ecfd6d867b8c8c74c8349a1.oggvorbisstr"
[deps]
source_file="res://Music/Factory.ogg"
dest_files=["res://.godot/imported/Factory.ogg-fe0b77569ecfd6d867b8c8c74c8349a1.oggvorbisstr"]
[params]
loop=false
loop_offset=0
bpm=0
beat_count=0
bar_beats=4

BIN
Music/Forest_Ambience.mp3 Normal file

Binary file not shown.

View file

@ -0,0 +1,19 @@
[remap]
importer="mp3"
type="AudioStreamMP3"
uid="uid://cdaxf1ewngahm"
path="res://.godot/imported/Forest_Ambience.mp3-8f01237f5fef52a8994415dc8e0ee895.mp3str"
[deps]
source_file="res://Music/Forest_Ambience.mp3"
dest_files=["res://.godot/imported/Forest_Ambience.mp3-8f01237f5fef52a8994415dc8e0ee895.mp3str"]
[params]
loop=false
loop_offset=0
bpm=0
beat_count=0
bar_beats=4

25
Music/MusicManager.tscn Normal file
View file

@ -0,0 +1,25 @@
[gd_scene load_steps=6 format=3 uid="uid://prs2odgoyxpq"]
[ext_resource type="Script" uid="uid://dyo4uhb0xygjw" path="res://Music/music_manager.gd" id="1_xucj2"]
[ext_resource type="AudioStream" uid="uid://cqeavji0kubj6" path="res://Music/audiomass-output.mp3" id="2_nyl5h"]
[ext_resource type="AudioStream" uid="uid://bnuvjexc67wx0" path="res://Music/Aspecty - Amb_01_Dark.mp3" id="3_ojnly"]
[ext_resource type="AudioStream" uid="uid://b4fqj3641cakh" path="res://Music/Dark Loop.mp3" id="4_yqniv"]
[ext_resource type="AudioStream" uid="uid://cdaxf1ewngahm" path="res://Music/Forest_Ambience.mp3" id="5_gtgq8"]
[node name="MusicManager" type="Node" node_paths=PackedStringArray("player", "timer")]
script = ExtResource("1_xucj2")
tracks = Array[AudioStream]([ExtResource("2_nyl5h"), ExtResource("3_ojnly"), ExtResource("4_yqniv"), ExtResource("5_gtgq8")])
player = NodePath("AudioStreamPlayer")
timer = NodePath("Timer")
[node name="AudioStreamPlayer" type="AudioStreamPlayer" parent="."]
stream = ExtResource("2_nyl5h")
volume_db = -14.416
autoplay = true
bus = &"Music"
[node name="Timer" type="Timer" parent="."]
one_shot = true
[connection signal="finished" from="AudioStreamPlayer" to="." method="_on_audio_stream_player_finished"]
[connection signal="timeout" from="Timer" to="." method="_on_timer_timeout"]

BIN
Music/audiomass-output.mp3 Normal file

Binary file not shown.

View file

@ -0,0 +1,19 @@
[remap]
importer="mp3"
type="AudioStreamMP3"
uid="uid://cqeavji0kubj6"
path="res://.godot/imported/audiomass-output.mp3-b179e0fdc26ee53747e38f07af2a05c8.mp3str"
[deps]
source_file="res://Music/audiomass-output.mp3"
dest_files=["res://.godot/imported/audiomass-output.mp3-b179e0fdc26ee53747e38f07af2a05c8.mp3str"]
[params]
loop=false
loop_offset=0
bpm=0
beat_count=0
bar_beats=4

29
Music/music_manager.gd Normal file
View file

@ -0,0 +1,29 @@
extends Node
@export var tracks : Array[AudioStream]
@export var player : AudioStreamPlayer
@export var timer : Timer
var last_played : int = 0
# Called when the node enters the scene tree for the first time.
func _ready() -> void:
pass
# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta: float) -> void:
#print(player.get_playback_position())
pass
func _on_audio_stream_player_finished() -> void:
var new_track : int
while new_track == last_played:
new_track = randi_range(0,tracks.size()-1)
player.stream = tracks[new_track]
last_played = new_track
timer.start(randf_range(5,15))
func _on_timer_timeout() -> void:
player.play()

View file

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