playwav now resamples LPCM

This commit is contained in:
minjaesong
2023-01-05 18:22:03 +09:00
parent 049064cca5
commit 006ff5015b
4 changed files with 203 additions and 34 deletions

View File

@@ -38,8 +38,8 @@ class AudioJSR223Delegate(private val vm: VM) {
fun setSampleUploadLength(playhead: Int, length: Int) { getPlayhead(playhead)?.pcmUploadLength = length and 65535 }
fun setSamplingRate(playhead: Int, rate: Int) { getPlayhead(playhead)?.setSamplingRate(rate) }
fun getSamplingRate(playhead: Int) = getPlayhead(playhead)?.getSamplingRate()
// fun setSamplingRate(playhead: Int, rate: Int) { getPlayhead(playhead)?.setSamplingRate(rate) }
// fun getSamplingRate(playhead: Int) = getPlayhead(playhead)?.getSamplingRate()
fun startSampleUpload(playhead: Int) { getPlayhead(playhead)?.pcmUpload = true }

View File

@@ -371,12 +371,12 @@ class AudioAdapter(val vm: VM) : PeriBase {
}
}
fun getSamplingRate() = 30000 - ((bpm - 24).and(255) or tickRate.and(255).shl(8)).toShort().toInt()
/*fun getSamplingRate() = 30000 - ((bpm - 24).and(255) or tickRate.and(255).shl(8)).toShort().toInt()
fun setSamplingRate(rate: Int) {
val rateDiff = (rate.coerceIn(0, 95535) - 30000).toShort().toInt()
bpm = rateDiff.and(255) + 24
tickRate = rateDiff.ushr(8).and(255)
}
}*/
fun resetParams() {
position = 0