mirror of
https://github.com/curioustorvald/Terrarum.git
synced 2026-06-17 22:14:05 +09:00
turntable to play disc
This commit is contained in:
@@ -24,7 +24,7 @@ import kotlin.math.tanh
|
||||
open class LoFi(
|
||||
staticModule: String, staticPath: String,
|
||||
irModule: String, irPath: String,
|
||||
val crossfeed: Float, gain: Float = 1f / 256f
|
||||
val crossfeed: Float, gain: Float = 1f / 256f, saturationLim: Float = 1f
|
||||
): TerrarumAudioFilter(), DspCompressor {
|
||||
override val downForce = arrayOf(1.0f, 1.0f)
|
||||
|
||||
@@ -72,8 +72,9 @@ open class LoFi(
|
||||
* Default function is `tanh(x)`
|
||||
*/
|
||||
open fun saturate(v: Float): Float {
|
||||
return tanh(v)
|
||||
return K * tanh(v / K)
|
||||
}
|
||||
private val K = saturationLim.coerceIn(0f, 1f)
|
||||
|
||||
override fun drawDebugView(batch: SpriteBatch, x: Int, y: Int) {
|
||||
convolver.drawDebugView(batch, x, y)
|
||||
|
||||
@@ -7,9 +7,9 @@ import net.torvald.terrarum.ModMgr
|
||||
*
|
||||
* Created by minjaesong on 2024-01-24.
|
||||
*/
|
||||
class Phono(irModule: String, irPath: String, crossfeed: Float, gain: Float) : LoFi(
|
||||
class Phono(irModule: String, irPath: String, crossfeed: Float, gain: Float, saturationLim: Float) : LoFi(
|
||||
"basegame", "audio/effects/static/phono_pops.ogg",
|
||||
irModule, irPath, crossfeed, gain
|
||||
irModule, irPath, crossfeed, gain, saturationLim
|
||||
)
|
||||
|
||||
/**
|
||||
@@ -17,9 +17,9 @@ class Phono(irModule: String, irPath: String, crossfeed: Float, gain: Float) : L
|
||||
*
|
||||
* Created by minjaesong on 2024-01-24.
|
||||
*/
|
||||
class Tape(irModule: String, irPath: String, crossfeed: Float, gain: Float) : LoFi(
|
||||
class Tape(irModule: String, irPath: String, crossfeed: Float, gain: Float, saturationLim: Float) : LoFi(
|
||||
"basegame", "audio/effects/static/tape_hiss.ogg",
|
||||
irModule, irPath, crossfeed, gain
|
||||
irModule, irPath, crossfeed, gain, saturationLim
|
||||
)
|
||||
|
||||
/**
|
||||
@@ -29,7 +29,7 @@ class Tape(irModule: String, irPath: String, crossfeed: Float, gain: Float) : Lo
|
||||
*
|
||||
* Created by minjaesong on 2024-01-24.
|
||||
*/
|
||||
class Holo(irModule: String, irPath: String, crossfeed: Float, gain: Float) : LoFi(
|
||||
class Holo(irModule: String, irPath: String, crossfeed: Float, gain: Float, saturationLim: Float) : LoFi(
|
||||
"basegame", "audio/effects/static/film_pops_lowpass.ogg",
|
||||
irModule, irPath, crossfeed, gain
|
||||
irModule, irPath, crossfeed, gain, saturationLim
|
||||
)
|
||||
Reference in New Issue
Block a user