mirror of
https://github.com/curioustorvald/tsvm.git
synced 2026-06-09 22:54:03 +09:00
changing audio sampling rate to 32000 for mp3 compatibility
This commit is contained in:
0
assets/disk0/home/mp3test.js
Normal file
0
assets/disk0/home/mp3test.js
Normal file
@@ -60,7 +60,7 @@ if (!ipfFun) throw Error("Unknown IPF mode "+IPFMODE)
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
const AUDIO_SAMPLE_SIZE = 2 * ((30000 / FPS) + 1)|0 // times 2 because stereo
|
const AUDIO_SAMPLE_SIZE = 2 * (((32000 / FPS) + 1)|0) // times 2 because stereo
|
||||||
let audioBytesRead = 0
|
let audioBytesRead = 0
|
||||||
const audioFile = (AUDIOTRACK) ? files.open(_G.shell.resolvePathInput(AUDIOTRACK).full) : undefined
|
const audioFile = (AUDIOTRACK) ? files.open(_G.shell.resolvePathInput(AUDIOTRACK).full) : undefined
|
||||||
let audioRemaining = (audioFile) ? audioFile.size : 0
|
let audioRemaining = (audioFile) ? audioFile.size : 0
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
const HW_SAMPLING_RATE = 30000
|
const HW_SAMPLING_RATE = 32000
|
||||||
function printdbg(s) { if (0) serial.println(s) }
|
function printdbg(s) { if (0) serial.println(s) }
|
||||||
function printvis(s) { if (0) println(s) }
|
function printvis(s) { if (0) println(s) }
|
||||||
function sampleToVisual(i) {
|
function sampleToVisual(i) {
|
||||||
@@ -269,4 +269,4 @@ function decodeMS_ADPCM(inPtr, outPtr, blockSize, config) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
exports = { HW_SAMPLING_RATE, randomRound, decodeMS_ADPCM, decodeLPCM }
|
exports = { HW_SAMPLING_RATE, randomRound, decodeMS_ADPCM, decodeLPCM, s8Tou8, s16Tou8, u16Tos16 }
|
||||||
@@ -82,7 +82,7 @@ private class WriteQueueingRunnable(val playhead: AudioAdapter.Playhead, val pcm
|
|||||||
Thread.sleep(6)
|
Thread.sleep(6)
|
||||||
}
|
}
|
||||||
else if (it.pcmUpload) {
|
else if (it.pcmUpload) {
|
||||||
printdbg("Rejecting samples (queueSize: ${it.pcmQueue.size}, uploadLength: ${it.pcmUploadLength})")
|
// printdbg("Rejecting samples (queueSize: ${it.pcmQueue.size}, uploadLength: ${it.pcmUploadLength})")
|
||||||
Thread.sleep(6)
|
Thread.sleep(6)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -106,7 +106,7 @@ class AudioAdapter(val vm: VM) : PeriBase {
|
|||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
internal val DBGPRN = false
|
internal val DBGPRN = false
|
||||||
const val SAMPLING_RATE = 30000
|
const val SAMPLING_RATE = 32000
|
||||||
}
|
}
|
||||||
|
|
||||||
internal val sampleBin = UnsafeHelper.allocate(114687L, this)
|
internal val sampleBin = UnsafeHelper.allocate(114687L, this)
|
||||||
@@ -402,7 +402,7 @@ class AudioAdapter(val vm: VM) : PeriBase {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fun getPcmQueueCapacity() = 2147483647//QUEUE_SIZE[pcmQueueSizeIndex]
|
fun getPcmQueueCapacity() = QUEUE_SIZE[pcmQueueSizeIndex]
|
||||||
|
|
||||||
fun dispose() {
|
fun dispose() {
|
||||||
println("AudioDevice dispose ${parent.renderThreads[index]}")
|
println("AudioDevice dispose ${parent.renderThreads[index]}")
|
||||||
|
|||||||
Reference in New Issue
Block a user