audio engine: resize buffer without restarting the game

This commit is contained in:
minjaesong
2024-01-16 03:31:22 +09:00
parent 755ced9ea4
commit 2bd1b61a35
20 changed files with 39 additions and 121 deletions

View File

@@ -34,6 +34,7 @@ class UIInventoryEscMenu(val full: UIInventoryFull) : UICanvas() {
"MENU_IO_SAVE_GAME",
"MENU_OPTIONS_CONTROLS",
"MENU_LABEL_IME",
"MENU_LABEL_SOUND",
"MENU_LABEL_LANGUAGE",
"MENU_LABEL_SHARE",
"MENU_LABEL_QUIT",
@@ -86,6 +87,7 @@ class UIInventoryEscMenu(val full: UIInventoryFull) : UICanvas() {
private val languageUI = UITitleLanguage(null)
private val keyboardSetupUI = UIIMEConfig(null)
private val shareUI = UIShare()
private val audioUI = UISoundControlPanel(null)
private var oldScreen = 0
private var screen = 0
@@ -156,12 +158,15 @@ class UIInventoryEscMenu(val full: UIInventoryFull) : UICanvas() {
screen = 1; gameMenuButtons.deselect()
}
3 -> {
screen = 5; gameMenuButtons.deselect()
screen = 7; gameMenuButtons.deselect()
}
4 -> {
screen = 6; gameMenuButtons.deselect()
screen = 5; gameMenuButtons.deselect()
}
5 -> {
screen = 6; gameMenuButtons.deselect()
}
6 -> {
screen = 2; gameMenuButtons.deselect()
}
}
@@ -183,7 +188,7 @@ class UIInventoryEscMenu(val full: UIInventoryFull) : UICanvas() {
// Completely unrelated to the gameMenuButtons order
private val screens = arrayOf(
gameMenuButtons, keyboardSetupUI, areYouSureMainMenuButtons, savingUI, keyConfigUI, languageUI, shareUI
gameMenuButtons, keyboardSetupUI, areYouSureMainMenuButtons, savingUI, keyConfigUI, languageUI, shareUI, audioUI
)
// `screens` order
@@ -222,6 +227,11 @@ class UIInventoryEscMenu(val full: UIInventoryFull) : UICanvas() {
App.fontGame.draw(batch, full.gameMenuControlHelp, controlHintX, full.yEnd - 20)
shareUI.render(frameDelta, batch, camera)
},
{ frameDelta: Float, batch: SpriteBatch, camera: OrthographicCamera ->
// control hints
App.fontGame.draw(batch, full.gameMenuControlHelp, controlHintX, full.yEnd - 20)
audioUI.render(frameDelta, batch, camera)
},
)
// `screens` order
@@ -237,6 +247,7 @@ class UIInventoryEscMenu(val full: UIInventoryFull) : UICanvas() {
},
{ screenX: Int, screenY: Int, pointer: Int, button: Int -> },
{ screenX: Int, screenY: Int, pointer: Int, button: Int -> },
{ screenX: Int, screenY: Int, pointer: Int, button: Int -> },
)
// `screens` order
@@ -252,6 +263,7 @@ class UIInventoryEscMenu(val full: UIInventoryFull) : UICanvas() {
},
{ screenX: Int, screenY: Int, pointer: Int, button: Int -> },
{ screenX: Int, screenY: Int, pointer: Int, button: Int -> },
{ screenX: Int, screenY: Int, pointer: Int, button: Int -> },
)
// `screens` order
@@ -265,6 +277,7 @@ class UIInventoryEscMenu(val full: UIInventoryFull) : UICanvas() {
{ amountX: Float, amountY: Float -> },
{ amountX: Float, amountY: Float -> },
{ amountX: Float, amountY: Float -> },
{ amountX: Float, amountY: Float -> },
)
override fun show() {

View File

@@ -31,7 +31,7 @@ class UISoundControlPanel(remoCon: UIRemoCon?) : UICanvas() {
arrayOf("", { "" }, "pp"),
arrayOf("", { Lang["MENU_LABEL_AUDIO_ENGINE"] }, "h1"),
arrayOf("audio_speaker_setup", { Lang["MENU_OPTIONS_SPEAKER_SETUP"] }, "textsel,headphone=MENU_OPTIONS_SPEAKER_HEADPHONE,stereo=MENU_OPTIONS_SPEAKER_STEREO"),
arrayOf("audio_buffer_size", { Lang["MENU_OPTIONS_App.audioMixerBufferSize"] }, "spinnersel,128,256,512,1024,2048"),
arrayOf("audio_buffer_size", { Lang["MENU_OPTIONS_AUDIO_BUFFER_SIZE"] }, "spinnersel,128,256,512,1024,2048"),
// arrayOf("", { "(${Lang["MENU_LABEL_RESTART_REQUIRED"]})" }, "p"),
arrayOf("", { "${Lang["MENU_LABEL_AUDIO_BUFFER_INSTRUCTION"]}" }, "p"),