mirror of
https://github.com/curioustorvald/Terrarum.git
synced 2026-06-16 13:34:06 +09:00
fix: continuous album now plays again
This commit is contained in:
@@ -166,6 +166,7 @@ object MusicService : TransactionListener() {
|
||||
stopPlaylistPlayback {}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Puts the given playlist to this object if the transaction successes. If the given playlist is same as the
|
||||
* current playlist, the transaction will successfully finish immediately; otherwise the given playlist will
|
||||
@@ -213,11 +214,22 @@ object MusicService : TransactionListener() {
|
||||
oldPlaylist?.dispose()
|
||||
|
||||
(state["currentPlaylist"] as TerrarumMusicPlaylist?)?.let {
|
||||
// set songFinishedHook for every song
|
||||
it.musicList.forEach {
|
||||
it.songFinishedHook = {
|
||||
onMusicFinishing(it)
|
||||
}
|
||||
}
|
||||
|
||||
// set gaplessness of the Music track
|
||||
App.audioMixer.musicTrack.let { track ->
|
||||
track.doGaplessPlayback = (it.diskJockeyingMode == "continuous")
|
||||
if (track.doGaplessPlayback) {
|
||||
track.pullNextTrack = {
|
||||
track.currentTrack = MusicService.currentPlaylist!!.queueNext()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
onSuccess()
|
||||
@@ -313,7 +325,9 @@ object MusicService : TransactionListener() {
|
||||
if (err != null) throw err!!
|
||||
}
|
||||
|
||||
override fun onSuccess(state: TransactionState) { onSuccess() }
|
||||
override fun onSuccess(state: TransactionState) {
|
||||
onSuccess()
|
||||
}
|
||||
override fun onFailure(e: Throwable, state: TransactionState) {
|
||||
e.printStackTrace()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user