mirror of
https://github.com/curioustorvald/Terrarum.git
synced 2026-03-07 20:31:51 +09:00
adjustable audio buffer size via config
This commit is contained in:
@@ -13,11 +13,14 @@
|
||||
"MENU_IO_CLEAR": "Clear",
|
||||
"MENU_IO_IMPORT": "Import",
|
||||
"MENU_IO_MANUAL_SAVE": "Manual Save",
|
||||
"MENU_LABEL_AMBIENT_SOUNDS": "Ambient Sounds",
|
||||
"MENU_LABEL_COPYRIGHT": "Copyright",
|
||||
"MENU_LABEL_DELETE": "Delete",
|
||||
"MENU_LABEL_EXTRA_JVM_ARGUMENTS": "Extra Arguments",
|
||||
"MENU_LABEL_HARDWARE": "Hardware",
|
||||
"MENU_LABEL_IME": "IME",
|
||||
"MENU_LABEL_IME_TOGGLE": "Toggle IME",
|
||||
"MENU_LABEL_INTERFACE": "Interface",
|
||||
"MENU_LABEL_KEYBOARD_LAYOUT": "Keyboard Layout",
|
||||
"MENU_LABEL_PASTE": "Paste",
|
||||
"MENU_LABEL_PASTE_FROM_CLIPBOARD": "Paste from Clipboard",
|
||||
@@ -28,6 +31,7 @@
|
||||
"MENU_LABEL_SYSTEM_INFO": "System Info",
|
||||
"MENU_MODULES" : "Modules",
|
||||
"MENU_OPTIONS_ATLAS_TEXTURE_SIZE": "Atlas Texture Size",
|
||||
"MENU_OPTIONS_AUDIO_BUFFER_SIZE": "Audio Buffer Size",
|
||||
"MENU_OPTIONS_AUTOSAVE": "Autosave",
|
||||
"MENU_OPTIONS_BLUR": "Blur",
|
||||
"MENU_OPTIONS_DEBUG_CONSOLE": "Debug Console",
|
||||
@@ -35,6 +39,7 @@
|
||||
"MENU_OPTIONS_ENABLE_SCRIPT_MODS": "Enable Script Mods",
|
||||
"MENU_OPTIONS_JVM_HEAP_MAX": "Max Heap Memory",
|
||||
"MENU_OPTIONS_LIGHT_UPDATE_PASSES": "Light Calculation Depth",
|
||||
"MENU_OPTIONS_MASTER_VOLUME": "Master Volume",
|
||||
"MENU_OPTIONS_NOTIFICATION_DISPLAY_DURATION": "Show notification for",
|
||||
"MENU_OPTIONS_PARTICLES": "Particles",
|
||||
"MENU_OPTIONS_PERFORMANCE": "Performance",
|
||||
|
||||
@@ -21,6 +21,7 @@ object DefaultConfig {
|
||||
"screenheight" to TerrarumScreenSize.defaultH,
|
||||
"fullscreen" to false,
|
||||
"atlastexsize" to 2048,
|
||||
"audiobuffersize" to 512,
|
||||
|
||||
"language" to App.getSysLang(),
|
||||
"notificationshowuptime" to 4000, // 4s
|
||||
|
||||
@@ -117,6 +117,7 @@ object AudioMixer: Disposable {
|
||||
val callables = tracks.map { Callable {
|
||||
if (!it.processor.paused) {
|
||||
try { it.processor.run() }
|
||||
catch (_: InterruptedException) {}
|
||||
catch (e: Throwable) { e.printStackTrace() }
|
||||
}
|
||||
} }
|
||||
@@ -126,7 +127,8 @@ object AudioMixer: Disposable {
|
||||
processingExecutor.submitAll(callables)
|
||||
processingExecutor.join()
|
||||
}
|
||||
catch (_: Throwable) {}
|
||||
catch (_: InterruptedException) {}
|
||||
catch (e: Throwable) { e.printStackTrace() }
|
||||
|
||||
|
||||
/*processingSubthreads = tracks.map { Thread {
|
||||
|
||||
@@ -5,6 +5,7 @@ import com.badlogic.gdx.backends.lwjgl3.audio.OpenALLwjgl3Audio
|
||||
import com.badlogic.gdx.utils.Disposable
|
||||
import com.badlogic.gdx.utils.Queue
|
||||
import net.torvald.reflection.forceInvoke
|
||||
import net.torvald.terrarum.App
|
||||
import net.torvald.terrarum.getHashStr
|
||||
import net.torvald.terrarum.hashStrMap
|
||||
import net.torvald.terrarum.modulebasegame.MusicContainer
|
||||
@@ -20,7 +21,7 @@ class TerrarumAudioMixerTrack(val name: String, val isMaster: Boolean = false, v
|
||||
const val SAMPLING_RATE = 48000
|
||||
const val SAMPLING_RATEF = 48000f
|
||||
const val SAMPLING_RATED = 48000.0
|
||||
const val BUFFER_SIZE = 256*4 // n ms -> 384 * n
|
||||
val BUFFER_SIZE = 4 * App.getConfigInt("audiobuffersize") // n ms -> 384 * n
|
||||
}
|
||||
|
||||
val hash = getHashStr()
|
||||
|
||||
@@ -36,7 +36,7 @@ object ControlPanelCommon {
|
||||
val optionName = optionNames.first()
|
||||
val arg = args.split(',')
|
||||
|
||||
return if (args == "h1" || args == "p" || args == "emph") {
|
||||
return if (args == "h1" || args == "p" || args == "emph" || args == "pp") {
|
||||
(object : UIItem(parent, x, y) {
|
||||
override val width = 1
|
||||
override val height = 1
|
||||
@@ -232,6 +232,7 @@ object ControlPanelCommon {
|
||||
|
||||
akku += when (option) {
|
||||
"h1" -> realRowHeight + linegap + h1MarginBottom
|
||||
"pp" -> realRowHeight - 7
|
||||
else -> realRowHeight + linegap
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,15 +17,20 @@ class UISoundControlPanel(remoCon: UIRemoCon?) : UICanvas() {
|
||||
handler.allowESCtoClose = false
|
||||
|
||||
ControlPanelCommon.register(this, width, "basegame.soundcontrolpanel", arrayOf(
|
||||
arrayOf("mastervolume", { Lang["MENU_OPTIONS_MASTER_VOLUME"] }, "sliderd,0,1"),
|
||||
arrayOf("", { "" }, "p"),
|
||||
arrayOf("bgmvolume", { Lang["MENU_LABEL_MUSIC"] }, "sliderd,0,1"),
|
||||
arrayOf("", { "" }, "p"),
|
||||
arrayOf("ambientvolume", { Lang["MENU_LABEL_AMBIENT_SOUND"] }, "sliderd,0,1"),
|
||||
arrayOf("", { "" }, "p"),
|
||||
arrayOf("sfxvolume", { Lang["CREDITS_SFX"] }, "sliderd,0,1"),
|
||||
arrayOf("", { "" }, "p"),
|
||||
arrayOf("guivolume", { Lang["MENU_LABEL_INTERFACE"] }, "sliderd,0,1"),
|
||||
arrayOf("", { Lang["MENU_OPTIONS_SOUND_VOLUME"] }, "h1"),
|
||||
arrayOf("mastervolume", { Lang["MENU_OPTIONS_MASTER_VOLUME"] }, "sliderd,0,1"),
|
||||
arrayOf("", { "" }, "pp"),
|
||||
arrayOf("bgmvolume", { Lang["MENU_LABEL_MUSIC"] }, "sliderd,0,1"),
|
||||
arrayOf("", { "" }, "pp"),
|
||||
arrayOf("ambientvolume", { Lang["MENU_LABEL_AMBIENT_SOUNDS"] }, "sliderd,0,1"),
|
||||
arrayOf("", { "" }, "pp"),
|
||||
arrayOf("sfxvolume", { Lang["CREDITS_SFX"] }, "sliderd,0,1"),
|
||||
arrayOf("", { "" }, "pp"),
|
||||
arrayOf("guivolume", { Lang["MENU_LABEL_INTERFACE"] }, "sliderd,0,1"),
|
||||
arrayOf("", { Lang["MENU_LABEL_HARDWARE"] }, "h1"),
|
||||
arrayOf("audiobuffersize", { Lang["MENU_OPTIONS_AUDIO_BUFFER_SIZE"] }, "spinnersel,128,256,512,1024,2048"),
|
||||
arrayOf("", { "(${Lang["MENU_LABEL_RESTART_REQUIRED"]})" }, "p"),
|
||||
|
||||
))
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user