From ac409bf961254ddb0a8cf187040941321844a747 Mon Sep 17 00:00:00 2001 From: minjaesong Date: Sun, 3 May 2026 16:54:42 +0900 Subject: [PATCH] reverting changes :/ --- terranmon.txt | 1 + tsvm_core/src/net/torvald/tsvm/peripheral/AudioAdapter.kt | 6 ++---- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/terranmon.txt b/terranmon.txt index f87c88f..2f224c5 100644 --- a/terranmon.txt +++ b/terranmon.txt @@ -2112,6 +2112,7 @@ TODO: [x] 4THSYM.it: pitchbend is wrong, some notes keep playing (loudly!) even if new notes are emitted [x] `*2taud.py`: some notes are emitted with wrong volume-set command. Tested with GSLINGER.mod: on order 0x15 channel 1, mod2taud.py emits volume 8 -- also many of the effects are dropped. Suggested solution: currently all converters write default volume to the voleff when original modules (.mod/.s3m/.it) specify nothing; we should also write nothing and let the engine resolve the value just like other trackers do (also we now have "Instrument Global Volume" on instrument definition unlike the other time). This bug may affecting other formats, not just mod2taud.py, as well [x] nearly_there_.mod: `C#5 SD300 / ... / C-5 SD200 / A#4 / G#4 (at tickspeed 4)`: every `C-5 SD200` (there are four occurances) gets skipped + [ ] low-number voleffs are too quiet [ ] scale Oxxxx when samples get resampled [ ] implement bitcrusher and overdrive (eff sym '8' and '9') diff --git a/tsvm_core/src/net/torvald/tsvm/peripheral/AudioAdapter.kt b/tsvm_core/src/net/torvald/tsvm/peripheral/AudioAdapter.kt index 1a5f33a..bd15e08 100644 --- a/tsvm_core/src/net/torvald/tsvm/peripheral/AudioAdapter.kt +++ b/tsvm_core/src/net/torvald/tsvm/peripheral/AudioAdapter.kt @@ -2371,8 +2371,6 @@ class AudioAdapter(val vm: VM) : PeriBase(VM.PERITYPE_SOUND) { } } - private fun Double.sqrt() = Math.sqrt(this) - internal fun generateTrackerAudio(playhead: Playhead): ByteArray? { val ts = playhead.trackerState ?: return null @@ -2410,7 +2408,7 @@ class AudioAdapter(val vm: VM) : PeriBase(VM.PERITYPE_SOUND) { val swingScale = 1.0 + voice.randomVolBias / 255.0 // Volume envelope is bypassed (treated as unity) when S $77 has disabled it. val effEnvVol = if (voice.volEnvOn) voice.envVolume else 1.0 - val vol = effEnvVol.sqrt() * voice.fadeoutVolume * (voice.rowVolume / 63.0).sqrt() * + val vol = effEnvVol * voice.fadeoutVolume * (voice.rowVolume / 63.0) * swingScale * gvol * mvol * instGv * playhead.masterVolume / 255.0 val pan = if (voice.hasPanEnv && voice.panEnvOn) { val envPanRaw = (voice.envPan * 255.0).roundToInt().coerceIn(0, 255) @@ -2440,7 +2438,7 @@ class AudioAdapter(val vm: VM) : PeriBase(VM.PERITYPE_SOUND) { val instGv = bgInst.instGlobalVolume / 255.0 val swingScale = 1.0 + bg.randomVolBias / 255.0 val effEnvVol = if (bg.volEnvOn) bg.envVolume else 1.0 - val vol = effEnvVol.sqrt() * bg.fadeoutVolume * (bg.rowVolume / 63.0).sqrt() * + val vol = effEnvVol * bg.fadeoutVolume * (bg.rowVolume / 63.0) * swingScale * gvol * mvol * instGv * playhead.masterVolume / 255.0 val pan = if (bg.hasPanEnv && bg.panEnvOn) { val envPanRaw = (bg.envPan * 255.0).roundToInt().coerceIn(0, 255)