reloading the engine will copy track states from the old instance, obsoleting audioMixerRenewHooks

This commit is contained in:
minjaesong
2024-01-16 14:00:58 +09:00
parent f05cfe3cbb
commit 07c70a42f3
17 changed files with 106 additions and 10 deletions

View File

@@ -61,7 +61,23 @@ class TerrarumAudioMixerTrack(
var trackingTarget: Actor? = null
var playStartedTime = 0L; private set
internal var streamPlaying = false
var playStartedTime = 0L; internal set
fun copyStatusFrom(other: TerrarumAudioMixerTrack) {
other.pullNextTrack = this.pullNextTrack
other.currentTrack = this.currentTrack
other.nextTrack = this.nextTrack
other.volume = this.volume
other.trackingTarget = this.trackingTarget
other.streamPlaying = this.streamPlaying
other.playStartedTime = this.playStartedTime
filters.indices.forEach { i ->
other.filters[i].copyParamsFrom(this.filters[i])
}
}
inline fun <reified T> getFilter() = filters.filterIsInstance<T>().first()!!
inline fun <reified T> getFilterOrNull() = filters.filterIsInstance<T>().firstOrNull()
@@ -119,7 +135,6 @@ class TerrarumAudioMixerTrack(
}
internal var streamPlaying = false
fun play() {
playStartedTime = System.nanoTime()
streamPlaying = true