btex stuffs

This commit is contained in:
minjaesong
2024-04-24 01:13:46 +09:00
parent e2a87d0e14
commit 76dd9a98e4
18 changed files with 602 additions and 182 deletions

View File

@@ -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()

View File

@@ -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