mirror of
https://github.com/curioustorvald/Terrarum.git
synced 2026-03-07 12:21:52 +09:00
convolver to ignore FFT interruptedexception
This commit is contained in:
@@ -47,9 +47,12 @@ class Convolv(irModule: String, irPath: String, val crossfeed: Float, gain: Floa
|
||||
private val fftOutR = FloatArray(fftLen)
|
||||
|
||||
private fun convolve(x: ComplexArray, h: ComplexArray, output: FloatArray) {
|
||||
FFT.fftInto(x, fftIn)
|
||||
fftIn.mult(h, fftMult)
|
||||
FFT.ifftAndGetReal(fftMult, output)
|
||||
try {
|
||||
FFT.fftInto(x, fftIn)
|
||||
fftIn.mult(h, fftMult)
|
||||
FFT.ifftAndGetReal(fftMult, output)
|
||||
}
|
||||
catch (_: InterruptedException) { /* ignore it */ }
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -28,12 +28,12 @@ open class LoFi(
|
||||
internal val convolver = Convolv(irModule, irPath, crossfeed, gain)
|
||||
|
||||
private val immAfterStaticMix = listOf(FloatArray(App.audioBufferSize), FloatArray(App.audioBufferSize))
|
||||
private val immAfterConvolv = listOf(FloatArray(App.audioBufferSize), FloatArray(App.audioBufferSize))
|
||||
private val immAfterSat = listOf(FloatArray(App.audioBufferSize), FloatArray(App.audioBufferSize))
|
||||
|
||||
override fun thru(inbuf: List<FloatArray>, outbuf: List<FloatArray>) {
|
||||
staticMixThru(inbuf, immAfterStaticMix)
|
||||
convolver.thru(immAfterStaticMix, immAfterConvolv)
|
||||
saturatorThru(immAfterConvolv, outbuf)
|
||||
saturatorThru(immAfterStaticMix, immAfterSat)
|
||||
convolver.thru(immAfterSat, outbuf)
|
||||
}
|
||||
|
||||
private fun staticMixThru(inbuf: List<FloatArray>, outbuf: List<FloatArray>) {
|
||||
|
||||
Reference in New Issue
Block a user