mirror of
https://github.com/curioustorvald/tsvm.git
synced 2026-06-06 05:28:31 +09:00
LibTaud: off-by-one error on BPM parsing
This commit is contained in:
@@ -118,7 +118,7 @@ function uploadTaudFile(inFile, songIndex, playhead) {
|
|||||||
let patBinCompSize = _peekU32LE(filePtr, entryOff + 18)
|
let patBinCompSize = _peekU32LE(filePtr, entryOff + 18)
|
||||||
let cueSheetCompSize = _peekU32LE(filePtr, entryOff + 22)
|
let cueSheetCompSize = _peekU32LE(filePtr, entryOff + 22)
|
||||||
|
|
||||||
let bpm = bpmStored + 24
|
let bpm = bpmStored + 25
|
||||||
let patsToLoad = numPatsLo | (numPatsHi << 8)
|
let patsToLoad = numPatsLo | (numPatsHi << 8)
|
||||||
|
|
||||||
// -- 6. Decompress + upload patterns --------------------------------------
|
// -- 6. Decompress + upload patterns --------------------------------------
|
||||||
@@ -210,7 +210,7 @@ function captureTrackerDataToFile(outFile) {
|
|||||||
// -- 3. BPM / tick-rate / volumes from playhead 0 -------------------------
|
// -- 3. BPM / tick-rate / volumes from playhead 0 -------------------------
|
||||||
let bpm = audio.getBPM(0) || 125
|
let bpm = audio.getBPM(0) || 125
|
||||||
let tickRate = audio.getTickRate(0) || 6
|
let tickRate = audio.getTickRate(0) || 6
|
||||||
let bpmStored = (bpm - 24) & 0xFF
|
let bpmStored = (bpm - 25) & 0xFF
|
||||||
let songGlobalVolume = audio.getSongGlobalVolume(0)
|
let songGlobalVolume = audio.getSongGlobalVolume(0)
|
||||||
let songMixingVolume = audio.getSongMixingVolume(0)
|
let songMixingVolume = audio.getSongMixingVolume(0)
|
||||||
if (songGlobalVolume === undefined || songGlobalVolume === null) songGlobalVolume = 0x80
|
if (songGlobalVolume === undefined || songGlobalVolume === null) songGlobalVolume = 0x80
|
||||||
@@ -272,7 +272,7 @@ function captureTrackerDataToFile(outFile) {
|
|||||||
(songOffset >>> 24) & 0xFF,
|
(songOffset >>> 24) & 0xFF,
|
||||||
20, // numVoices
|
20, // numVoices
|
||||||
numPats & 0xFF, (numPats >>> 8) & 0xFF, // numPatterns Uint16 LE
|
numPats & 0xFF, (numPats >>> 8) & 0xFF, // numPatterns Uint16 LE
|
||||||
bpmStored, // BPM with −24 bias
|
bpmStored, // BPM with −25 bias
|
||||||
tickRate, // initial tick-rate
|
tickRate, // initial tick-rate
|
||||||
0x00,0xA0, // basenote (0xA000 -- C9)
|
0x00,0xA0, // basenote (0xA000 -- C9)
|
||||||
0x00,0xAC,0x02,0x46, // basefreq (8363 Hz)
|
0x00,0xAC,0x02,0x46, // basefreq (8363 Hz)
|
||||||
|
|||||||
@@ -2728,8 +2728,8 @@ prefixes:
|
|||||||
Uint32 Size of this notation following this field
|
Uint32 Size of this notation following this field
|
||||||
Uint16 Reserved for flags
|
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 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 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 MINUS ONE (or octave); 12-TET will have value 11
|
Uint16 Notes between interval (or octave) MINUS ONE; 12-TET will have value 11
|
||||||
Byte[8] Reserved
|
Byte[8] Reserved
|
||||||
Byte[*] Name, null terminated. Encoding: UTF-8
|
Byte[*] Name, null terminated. Encoding: UTF-8
|
||||||
Byte[*] Notation table. 0xFF-separated and null-terminated. Encoding: Taud charset
|
Byte[*] Notation table. 0xFF-separated and null-terminated. Encoding: Taud charset
|
||||||
|
|||||||
Reference in New Issue
Block a user