mirror of
https://github.com/curioustorvald/Terrarum.git
synced 2026-06-10 18:44:05 +09:00
working prev/next music queueing
This commit is contained in:
@@ -248,8 +248,7 @@ object MusicService : TransactionListener() {
|
|||||||
// request fadeout
|
// request fadeout
|
||||||
App.audioMixer.requestFadeOut(App.audioMixer.musicTrack) {
|
App.audioMixer.requestFadeOut(App.audioMixer.musicTrack) {
|
||||||
try {
|
try {
|
||||||
// callback: play next song in the playlist
|
// do nothing, really
|
||||||
// TODO queue the next song on the playlist, the actual playback will be done by the state machine update
|
|
||||||
|
|
||||||
fadedOut = true
|
fadedOut = true
|
||||||
}
|
}
|
||||||
@@ -263,6 +262,8 @@ object MusicService : TransactionListener() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
override fun onSuccess(state: TransactionState) {
|
override fun onSuccess(state: TransactionState) {
|
||||||
|
enterSTATE_INTERMISSION(0f)
|
||||||
|
enterSTATE_FIREPLAY()
|
||||||
onSuccess()
|
onSuccess()
|
||||||
}
|
}
|
||||||
override fun onFailure(e: Throwable, state: TransactionState) {
|
override fun onFailure(e: Throwable, state: TransactionState) {
|
||||||
@@ -279,8 +280,10 @@ object MusicService : TransactionListener() {
|
|||||||
// request fadeout
|
// request fadeout
|
||||||
App.audioMixer.requestFadeOut(App.audioMixer.musicTrack) {
|
App.audioMixer.requestFadeOut(App.audioMixer.musicTrack) {
|
||||||
try {
|
try {
|
||||||
// callback: play prev song in the playlist
|
// unshift the playlist
|
||||||
// TODO queue the prev song on the playlist, the actual playback will be done by the state machine update
|
// FIREPLAY always pulls next track, that's why we need two prev()
|
||||||
|
(state["currentPlaylist"] as TerrarumMusicPlaylist).queuePrev()
|
||||||
|
(state["currentPlaylist"] as TerrarumMusicPlaylist).queuePrev()
|
||||||
|
|
||||||
fadedOut = true
|
fadedOut = true
|
||||||
}
|
}
|
||||||
@@ -294,9 +297,15 @@ object MusicService : TransactionListener() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
override fun onSuccess(state: TransactionState) {
|
override fun onSuccess(state: TransactionState) {
|
||||||
|
|
||||||
|
enterSTATE_INTERMISSION(0f)
|
||||||
|
enterSTATE_FIREPLAY()
|
||||||
onSuccess()
|
onSuccess()
|
||||||
}
|
}
|
||||||
override fun onFailure(e: Throwable, state: TransactionState) {
|
override fun onFailure(e: Throwable, state: TransactionState) {
|
||||||
|
// reshift the playlist
|
||||||
|
(state["currentPlaylist"] as TerrarumMusicPlaylist).queueNext()
|
||||||
|
|
||||||
e.printStackTrace()
|
e.printStackTrace()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user