From 577d46d31e5a83543a5944d51d7d670de352e946 Mon Sep 17 00:00:00 2001 From: minjaesong Date: Tue, 12 May 2026 23:35:42 +0900 Subject: [PATCH] keys to change playback tickrate --- assets/disk0/tvdos/bin/taut.js | 16 ++++++++++++++-- assets/disk0/tvdos/bin/taut_helpmsg.js | 1 + terranmon.txt | 2 +- .../net/torvald/tsvm/peripheral/AudioAdapter.kt | 1 + 4 files changed, 17 insertions(+), 3 deletions(-) diff --git a/assets/disk0/tvdos/bin/taut.js b/assets/disk0/tvdos/bin/taut.js index 8243124..01a2d18 100644 --- a/assets/disk0/tvdos/bin/taut.js +++ b/assets/disk0/tvdos/bin/taut.js @@ -1555,6 +1555,8 @@ function timelineInput(wo, event) { if (keyJustHit && shiftDown && event.includes(keys.E)) { setTimelineRowStyle(1); return } if (keyJustHit && shiftDown && event.includes(keys.R)) { setTimelineRowStyle(2); return } + if (keyJustHit && (keysym === '[' || keysym === ']')) { nudgeTickRate(keysym === '[' ? -1 : 1); return } + if (playbackMode !== PLAYMODE_NONE) { if (keyJustHit && shiftDown && event.includes(keys.Y) || keysym === " ") { stopPlayback(); redrawPanel(); drawAlwaysOnElems() } else if (keysym === "" || keysym === "") { @@ -2188,6 +2190,8 @@ function patternsInput(wo, event) { const shiftDown = (event.includes(59) || event.includes(60)) const moveDelta = shiftDown ? 4 : 1 + if (keyJustHit && (keysym === '[' || keysym === ']')) { nudgeTickRate(keysym === '[' ? -1 : 1); return } + if (playbackMode !== PLAYMODE_NONE) { if ((keyJustHit && shiftDown && event.includes(keys.Y)) || keysym === " ") { stopPlayback(); simStateKey = ''; drawPatternsContents(wo); drawAlwaysOnElems() @@ -2346,6 +2350,16 @@ function restoreFullSongParams() { previewActive = false } +// Adjust the live tick rate by `delta`. The engine still honours 'A' (set speed) effects, +// which will overwrite this value when their row is hit during playback. +function nudgeTickRate(delta) { + const cur = audio.getTickRate(PLAYHEAD) | 0 + const next = Math.max(1, Math.min(255, cur + delta)) + if (next === cur) return + audio.setTickRate(PLAYHEAD, next) + drawAlwaysOnElems() +} + function startPlaySong() { restoreFullSongParams() audio.stop(PLAYHEAD) @@ -2392,7 +2406,6 @@ function startPlayPattern() { if (song.numPats === 0) return audio.stop(PLAYHEAD) audio.setBPM(PLAYHEAD, song.bpm) - audio.setTickRate(PLAYHEAD, song.tickRate) audio.uploadCue(PREVIEW_CUE_IDX, buildPreviewCue(patternIdx)) audio.setCuePosition(PLAYHEAD, PREVIEW_CUE_IDX) audio.setTrackerRow(PLAYHEAD, 0) @@ -2408,7 +2421,6 @@ function startPlayPatternRow() { if (song.numPats === 0) return audio.stop(PLAYHEAD) audio.setBPM(PLAYHEAD, song.bpm) - audio.setTickRate(PLAYHEAD, song.tickRate) audio.uploadCue(PREVIEW_CUE_IDX, buildPreviewCue(patternIdx)) audio.setCuePosition(PLAYHEAD, PREVIEW_CUE_IDX) audio.setTrackerRow(PLAYHEAD, patternGridRow) diff --git a/assets/disk0/tvdos/bin/taut_helpmsg.js b/assets/disk0/tvdos/bin/taut_helpmsg.js index 4526665..141835c 100644 --- a/assets/disk0/tvdos/bin/taut_helpmsg.js +++ b/assets/disk0/tvdos/bin/taut_helpmsg.js @@ -90,6 +90,7 @@ Timeline has two distinct modes: view and edit mode. Two modes are toggled using &bul;W&mdot;E&mdot;R : toggle timeline view mode. W-most detailed, R-most abridged &bul;n : toggle soloing of the selected voice &bul;m : toggle muting of the selected voice +&bul;[&mdot;] : change tick rate of playhead  EDIT MODE \u00B7${'\u00B8'.repeat(9)}\u00B9 diff --git a/terranmon.txt b/terranmon.txt index afd431b..d1ce314 100644 --- a/terranmon.txt +++ b/terranmon.txt @@ -2399,7 +2399,7 @@ TODO: previous "row volume default = 63" behaviour. [x] physical_presence order 0x1F chn 2: note cuts unexpectedly fast — engine fix [x] GSLINGER order 0x03 chn 1: L 0100 fades unexpectedly fast? — converter fix - [ ] do not reset tickspeed on pattern view play / add key to modify tick speed ('[' down/']' up) + [x] do not reset tickspeed on pattern view play / add key to modify tick speed ('[' down/']' up) [ ] expose song table on UI (test with `insaniq2.taud`) TODO - list of demo songs that MUST ship with Microtone: diff --git a/tsvm_core/src/net/torvald/tsvm/peripheral/AudioAdapter.kt b/tsvm_core/src/net/torvald/tsvm/peripheral/AudioAdapter.kt index 35c5eff..e407842 100644 --- a/tsvm_core/src/net/torvald/tsvm/peripheral/AudioAdapter.kt +++ b/tsvm_core/src/net/torvald/tsvm/peripheral/AudioAdapter.kt @@ -3410,6 +3410,7 @@ class AudioAdapter(val vm: VM) : PeriBase(VM.PERITYPE_SOUND) { var samplePos = 0.0 var playbackRate = 1.0 var forward = true + var instrumentId = 0 // -1 for live foreground voices held by TrackerState.voices[]; 0..19 for background // (mixer-private) ghosts spawned by NNA on the matching channel index.