mirror of
https://github.com/curioustorvald/Terrarum.git
synced 2026-06-13 12:04:06 +09:00
btex stuffs
This commit is contained in:
@@ -7,6 +7,10 @@ import com.badlogic.gdx.utils.Disposable
|
||||
*/
|
||||
abstract class AudioBank : Disposable {
|
||||
|
||||
/**
|
||||
* If the audio bank is a virtual instrument, set this property to `true`; if the audio bank reads audio
|
||||
* sample directly from the disk, set it to `false`
|
||||
*/
|
||||
open val notCopyable: Boolean = false
|
||||
|
||||
protected val hash = System.nanoTime()
|
||||
|
||||
@@ -67,16 +67,22 @@ class AudioProcessBuf(val inputSamplingRate: Int, val audioReadFun: (FloatArray,
|
||||
|
||||
private val TAPS = 4 // 2*a tap lanczos intp. Lower = greater artefacts
|
||||
|
||||
private val Lcache = HashMap<Long, Double>(1048576)
|
||||
// private val Lcache = HashMap<Long, Double>(1048576)
|
||||
fun L(x: Double): Double {
|
||||
return Lcache.getOrPut(x.toBits()) { // converting double to longbits allows faster cache lookup?!
|
||||
/*return Lcache.getOrPut(x.toBits()) { // converting double to longbits allows faster cache lookup?!
|
||||
if (x.absoluteValue < epsilon)
|
||||
1.0
|
||||
else if (-TAPS <= x && x < TAPS)
|
||||
(TAPS * sin(PI * x) * sin(PI * x / TAPS)) / (PI * PI * x * x)
|
||||
else
|
||||
0.0
|
||||
}
|
||||
}*/
|
||||
return if (x.absoluteValue < epsilon)
|
||||
1.0
|
||||
else if (-TAPS <= x && x < TAPS)
|
||||
(TAPS * sin(PI * x) * sin(PI * x / TAPS)) / (PI * PI * x * x)
|
||||
else
|
||||
0.0
|
||||
}
|
||||
|
||||
const val MP3_CHUNK_SIZE = 1152 // 1152 for 32k-48k, 576 for 16k-24k, 384 for 8k-12k
|
||||
|
||||
Reference in New Issue
Block a user