sound track cacheing by track to remove any collision

This commit is contained in:
minjaesong
2024-04-02 17:15:23 +09:00
parent 918276a1be
commit 94152afcac
6 changed files with 55 additions and 10 deletions

View File

@@ -43,7 +43,14 @@ class TerrarumAudioMixerTrack(
}
var currentTrack: MusicContainer? = null
set(value) {
field = musicCache.getOrPut(value)
}
var nextTrack: MusicContainer? = null
set(value) {
field = musicCache.getOrPut(value)
}
var volume: TrackVolume = 1.0
get() = field
@@ -66,11 +73,14 @@ class TerrarumAudioMixerTrack(
var playStartedTime = 0L; internal set
var checkedOutTime = 0L; internal set
private var musicCache = MusicCache(name)
fun copyStatusTo(other: TerrarumAudioMixerTrack) {
other.pullNextTrack = this.pullNextTrack
other.currentTrack = this.currentTrack
other.nextTrack = this.nextTrack
other.volume = this.volume
other.musicCache = this.musicCache
other.trackingTarget = this.trackingTarget
other.streamPlaying.set(this.streamPlaying.get())
other.playStartedTime = this.playStartedTime
@@ -156,6 +166,7 @@ class TerrarumAudioMixerTrack(
processor.stop()
processorThread.join()*/
adev?.dispose()
musicCache.dispose()
}
override fun equals(other: Any?) = this.hash == (other as TerrarumAudioMixerTrack).hash