fix: track fader was applied at PRE instead of POST

This commit is contained in:
minjaesong
2024-01-24 19:10:04 +09:00
parent 2016be562b
commit b67c0837d8
2 changed files with 16 additions and 6 deletions

View File

@@ -184,8 +184,8 @@ class MixerTrackProcessor(bufferSize: Int, val rate: Int, val track: TerrarumAud
// add all up
sidechains.forEach { (side, mix) ->
for (i in samplesL1.indices) {
samplesL1[i] += side.processor.fout1[0][i] * (mix * track.volume).toFloat()
samplesR1[i] += side.processor.fout1[1][i] * (mix * track.volume).toFloat()
samplesL1[i] += side.processor.fout1[0][i] * mix.toFloat()
samplesR1[i] += side.processor.fout1[1][i] * mix.toFloat()
}
}
}
@@ -198,7 +198,7 @@ class MixerTrackProcessor(bufferSize: Int, val rate: Int, val track: TerrarumAud
bufEmpty = true
}
else {
streamBuf!!.getLR(track.volume).let {
streamBuf!!.getLR().let {
samplesL1 = it.first
samplesR1 = it.second
}
@@ -225,6 +225,14 @@ class MixerTrackProcessor(bufferSize: Int, val rate: Int, val track: TerrarumAud
}
// apply fader at post
fout1.forEach { ch ->
ch.forEachIndexed { index, sample ->
ch[index] = (sample * track.volume).toFloat()
}
}
// scan the finished sample for mapping signal level and clipping detection
fout1.map { it.maxOf { it.absoluteValue } }.forEachIndexed { index, fl ->
maxSigLevel[index] = fl.toDouble()