working gapless playback but musicplayer anim is not

This commit is contained in:
minjaesong
2023-12-28 19:06:29 +09:00
parent 3e7434a9c6
commit a4cb3f4d29
4 changed files with 70 additions and 24 deletions

View File

@@ -22,7 +22,14 @@ enum class TrackType {
STATIC_SOURCE, DYNAMIC_SOURCE, BUS, MASTER
}
class TerrarumAudioMixerTrack(val name: String, val trackType: TrackType, var maxVolumeFun: () -> Double = {1.0}): Disposable {
class TerrarumAudioMixerTrack(
val name: String,
val trackType: TrackType,
var doGaplessPlayback: Boolean = false, // if true, the audio will be pulled from the `nextTrack` to always fully fill the read-buffer
var maxVolumeFun: () -> Double = {1.0}
): Disposable {
var pullNextTrack = {}
companion object {
const val SAMPLING_RATE = 48000
@@ -138,8 +145,8 @@ class TerrarumAudioMixerTrack(val name: String, val trackType: TrackType, var ma
override fun equals(other: Any?) = this.hash == (other as TerrarumAudioMixerTrack).hash
fun stop() {
currentTrack?.samplesRead = 0L
currentTrack?.gdxMusic?.forceInvoke<Int>("reset", arrayOf())
currentTrack?.reset()
streamPlaying = false
// playStartedTime = 0L