emulator: audio debugger

This commit is contained in:
minjaesong
2023-01-22 14:07:42 +09:00
parent 38081a2c36
commit 39a781ff71
8 changed files with 191 additions and 11 deletions

View File

@@ -77,7 +77,7 @@ private class WriteQueueingRunnable(val playhead: AudioAdapter.Playhead, val pcm
it.pcmQueue.addLast(samples)
it.pcmUploadLength = 0
it.position += 1
it.position = it.pcmQueue.size
Thread.sleep(6)
}
else if (it.pcmUpload) {
@@ -325,14 +325,14 @@ class AudioAdapter(val vm: VM) : PeriBase(VM.PERITYPE_SOUND) {
internal class PlayInstSkip(arg: Int) : PlayInstruction(arg)
internal object PlayInstNop : PlayInstruction(0)
internal class Playhead(
class Playhead(
private val parent: AudioAdapter,
val index: Int,
var position: Int = 0,
var pcmUploadLength: Int = 0,
var masterVolume: Int = 0,
var masterPan: Int = 0,
var masterPan: Int = 128,
// var samplingRateMult: ThreeFiveMiniUfloat = ThreeFiveMiniUfloat(32),
var bpm: Int = 120, // "stored" as 96
var tickRate: Int = 6,
@@ -435,7 +435,7 @@ class AudioAdapter(val vm: VM) : PeriBase(VM.PERITYPE_SOUND) {
}
}
internal data class TaudPlayData(
data class TaudPlayData(
var note: Int, // 0..65535
var instrment: Int, // 0..255
var volume: Int, // 0..63
@@ -471,8 +471,8 @@ class AudioAdapter(val vm: VM) : PeriBase(VM.PERITYPE_SOUND) {
}
internal data class TaudInstVolEnv(var volume: Int, var offset: ThreeFiveMiniUfloat)
internal data class TaudInst(
data class TaudInstVolEnv(var volume: Int, var offset: ThreeFiveMiniUfloat)
data class TaudInst(
var samplePtr: Int, // 17-bit number
var sampleLength: Int,
var samplingRate: Int,

View File

@@ -49,6 +49,7 @@ class OpenALBufferedAudioDevice(
private var renderedSeconds = 0f
private val secondsPerBuffer: Float
private var bytes: ByteArray? = null
private var bytesLength = 2
private val tempBuffer: ByteBuffer
/**
@@ -75,6 +76,7 @@ class OpenALBufferedAudioDevice(
bytes!![ii++] = sample
i++
}
bytesLength = ii
writeSamples(bytes!!, 0, numSamples * 2)
}
@@ -89,6 +91,7 @@ class OpenALBufferedAudioDevice(
bytes!![ii++] = (sample.toInt() shr 8 and 0xFF).toByte()
i++
}
bytesLength = ii
writeSamples(bytes!!, 0, numSamples * 2)
}
@@ -105,6 +108,7 @@ class OpenALBufferedAudioDevice(
bytes!![ii++] = (intSample shr 8 and 0xFF).toByte()
i++
}
bytesLength = ii
writeSamples(bytes!!, 0, numSamples * 2)
}

View File

@@ -67,7 +67,7 @@ open class RomBank(vm: VM, romfile: File, bankCount: Int) : RamBank(vm, bankCoun
val bytes = romfile.readBytes()
UnsafeHelper.memcpyRaw(bytes, 0, null, mem.ptr, bytes.size.toLong())
}
override val typestring = "ROMB"
override val typestring = "romb"
override fun poke(addr: Long, byte: Byte) {
}