diff --git a/src/net/torvald/terrarum/App.java b/src/net/torvald/terrarum/App.java index bf5352359..79324bf6b 100644 --- a/src/net/torvald/terrarum/App.java +++ b/src/net/torvald/terrarum/App.java @@ -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 diff --git a/src/net/torvald/terrarum/modulebasegame/gameworld/GamePostalService.kt b/src/net/torvald/terrarum/modulebasegame/gameworld/GamePostalService.kt index 345d8bd26..7b1bb0db3 100644 --- a/src/net/torvald/terrarum/modulebasegame/gameworld/GamePostalService.kt +++ b/src/net/torvald/terrarum/modulebasegame/gameworld/GamePostalService.kt @@ -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( diff --git a/src/net/torvald/terrarum/modulebasegame/ui/UISoundControlPanel.kt b/src/net/torvald/terrarum/modulebasegame/ui/UISoundControlPanel.kt index 76e101d5c..67f9db44a 100644 --- a/src/net/torvald/terrarum/modulebasegame/ui/UISoundControlPanel.kt +++ b/src/net/torvald/terrarum/modulebasegame/ui/UISoundControlPanel.kt @@ -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().ratio = compDict[it] ?: 1f + } + } + } + } \ No newline at end of file