TAV: video with TAD audio playback

This commit is contained in:
minjaesong
2025-10-24 18:03:23 +09:00
parent 3adc50365b
commit 56a1bac19a
8 changed files with 19 additions and 12 deletions

View File

@@ -107,10 +107,11 @@ class AudioJSR223Delegate(private val vm: VM) {
fun tadIsBusy() = getFirstSnd()?.mmio_read(44L)?.toInt() == 1
fun tadUploadDecoded(playhead: Int) {
fun tadUploadDecoded(playhead: Int, sampleLength: Int) {
if (sampleLength > 32768) throw Error("Sample size too long: expected <= 32768, got $sampleLength")
getFirstSnd()?.let { snd ->
val ba = ByteArray(65536) // 32768 samples * 2 channels
UnsafeHelper.memcpyRaw(null, snd.tadDecodedBin.ptr, ba, UnsafeHelper.getArrayOffset(ba), 65536)
val ba = ByteArray(sampleLength * 2) // 32768 samples * 2 channels
UnsafeHelper.memcpyRaw(null, snd.tadDecodedBin.ptr, ba, UnsafeHelper.getArrayOffset(ba), sampleLength * 2L)
snd.playheads[playhead].pcmQueue.addLast(ba)
}
}

View File

@@ -6691,7 +6691,7 @@ class GraphicsJSR223Delegate(private val vm: VM) {
dbgOut["qY"] = qYGlobal
dbgOut["qCo"] = qCoGlobal
dbgOut["qCg"] = qCgGlobal
dbgOut["frameMode"] = "G"
dbgOut["frameMode"] = " "
val gpu = (vm.peripheralTable[1].peripheral as GraphicsAdapter)

View File

@@ -89,8 +89,8 @@ internal class UnsafePtr(pointer: Long, allocSize: Long, private val caller: Any
//// You may break the glass and use this tool when some fucking incomprehensible bugs ("vittujen vitun bugit")
//// appear (e.g. getting garbage values when it fucking shouldn't)
if (destroyed) { throw DanglingPointerException("The pointer is already destroyed ($this)") }
if (index !in 0 until size) throw AddressOverflowException("Index: $index; alloc size: $size; pointer: ${this}\n${Thread.currentThread().stackTrace.joinToString("\n", limit=10) { " $it" }}")
// if (destroyed) { throw DanglingPointerException("The pointer is already destroyed ($this)") }
// if (index !in 0 until size) throw AddressOverflowException("Index: $index; alloc size: $size; pointer: ${this}\n${Thread.currentThread().stackTrace.joinToString("\n", limit=10) { " $it" }}")
}
operator fun get(index: Long): Byte {