mirror of
https://github.com/curioustorvald/tsvm.git
synced 2026-06-08 14:24:05 +09:00
tracker engine bugfixes
This commit is contained in:
@@ -47,7 +47,7 @@ instBytes[4] = 0x00; instBytes[5] = 0x7D; // samplingRate = 32000
|
|||||||
instBytes[10] = 0x00; instBytes[11] = 0x01; // sampleLoopEnd = 256 (whole sample)
|
instBytes[10] = 0x00; instBytes[11] = 0x01; // sampleLoopEnd = 256 (whole sample)
|
||||||
instBytes[12] = 1; // loopMode = 1 (forward)
|
instBytes[12] = 1; // loopMode = 1 (forward)
|
||||||
instBytes[16] = 255; instBytes[17] = 0; // envelope: vol=255, hold
|
instBytes[16] = 255; instBytes[17] = 0; // envelope: vol=255, hold
|
||||||
audio.uploadInstrument(0, instBytes);
|
audio.uploadInstrument(1, instBytes);
|
||||||
|
|
||||||
// -- 3. Piano-roll builder -----------------------------------------------------
|
// -- 3. Piano-roll builder -----------------------------------------------------
|
||||||
// Source convention: C1=0, C2=12, C3=24, C4=36 (i.e. C3=24, octave every 12).
|
// Source convention: C1=0, C2=12, C3=24, C4=36 (i.e. C3=24, octave every 12).
|
||||||
@@ -148,7 +148,7 @@ for (var p = 0; p < numPatterns; p++) {
|
|||||||
var off = r * 8;
|
var off = r * 8;
|
||||||
patBytes[off] = noteVal & 0xFF;
|
patBytes[off] = noteVal & 0xFF;
|
||||||
patBytes[off + 1] = (noteVal >> 8) & 0xFF;
|
patBytes[off + 1] = (noteVal >> 8) & 0xFF;
|
||||||
patBytes[off + 2] = 0; // instrument 0
|
patBytes[off + 2] = 1; // instrument 1
|
||||||
patBytes[off + 3] = 63; // volume
|
patBytes[off + 3] = 63; // volume
|
||||||
patBytes[off + 4] = 31; // pan (centre)
|
patBytes[off + 4] = 31; // pan (centre)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1226,6 +1226,7 @@ class AudioAdapter(val vm: VM) : PeriBase(VM.PERITYPE_SOUND) {
|
|||||||
private fun triggerNote(voice: Voice, noteVal: Int, instId: Int, volOverride: Int) {
|
private fun triggerNote(voice: Voice, noteVal: Int, instId: Int, volOverride: Int) {
|
||||||
if (instId != 0) voice.instrumentId = instId
|
if (instId != 0) voice.instrumentId = instId
|
||||||
val inst = instruments[voice.instrumentId]
|
val inst = instruments[voice.instrumentId]
|
||||||
|
voice.tonePortaTarget = -1 // fresh note trigger cancels any running porta
|
||||||
voice.samplePos = inst.samplePlayStart.toDouble()
|
voice.samplePos = inst.samplePlayStart.toDouble()
|
||||||
voice.forward = true
|
voice.forward = true
|
||||||
voice.active = true
|
voice.active = true
|
||||||
@@ -1301,7 +1302,6 @@ class AudioAdapter(val vm: VM) : PeriBase(VM.PERITYPE_SOUND) {
|
|||||||
voice.vibratoActive = false
|
voice.vibratoActive = false
|
||||||
voice.tremoloActive = false
|
voice.tremoloActive = false
|
||||||
voice.retrigActive = false
|
voice.retrigActive = false
|
||||||
voice.tonePortaTarget = -1
|
|
||||||
voice.tempoSlideDir = 0
|
voice.tempoSlideDir = 0
|
||||||
voice.volColSlideUp = 0; voice.volColSlideDown = 0
|
voice.volColSlideUp = 0; voice.volColSlideDown = 0
|
||||||
voice.panColSlideRight = 0; voice.panColSlideLeft = 0
|
voice.panColSlideRight = 0; voice.panColSlideLeft = 0
|
||||||
|
|||||||
@@ -238,7 +238,7 @@ class AudioMenu(parent: VMEmuExecutable, x: Int, y: Int, w: Int, h: Int) : EmuMe
|
|||||||
FONT.draw(batch, "Tickrate", x, y + 6*FONT.H)
|
FONT.draw(batch, "Tickrate", x, y + 6*FONT.H)
|
||||||
|
|
||||||
batch.color = COL_ACTIVE3
|
batch.color = COL_ACTIVE3
|
||||||
FONT.drawRalign(batch, "${ahead.trackerState?.cuePos}:${ahead.trackerState?.rowIndex?.toString()?.uppercase()?.padStart(2,'0')}", x + 84, y + 2*FONT.H)
|
FONT.drawRalign(batch, "${ahead.trackerState?.cuePos?.toString(16)?.uppercase()?.padStart(2,'0')}:${ahead.trackerState?.rowIndex?.toString()?.uppercase()?.padStart(2,'0')}", x + 84, y + 2*FONT.H)
|
||||||
FONT.drawRalign(batch, "${ahead.masterVolume}", x + 84, y + 3*FONT.H)
|
FONT.drawRalign(batch, "${ahead.masterVolume}", x + 84, y + 3*FONT.H)
|
||||||
FONT.drawRalign(batch, "${ahead.masterPan}", x + 84, y + 4*FONT.H)
|
FONT.drawRalign(batch, "${ahead.masterPan}", x + 84, y + 4*FONT.H)
|
||||||
FONT.drawRalign(batch, "${ahead.bpm}", x + 84, y + 5*FONT.H)
|
FONT.drawRalign(batch, "${ahead.bpm}", x + 84, y + 5*FONT.H)
|
||||||
@@ -261,7 +261,7 @@ class AudioMenu(parent: VMEmuExecutable, x: Int, y: Int, w: Int, h: Int) : EmuMe
|
|||||||
private fun bipolarCeil(d: Double) = (if (d >= 0.0) ceil(d) else floor(d)).toInt()
|
private fun bipolarCeil(d: Double) = (if (d >= 0.0) ceil(d) else floor(d)).toInt()
|
||||||
private fun bipolarFloor(d: Double) = (if (d >= 0.0) floor(d) else ceil(d)).toInt()
|
private fun bipolarFloor(d: Double) = (if (d >= 0.0) floor(d) else ceil(d)).toInt()
|
||||||
|
|
||||||
private val VOX_PER_VIEW = arrayOf(6,13,20)
|
private val VOX_PER_VIEW = arrayOf(6,20,20)
|
||||||
private val VOL_SYM = arrayOf('@','^','&',' ')
|
private val VOL_SYM = arrayOf('@','^','&',' ')
|
||||||
private val PAN_SYM = arrayOf('@','<','>',' ')
|
private val PAN_SYM = arrayOf('@','<','>',' ')
|
||||||
|
|
||||||
@@ -448,6 +448,10 @@ class AudioMenu(parent: VMEmuExecutable, x: Int, y: Int, w: Int, h: Int) : EmuMe
|
|||||||
val base = if (localPat < 128) 786432L + localPat * 512 + ri * 8
|
val base = if (localPat < 128) 786432L + localPat * 512 + ri * 8
|
||||||
else 851968L + (localPat - 128) * 512 + ri * 8
|
else 851968L + (localPat - 128) * 512 + ri * 8
|
||||||
|
|
||||||
|
// perform correct bank change
|
||||||
|
audio.mmio_write(2, (pat12 ushr 8).toByte())
|
||||||
|
audio.mmio_write(3, (pat12 ushr 8).toByte())
|
||||||
|
|
||||||
val noteLo = audio.peek(base + 0).toUint()
|
val noteLo = audio.peek(base + 0).toUint()
|
||||||
val noteHi = audio.peek(base + 1).toUint()
|
val noteHi = audio.peek(base + 1).toUint()
|
||||||
val noteVal = noteLo or (noteHi shl 8)
|
val noteVal = noteLo or (noteHi shl 8)
|
||||||
|
|||||||
Reference in New Issue
Block a user