LibTaud: off-by-one error on BPM parsing

This commit is contained in:
minjaesong
2026-05-14 15:27:13 +09:00
parent f3ece28a10
commit 70d953a784
2 changed files with 5 additions and 5 deletions

View File

@@ -118,7 +118,7 @@ function uploadTaudFile(inFile, songIndex, playhead) {
let patBinCompSize = _peekU32LE(filePtr, entryOff + 18)
let cueSheetCompSize = _peekU32LE(filePtr, entryOff + 22)
let bpm = bpmStored + 24
let bpm = bpmStored + 25
let patsToLoad = numPatsLo | (numPatsHi << 8)
// -- 6. Decompress + upload patterns --------------------------------------
@@ -210,7 +210,7 @@ function captureTrackerDataToFile(outFile) {
// -- 3. BPM / tick-rate / volumes from playhead 0 -------------------------
let bpm = audio.getBPM(0) || 125
let tickRate = audio.getTickRate(0) || 6
let bpmStored = (bpm - 24) & 0xFF
let bpmStored = (bpm - 25) & 0xFF
let songGlobalVolume = audio.getSongGlobalVolume(0)
let songMixingVolume = audio.getSongMixingVolume(0)
if (songGlobalVolume === undefined || songGlobalVolume === null) songGlobalVolume = 0x80
@@ -272,7 +272,7 @@ function captureTrackerDataToFile(outFile) {
(songOffset >>> 24) & 0xFF,
20, // numVoices
numPats & 0xFF, (numPats >>> 8) & 0xFF, // numPatterns Uint16 LE
bpmStored, // BPM with 24 bias
bpmStored, // BPM with 25 bias
tickRate, // initial tick-rate
0x00,0xA0, // basenote (0xA000 -- C9)
0x00,0xAC,0x02,0x46, // basefreq (8363 Hz)

View File

@@ -2728,8 +2728,8 @@ prefixes:
Uint32 Size of this notation following this field
Uint16 Reserved for flags
Uint16 Interval size in 4096-TET lattice (octave = 0x1000, tritave = 0x195C). If you are not using an interval system (which means you are responsible for defining every note expressible), this must be 0.
Uint16 Reserved
Uint16 Notes between interval MINUS ONE (or octave); 12-TET will have value 11
Uint16 Reserved for float32 interval size (should it be in 4096-TET which is inexact or frequency multiplier which is exact but difficult to implement?)
Uint16 Notes between interval (or octave) MINUS ONE; 12-TET will have value 11
Byte[8] Reserved
Byte[*] Name, null terminated. Encoding: UTF-8
Byte[*] Notation table. 0xFF-separated and null-terminated. Encoding: Taud charset