mirror of
https://github.com/curioustorvald/Terrarum.git
synced 2026-06-10 10:34:06 +09:00
fianlly found the culprit of repeated audio stopping but have no idea how to fix
This commit is contained in:
@@ -123,14 +123,19 @@ class AudioMixer : Disposable {
|
|||||||
* Return oldest dynamic track, even if the track is currently playing
|
* Return oldest dynamic track, even if the track is currently playing
|
||||||
*/
|
*/
|
||||||
fun getFreeTrackNoMatterWhat(): TerrarumAudioMixerTrack {
|
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
|
* Return oldest dynamic track that is not playing
|
||||||
*/
|
*/
|
||||||
fun getFreeTrack(): TerrarumAudioMixerTrack? {
|
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
|
var listenerHeadSize = BinoPan.EARDIST_DEFAULT; private set
|
||||||
|
|||||||
@@ -162,7 +162,8 @@ class TerrarumAudioMixerTrack(
|
|||||||
override fun equals(other: Any?) = this.hash == (other as TerrarumAudioMixerTrack).hash
|
override fun equals(other: Any?) = this.hash == (other as TerrarumAudioMixerTrack).hash
|
||||||
|
|
||||||
fun stop() {
|
fun stop() {
|
||||||
printdbg(this, "Stop music (mixertrack=${this.name}, musictrack=$currentTrack)")
|
printdbg("TerrarumAudioMixerTrack $name", "Stop music (mixertrack=${this.name}, musictrack=$currentTrack)")
|
||||||
|
printStackTrace("TerrarumAudioMixerTrack $name")
|
||||||
|
|
||||||
currentTrack?.reset()
|
currentTrack?.reset()
|
||||||
|
|
||||||
|
|||||||
@@ -289,6 +289,7 @@ class FixtureSmelterBasic : FixtureBase, CraftingStation {
|
|||||||
|
|
||||||
|
|
||||||
// manage audio
|
// manage audio
|
||||||
|
// FIXME this code is also killing the audio played by the other fixture (FixtureFurnaceAndAnvil)
|
||||||
getTrackByAudio(static).let {
|
getTrackByAudio(static).let {
|
||||||
if (it == null || (temperature > 0f && !it.isPlaying && !it.playRequested.get())) {
|
if (it == null || (temperature > 0f && !it.isPlaying && !it.playRequested.get())) {
|
||||||
startAudio(static) {
|
startAudio(static) {
|
||||||
|
|||||||
Reference in New Issue
Block a user