option for speaker/headphone selection for appropriate panning

This commit is contained in:
minjaesong
2024-01-14 19:37:41 +09:00
parent 871396cd92
commit e89e32eeea
6 changed files with 30 additions and 6 deletions

View File

@@ -75,11 +75,16 @@ class BinoPan(var pan: Float, var earDist: Float = EARDIST_DEFAULT): TerrarumAud
val timeDiffMax = earDist.coerceAtMost(EARDIST_MAX) / AudioMixer.SPEED_OF_SOUND * SAMPLING_RATEF
val angle = pan * HALF_PI
val delayInSamples = (timeDiffMax * FastMath.sin(angle)).absoluteValue
val delayInSamples = if (App.getConfigString("audio_speaker_setup") == "headphone")
(timeDiffMax * FastMath.sin(angle)).absoluteValue
else 0f
val volMultDbThis = PANNING_CONST * pan.absoluteValue
val volMultFsThis = decibelsToFullscale(volMultDbThis).toFloat()
val volMultFsOther = 1f / volMultFsThis
val volMultFsOther = if (App.getConfigString("audio_speaker_setup") == "headphone")
1f / volMultFsThis
else
(1f - pan.absoluteValue).coerceIn(0f, 1f)
if (pan >= 0) {
delays[L] = delayInSamples