diff --git a/src/net/torvald/terrarum/TerrarumAppConfiguration.kt b/src/net/torvald/terrarum/TerrarumAppConfiguration.kt index 1b76cb49b..3ab4b5d59 100644 --- a/src/net/torvald/terrarum/TerrarumAppConfiguration.kt +++ b/src/net/torvald/terrarum/TerrarumAppConfiguration.kt @@ -16,7 +16,7 @@ object TerrarumAppConfiguration { // CONFIGURATION FOR THE APP ITSELF // ////////////////////////////////////// const val GAME_NAME = "Terrarum" - const val COPYRIGHT_DATE_NAME = "Copyright 2013-2024 CuriousToꝛvald (minjaesong)" + const val COPYRIGHT_DATE_NAME = "© 2013-2024 CuriousToꝛvald (minjaesong)" val COPYRIGHT_LICENSE: String; get() = Lang["COPYRIGHT_GNU_GPL_3"] const val COPYRIGHT_LICENSE_ENGLISH = "Distributed under GNU GPL 3" const val COPYRIGHT_LICENSE_TERMS_SHORT = """ diff --git a/src/net/torvald/terrarum/audio/AudioMixer.kt b/src/net/torvald/terrarum/audio/AudioMixer.kt index dea33b679..46f23a440 100644 --- a/src/net/torvald/terrarum/audio/AudioMixer.kt +++ b/src/net/torvald/terrarum/audio/AudioMixer.kt @@ -114,7 +114,7 @@ class AudioMixer(val bufferSize: Int): Disposable { get() = tracks[11] val ambientTracks = arrayOf( - ambientTrack1, ambientTrack2 + ambientTrack1, ambientTrack2, ambientTrack3, ambientTrack4 ) var processing = false @@ -214,7 +214,7 @@ class AudioMixer(val bufferSize: Int): Disposable { init { // initialise audio paths // - listOf(musicTrack, ambientTrack1, ambientTrack2).forEach { + listOf(musicTrack, ambientTrack1, ambientTrack2, ambientTrack3, ambientTrack4).forEach { it.filters[0] = Gain(1f) } @@ -228,8 +228,11 @@ class AudioMixer(val bufferSize: Int): Disposable { ambientTracks.forEach { it.filters[1] = Vecto(decibelsToFullscale(24.0).toFloat()) it.filters[2] = Spectro() - amb1plus2.addSidechainInput(it, 1.0) } + + amb1plus2.addSidechainInput(ambientTrack1, 1.0) + amb1plus2.addSidechainInput(ambientTrack2, 1.0) + sfxSumBus.filters[1] = Vecto(0.7071f) sfxSumBus.filters[2] = Spectro() diff --git a/src/net/torvald/terrarum/audio/dsp/BinoPan.kt b/src/net/torvald/terrarum/audio/dsp/BinoPan.kt index 2a0971db9..79f9a7fc3 100644 --- a/src/net/torvald/terrarum/audio/dsp/BinoPan.kt +++ b/src/net/torvald/terrarum/audio/dsp/BinoPan.kt @@ -140,7 +140,7 @@ class BinoPan(var pan: Float, var earDist: Float = EARDIST_DEFAULT): TerrarumAud else "R${pan.absoluteValue.times(100).toIntAndFrac(3,1)}" App.fontSmallNumbers.draw(batch, panLabel, x+3f, y+1f) - App.fontSmallNumbers.draw(batch, "AS:${AudioMixer.SPEED_OF_SOUND.roundToInt()}", x+3f, y+17f) + App.fontSmallNumbers.draw(batch, "H:${earDist.toIntAndFrac(1,3)}", x+3f, y+17f) } override val debugViewHeight = 32 diff --git a/src/net/torvald/terrarum/audio/dsp/LoFi.kt b/src/net/torvald/terrarum/audio/dsp/LoFi.kt index 9cdacc551..d6f9a99c5 100644 --- a/src/net/torvald/terrarum/audio/dsp/LoFi.kt +++ b/src/net/torvald/terrarum/audio/dsp/LoFi.kt @@ -51,6 +51,8 @@ open class LoFi( } private fun saturatorThru(inbuf: List, outbuf: List) { + downForce.fill(1.0f) + for (ch in inbuf.indices) { for (i in inbuf[ch].indices) { val u = inbuf[ch][i] @@ -74,9 +76,10 @@ open class LoFi( } override fun drawDebugView(batch: SpriteBatch, x: Int, y: Int) { + convolver.drawDebugView(batch, x, y) } - override val debugViewHeight = 0 + override val debugViewHeight = 16 override fun copyParamsFrom(other: TerrarumAudioFilter) { this.convolver.copyParamsFrom((other as LoFi).convolver) diff --git a/src/net/torvald/terrarum/ui/BasicDebugInfoWindow.kt b/src/net/torvald/terrarum/ui/BasicDebugInfoWindow.kt index 518ba566c..4f7507ef1 100644 --- a/src/net/torvald/terrarum/ui/BasicDebugInfoWindow.kt +++ b/src/net/torvald/terrarum/ui/BasicDebugInfoWindow.kt @@ -77,11 +77,13 @@ class BasicDebugInfoWindow : UICanvas() { private val KEY_TIMERS = Input.Keys.T // + CONTROL_LEFT private val KEY_WEATHERS = Input.Keys.W // + CONTROL_LEFT private val KEY_AUDIOMIXER = Input.Keys.M // + CONTROL_LEFT + private val KEY_AUDIOMIXER2 = Input.Keys.N // + CONTROL_LEFT private val KEY_CHUNKS = Input.Keys.C // + CONTROL_LEFT private var showTimers = false private var showWeatherInfo = false private var showAudioMixer = false + private var showAudioMixer2 = false private var showChunks = false override fun show() { @@ -139,15 +141,45 @@ class BasicDebugInfoWindow : UICanvas() { // toggle show-something showTimers = showTimers xor (Gdx.input.isKeyJustPressed(KEY_TIMERS) && Gdx.input.isKeyPressed(Keys.CONTROL_LEFT)) showWeatherInfo = showWeatherInfo xor (Gdx.input.isKeyJustPressed(KEY_WEATHERS) && Gdx.input.isKeyPressed(Keys.CONTROL_LEFT)) - showAudioMixer = showAudioMixer xor (Gdx.input.isKeyJustPressed(KEY_AUDIOMIXER) && Gdx.input.isKeyPressed(Keys.CONTROL_LEFT)) + val _showAudioMixer = showAudioMixer xor (Gdx.input.isKeyJustPressed(KEY_AUDIOMIXER) && Gdx.input.isKeyPressed(Keys.CONTROL_LEFT)) + val _showAudioMixer2 = showAudioMixer2 xor (Gdx.input.isKeyJustPressed(KEY_AUDIOMIXER2) && Gdx.input.isKeyPressed(Keys.CONTROL_LEFT)) showChunks = showChunks xor (Gdx.input.isKeyJustPressed(KEY_CHUNKS) && Gdx.input.isKeyPressed(Keys.CONTROL_LEFT)) - App.audioMixer.masterTrack.filters[2].bypass = !showAudioMixer + if (showAudioMixer && _showAudioMixer2) { + showAudioMixer2 = true + showAudioMixer = false + } + else if (showAudioMixer2 && _showAudioMixer) { + showAudioMixer = true + showAudioMixer2 = false + } + else if (_showAudioMixer2 != _showAudioMixer) { + showAudioMixer = _showAudioMixer + showAudioMixer2 = _showAudioMixer2 + } + else if (!_showAudioMixer && !_showAudioMixer2) { + showAudioMixer = false + showAudioMixer2 = false + } + + val bypassScopes = (!showAudioMixer && !showAudioMixer2) + + App.audioMixer.musicTrack.filters[1].bypass = bypassScopes + App.audioMixer.musicTrack.filters[2].bypass = bypassScopes + App.audioMixer.ambientTracks.forEach { + it.filters[1].bypass = bypassScopes + it.filters[2].bypass = bypassScopes + } + App.audioMixer.sfxSumBus.filters[1].bypass = bypassScopes + App.audioMixer.sfxSumBus.filters[2].bypass = bypassScopes + App.audioMixer.masterTrack.filters[2].bypass = bypassScopes + App.audioMixer.masterTrack.filters[3].bypass = bypassScopes drawMain(batch) if (showTimers) drawTimers(batch) if (showWeatherInfo) drawWeatherInfo(batch) if (showAudioMixer) drawAudioMixer(batch) + if (showAudioMixer2) drawAudioMixer2(batch) if (showChunks) drawChunks(batch) } @@ -474,11 +506,11 @@ class BasicDebugInfoWindow : UICanvas() { private val clippingHoldTime = 60000L * 3 // 3 mins private fun drawAudioMixer(batch: SpriteBatch) { + val strips = App.audioMixer.tracks + App.audioMixer.masterTrack - val x = App.scr.width - 186 - (App.audioMixer.tracks.size + 1) * (STRIP_W + stripGap) + val x = App.scr.width - 186 - strips.size * (STRIP_W + stripGap) val y = App.scr.height - 38 - stripH - val strips = App.audioMixer.tracks + App.audioMixer.masterTrack // batch.color = COL_MIXER_BACK // Toolkit.fillArea(batch, x - stripGap, y - stripGap, strips.size * (stripW + stripGap) + stripGap, stripH + 2*stripGap) @@ -502,6 +534,28 @@ class BasicDebugInfoWindow : UICanvas() { } } + private fun drawAudioMixer2(batch: SpriteBatch) { + val strips = App.audioMixer.dynamicTracks.filter { it.isPlaying }.sortedBy { it.playStartedTime }.reversed() + + App.audioMixer.sfxSumBus + App.audioMixer.masterTrack + + val x = App.scr.width - 186 - strips.size * (STRIP_W + stripGap) + val y = App.scr.height - 38 - stripH + + +// batch.color = COL_MIXER_BACK +// Toolkit.fillArea(batch, x - stripGap, y - stripGap, strips.size * (stripW + stripGap) + stripGap, stripH + 2*stripGap) + + strips.forEachIndexed { index, track -> + // get clipping status + track.processor.hasClipping.forEachIndexed { channel, b -> + if (b) mixerLastTimeHadClipping[index][channel] = System.currentTimeMillis() + } + + // draw + drawStrip(batch, x + index * (STRIP_W + stripGap), y, track, index) + } + } + private val dbOver = 6.0 private val dbLow = 60.0