File tree Expand file tree Collapse file tree 3 files changed +13
-4
lines changed
Expand file tree Collapse file tree 3 files changed +13
-4
lines changed Original file line number Diff line number Diff line change @@ -75,11 +75,20 @@ func mark_player_as_available(player: AudioStreamPlayer) -> void:
7575 if busy_players .has (player ):
7676 busy_players .erase (player )
7777
78- if not available_players .has (player ):
78+ if available_players .size () >= default_pool_size :
79+ player .queue_free ()
80+ elif not available_players .has (player ):
7981 available_players .append (player )
8082
8183
8284func increase_pool () -> void :
85+ # See if we can reclaim a rogue busy player
86+ for player in busy_players :
87+ if not player .playing :
88+ mark_player_as_available (player )
89+ return
90+
91+ # Otherwise, add a new player
8392 var player := AudioStreamPlayer .new ()
8493 add_child (player )
8594 available_players .append (player )
Original file line number Diff line number Diff line change @@ -13,7 +13,7 @@ dest_files=["res://.godot/imported/music.mp3-8ca4afa70bdd800397f4305bc9ea3fe6.mp
1313[params]
1414
1515loop=true
16- loop_offset=0
17- bpm=0
18- beat_count=0
16+ loop_offset=4. 0
17+ bpm=120. 0
18+ beat_count=16
1919bar_beats=4
You can’t perform that action at this time.
0 commit comments