Fix MAKO::check_music()

This fixes infinite loop in the opening demo of Only You, waiting for
the end of the music.
This commit is contained in:
kichikuou
2023-03-17 15:53:52 +09:00
parent 425ddf3ea8
commit be18e06e09
5 changed files with 76 additions and 14 deletions
@@ -195,6 +195,10 @@ private class CddaPlayer(private val playlistPath: File) {
private val player = MediaPlayer()
private var playerPaused = false
init {
player.setOnCompletionListener { currentTrack = 0 }
}
fun start(track: Int, loop: Boolean) {
val f = playlist.elementAtOrNull(track - 1)
if (f.isNullOrEmpty()) {
@@ -251,6 +255,10 @@ private class MidiPlayer {
private var playing = false
private var playerPaused = false
init {
player.setOnCompletionListener { playing = false }
}
fun start(path: String, loop: Boolean) {
try {
player.apply {