mirror of
https://github.com/curioustorvald/Terrarum.git
synced 2026-06-11 19:14:05 +09:00
audiomanager: will gracefully not play if there is nothing to play
This commit is contained in:
@@ -66,6 +66,9 @@ class TerrarumMusicGovernor : MusicGovernor() {
|
||||
songs.forEach {
|
||||
App.disposables.add(it.gdxMusic)
|
||||
}
|
||||
ambients.forEach {
|
||||
App.disposables.add(it.gdxMusic)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -113,17 +116,9 @@ class TerrarumMusicGovernor : MusicGovernor() {
|
||||
|
||||
|
||||
override fun update(ingame: IngameInstance, delta: Float) {
|
||||
if (songs.isEmpty()) {
|
||||
if (!warningPrinted) {
|
||||
warningPrinted = true
|
||||
printdbg(this, "Warning: songs list is empty")
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// val ingame = ingame as TerrarumIngame
|
||||
if (musicState == 0) musicState = STATE_INTERMISSION
|
||||
if (ambState == 0) ambState = STATE_INTERMISSION
|
||||
// start the song queueing if there is one to play
|
||||
if (songs.isNotEmpty() && musicState == 0) musicState = STATE_INTERMISSION
|
||||
if (ambients.isNotEmpty() && ambState == 0) ambState = STATE_INTERMISSION
|
||||
|
||||
|
||||
when (musicState) {
|
||||
|
||||
Reference in New Issue
Block a user