mirror of
https://github.com/curioustorvald/Terrarum.git
synced 2026-03-16 16:46:07 +09:00
binopan speaker vol compensation; dynamic source lamp fix
This commit is contained in:
@@ -112,11 +112,13 @@ class BinoPan(var pan: Float, var earDist: Float = EARDIST_DEFAULT): TerrarumAud
|
|||||||
thru("L", -50f, inbuf[L], outLs, delayLineL) // 50 will become 59.036 on panningFieldMap
|
thru("L", -50f, inbuf[L], outLs, delayLineL) // 50 will become 59.036 on panningFieldMap
|
||||||
thru("R", +50f, inbuf[R], outRs, delayLineR)
|
thru("R", +50f, inbuf[R], outRs, delayLineR)
|
||||||
|
|
||||||
|
val vol = if (App.getConfigString("audio_speaker_setup") == "headphone") decibelsToFullscale(-1.2).toFloat() else 1f
|
||||||
|
|
||||||
for (i in 0 until App.audioBufferSize) {
|
for (i in 0 until App.audioBufferSize) {
|
||||||
val outL = (outLs[L][i] + outRs[L][i]) / 2f
|
val outL = (outLs[L][i] + outRs[L][i]) / 2f
|
||||||
val outR = (outLs[R][i] + outRs[R][i]) / 2f
|
val outR = (outLs[R][i] + outRs[R][i]) / 2f
|
||||||
outbuf[L][i] = outL
|
outbuf[L][i] = outL * vol
|
||||||
outbuf[R][i] = outR
|
outbuf[R][i] = outR * vol
|
||||||
}
|
}
|
||||||
|
|
||||||
push(inbuf[L], delayLineL)
|
push(inbuf[L], delayLineL)
|
||||||
|
|||||||
@@ -455,7 +455,7 @@ class BasicDebugInfoWindow : UICanvas() {
|
|||||||
fun getSmoothingFactor(sampleCount: Int) = (1.0 - (256.0 / sampleCount))
|
fun getSmoothingFactor(sampleCount: Int) = (1.0 - (256.0 / sampleCount))
|
||||||
val PEAK_SMOOTHING_FACTOR = getSmoothingFactor(640)
|
val PEAK_SMOOTHING_FACTOR = getSmoothingFactor(640)
|
||||||
val FFT_SMOOTHING_FACTOR = getSmoothingFactor(2048)
|
val FFT_SMOOTHING_FACTOR = getSmoothingFactor(2048)
|
||||||
val LAMP_SMOOTHING_FACTOR = getSmoothingFactor(3200)
|
val LAMP_SMOOTHING_FACTOR = getSmoothingFactor(640)
|
||||||
val RMS_SMOOTHING_FACTOR = getSmoothingFactor(12000)
|
val RMS_SMOOTHING_FACTOR = getSmoothingFactor(12000)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -526,12 +526,12 @@ class BasicDebugInfoWindow : UICanvas() {
|
|||||||
Toolkit.fillArea(batch, x + miniW / 2f, y.toFloat(), panw, 2f)
|
Toolkit.fillArea(batch, x + miniW / 2f, y.toFloat(), panw, 2f)
|
||||||
|
|
||||||
// voltage lamp
|
// voltage lamp
|
||||||
|
batch.color = COL_METER_TROUGH
|
||||||
|
Toolkit.fillArea(batch, x, y + 2, miniW, 8)
|
||||||
for (ch in 0..1) {
|
for (ch in 0..1) {
|
||||||
val fs =
|
val fs =
|
||||||
FastMath.interpolateLinear(LAMP_SMOOTHING_FACTOR, track.processor.maxSigLevel[ch], oldPeakDS[index][ch])
|
FastMath.interpolateLinear(LAMP_SMOOTHING_FACTOR, track.processor.maxSigLevel[ch], oldPeakDS[index][ch])
|
||||||
batch.color = COL_METER_TROUGH
|
|
||||||
val intensity = fullscaleToDecibels(fs.coerceAtMost(1.0)).plus(dbLow).div(dbLow).coerceIn(0.0, 1.0).toFloat()
|
val intensity = fullscaleToDecibels(fs.coerceAtMost(1.0)).plus(dbLow).div(dbLow).coerceIn(0.0, 1.0).toFloat()
|
||||||
Toolkit.fillArea(batch, x, y + 2, miniW, 8)
|
|
||||||
batch.color = if (fs > 1.0) LAMP_OVERRANGE else Color(0.1f, intensity, 0.1f, 1f)
|
batch.color = if (fs > 1.0) LAMP_OVERRANGE else Color(0.1f, intensity, 0.1f, 1f)
|
||||||
Toolkit.fillArea(batch, x + 2 + 13*ch, y + 4, 11, 4)
|
Toolkit.fillArea(batch, x + 2 + 13*ch, y + 4, 11, 4)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user