audio mixer reset() with audio artefact masking

This commit is contained in:
minjaesong
2024-01-12 01:05:52 +09:00
parent b415f30ae5
commit a2f61a2be7
7 changed files with 46 additions and 12 deletions

View File

@@ -463,6 +463,20 @@ object AudioMixer: Disposable {
}
}
fun reset() {
dynamicTracks.forEach { it.stop() }
tracks.filter { it.trackType == TrackType.STATIC_SOURCE }.forEach { it.stop() }
tracks.forEach {
it.processor.purgeBuffer()
}
fadeBus.getFilter<Lowpass>().setCutoff(TerrarumAudioMixerTrack.SAMPLING_RATEF / 2)
// give some time for the cave bus to decay before ramping the volume up
Timer().schedule(object : TimerTask() {
override fun run() {
fadeBus.volume = 1.0
}
}, 500L)
}
override fun dispose() {
processingExecutor.killAll()