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) {