fianlly found the culprit of repeated audio stopping but have no idea how to fix

This commit is contained in:
minjaesong
2024-02-21 16:53:51 +09:00
parent 91c5105a12
commit 549c03c2b4
3 changed files with 10 additions and 3 deletions

View File

@@ -123,14 +123,19 @@ class AudioMixer : Disposable {
* Return oldest dynamic track, even if the track is currently playing
*/
fun getFreeTrackNoMatterWhat(): TerrarumAudioMixerTrack {
return getFreeTrack() ?: dynamicTracks.minBy { it.playStartedTime }
synchronized(this) {
return getFreeTrack() ?: dynamicTracks.minBy { it.playStartedTime }
}
}
/**
* Return oldest dynamic track that is not playing
*/
fun getFreeTrack(): TerrarumAudioMixerTrack? {
return dynamicTracks.filter { it.trackingTarget == null && !it.isPlaying }.minByOrNull { it.playStartedTime }
synchronized(this) {
return dynamicTracks.filter { it.trackingTarget == null && !it.isPlaying }
.minByOrNull { it.playStartedTime }
}
}
var listenerHeadSize = BinoPan.EARDIST_DEFAULT; private set