audio compressor option is now available

This commit is contained in:
minjaesong
2025-01-11 23:46:54 +09:00
parent c10823ddce
commit f4fb7cccfb
3 changed files with 19 additions and 3 deletions

View File

@@ -37,6 +37,7 @@ import net.torvald.terrarum.langpack.Lang;
import net.torvald.terrarum.modulebasegame.IngameRenderer;
import net.torvald.terrarum.modulebasegame.TerrarumIngame;
import net.torvald.terrarum.modulebasegame.ui.ItemSlotImageFactory;
import net.torvald.terrarum.modulebasegame.ui.UISoundControlPanel;
import net.torvald.terrarum.serialise.WriteConfig;
import net.torvald.terrarum.ui.BlurMgr;
import net.torvald.terrarum.ui.Toolkit;
@@ -1268,6 +1269,7 @@ public class App implements ApplicationListener {
audioBufferSize = getConfigInt("audio_buffer_size");
audioMixer = new AudioMixer();
UISoundControlPanel.Companion.setupCompRatioByCurrentConfig();
audioMixerInitialised = true;
audioManagerThread = new Thread(new AudioManagerRunnable(audioMixer), "TerrarumAudioManager");
audioManagerThread.setPriority(MAX_PRIORITY); // higher = more predictable; audio delay is very noticeable so it gets high priority

View File

@@ -56,7 +56,7 @@ data class Post(
val postContents: PostContents,
val parcel: FixtureInventory?,
) {
@Transient val basePostage = GamePostalService.calculateBasePostage(this)
@Transient val postage = GamePostalService.calculateBasePostage(this).coerceAtLeast(1)
}
data class PostContents(

View File

@@ -32,11 +32,11 @@ class UISoundControlPanel(remoCon: UIRemoCon?) : UICanvas() {
arrayOf("", { "" }, "pp"),
arrayOf("guivolume", { Lang["MENU_LABEL_INTERFACE", true] }, "sliderd,0,1"),
arrayOf("", { "" }, "pp"),
arrayOf("audio_dsp_compressor_ratio", { Lang["MENU_OPTIONS_AUDIO_COMP", true] }, "textsel,none=MENU_OPTIONS_DISABLE,light=MENU_OPTIONS_LIGHT,heavy=MENU_OPTIONS_STRONG"),
arrayOf("", { Lang["MENU_LABEL_AUDIO_ENGINE", true] }, "h1"),
arrayOf("audio_speaker_setup", { Lang["MENU_OPTIONS_SPEAKER_SETUP", true] }, "textsel,headphone=MENU_OPTIONS_SPEAKER_HEADPHONE,stereo=MENU_OPTIONS_SPEAKER_STEREO"),
arrayOf("audio_buffer_size", { Lang["MENU_OPTIONS_AUDIO_BUFFER_SIZE", true] }, "spinnersel,128,256,512,1024,2048"),
arrayOf("", { "${Lang["MENU_LABEL_AUDIO_BUFFER_INSTRUCTION"]}" }, "p"),
//arrayOf("audio_dsp_compressor_ratio", { Lang["MENU_OPTIONS_AUDIO_COMP", true] }, "textsel,none=MENU_OPTIONS_DISABLE,light=MENU_OPTIONS_LIGHT,heavy=MENU_OPTIONS_STRONG")
))
}
@@ -44,7 +44,7 @@ class UISoundControlPanel(remoCon: UIRemoCon?) : UICanvas() {
private val compDict = mapOf(
"none" to 1f,
"light" to 1.8f,
"heavy" to 5.4f
"heavy" to 5.0f
)
override var height = ControlPanelCommon.getMenuHeight("basegame.soundcontrolpanel")
@@ -86,4 +86,18 @@ class UISoundControlPanel(remoCon: UIRemoCon?) : UICanvas() {
override fun dispose() {
}
companion object {
private val compDict = mapOf(
"none" to 1f,
"light" to 1.8f,
"heavy" to 5.0f
)
fun setupCompRatioByCurrentConfig() {
App.getConfigString("audio_dsp_compressor_ratio").let {
App.audioMixer.masterTrack.getFilter<Comp>().ratio = compDict[it] ?: 1f
}
}
}
}