music playlist is working again

This commit is contained in:
minjaesong
2023-11-18 13:13:19 +09:00
parent 7219b95542
commit 62c7b36a46
6 changed files with 56 additions and 19 deletions

View File

@@ -34,6 +34,28 @@ class AudioProcessBuf(val size: Int) {
updateFloats()
}
// reusing a buffer causes tons of blips in the sound? how??
/*private val L0buf = FloatArray(size / 4)
private val R0buf = FloatArray(size / 4)
private val L1buf = FloatArray(size / 4)
private val R1buf = FloatArray(size / 4)
fun getL0(volume: Double): FloatArray {
for (i in L0buf.indices) { L0buf[i] = (volume * fbuf0[2*i]).toFloat() }
return L0buf
}
fun getR0(volume: Double): FloatArray {
for (i in R0buf.indices) { R0buf[i] = (volume * fbuf0[2*i+1]).toFloat() }
return R0buf
}
fun getL1(volume: Double): FloatArray {
for (i in L1buf.indices) { L1buf[i] = (volume * fbuf1[2*i]).toFloat() }
return L1buf
}
fun getR1(volume: Double): FloatArray {
for (i in R1buf.indices) { R1buf[i] = (volume * fbuf1[2*i+1]).toFloat() }
return R1buf
}*/
fun getL0(volume: Double) = FloatArray(size / 4) { (volume * fbuf0[2*it]).toFloat() }
fun getR0(volume: Double) = FloatArray(size / 4) { (volume * fbuf0[2*it+1]).toFloat() }
fun getL1(volume: Double) = FloatArray(size / 4) { (volume * fbuf1[2*it]).toFloat() }