narrower mixer gui

This commit is contained in:
minjaesong
2023-11-20 17:59:46 +09:00
parent d3d52b0b6f
commit 1b2fdf38de
3 changed files with 21 additions and 9 deletions

View File

@@ -44,7 +44,7 @@ object AudioMixer: Disposable {
val tracks = Array(5) { TerrarumAudioMixerTrack(
if (it == 0) "BGM"
else if (it == 1) "AMB"
else if (it == 2) "Sfx Mix"
else if (it == 2) "SFX"
else if (it == 3) "GUI"
else if (it == 4) "BUS1"
else "Trk${it+1}", isBus = (it == 4)

View File

@@ -93,9 +93,9 @@ class MixerTrackProcessor(val bufferSize: Int, val rate: Int, val track: Terraru
// get samples and apply the fader
if (track.isMaster || track.isBus) {
// TEST CODE must combine all the inputs
// TODO combine all the inputs
track.sidechainInputs[TerrarumAudioMixerTrack.INDEX_BGM]?.let { (side, mix) ->
samplesL0 = side.processor.fout0[0].applyVolume((mix * track.volume).toFloat())
samplesL0 = side.processor.fout0[0].applyVolume((mix * track.volume).toFloat()) // must not applyVolumeInline
samplesR0 = side.processor.fout0[1].applyVolume((mix * track.volume).toFloat())
samplesL1 = side.processor.fout1[0].applyVolume((mix * track.volume).toFloat())
samplesR1 = side.processor.fout1[1].applyVolume((mix * track.volume).toFloat())
@@ -129,6 +129,14 @@ class MixerTrackProcessor(val bufferSize: Int, val rate: Int, val track: Terraru
}*/
}
// source channel: skip processing if there's no active input
// else if (track.getSidechains().any { it != null && !it.isBus && !it.isMaster && !it.streamPlaying } && !track.streamPlaying) {
else if (!track.streamPlaying) {
samplesL0 = null
samplesR0 = null
samplesL1 = null
samplesR1 = null
}
else {
samplesL0 = streamBuf.getL0(track.volume)
samplesR0 = streamBuf.getR0(track.volume)
@@ -210,11 +218,12 @@ class MixerTrackProcessor(val bufferSize: Int, val rate: Int, val track: Terraru
}
private fun FloatArray.applyVolume(volume: Float) = FloatArray(this.size) { (this[it] * volume) }
private fun FloatArray.applyVolumeInline(volume: Float) {
/*private fun FloatArray.applyVolumeInline(volume: Float): FloatArray {
for (i in this.indices) {
this[i] *= volume
}
}
return this
}*/
private fun resumeSidechainsRecursively(track: TerrarumAudioMixerTrack?, caller: String) {

View File

@@ -373,7 +373,7 @@ class BasicDebugInfoWindow : UICanvas() {
}
}
private val stripW = 64
private val stripW = 56
private val stripGap = 1
private val stripFilterHeight = 32
private val stripFaderHeight = 200
@@ -475,11 +475,14 @@ class BasicDebugInfoWindow : UICanvas() {
}
// fader
val sliderX = x + stripW - 12
// slider text
val dB = track.dBfs
val dBstr = dB.toIntAndFrac(2,1)
val dBfs = dB.coerceIn(-dbLow, 0.0).plus(dbLow).div(dbLow).toFloat()
batch.color = FILTER_NAME_ACTIVE
App.fontSmallNumbers.draw(batch, dBstr, x+32f, faderY+1f)
App.fontSmallNumbers.draw(batch, dBstr, sliderX - 16f, faderY+1f)
// fader trough
batch.color = COL_METER_TROUGH
@@ -513,10 +516,10 @@ class BasicDebugInfoWindow : UICanvas() {
// slider trough
batch.color = COL_METER_TROUGH
Toolkit.fillArea(batch, x + 48, faderY + 16, 2, meterTroughHeight)
Toolkit.fillArea(batch, sliderX, faderY + 16, 2, meterTroughHeight)
// slider handle
drawFaderHandle(batch, x + 48f, faderY + 18f + meterHeight - dBfs * meterHeight)
drawFaderHandle(batch, sliderX.toFloat(), faderY + 18f + meterHeight - dBfs * meterHeight)
// currently streaming
if (track.streamPlaying) {