mirror of
https://github.com/curioustorvald/tsvm.git
synced 2026-06-06 13:38:30 +09:00
2taud update
This commit is contained in:
@@ -531,7 +531,7 @@ def parse_instruments(data: bytes, h: ITHeader) -> list:
|
|||||||
|
|
||||||
# Parse IT envelopes (new-format only, ≥cmwt 0x200)
|
# Parse IT envelopes (new-format only, ≥cmwt 0x200)
|
||||||
# Vol envelope at ptr+0x130; pan envelope at ptr+0x182
|
# Vol envelope at ptr+0x130; pan envelope at ptr+0x182
|
||||||
ticks_per_sec = max(h.initial_tempo / 60.0 * h.initial_speed, 1.0)
|
ticks_per_sec = max(h.initial_tempo * 2.0 / 5.0, 1.0) # tick rate = bpm×2/5 (50 Hz at 125 BPM); speed is ticks-per-row, irrelevant here
|
||||||
inst.vol_envelope, inst.vol_env_sustain = _parse_it_envelope(
|
inst.vol_envelope, inst.vol_env_sustain = _parse_it_envelope(
|
||||||
data, ptr + 0x130, False, ticks_per_sec)
|
data, ptr + 0x130, False, ticks_per_sec)
|
||||||
inst.pan_envelope, inst.pan_env_sustain = _parse_it_envelope(
|
inst.pan_envelope, inst.pan_env_sustain = _parse_it_envelope(
|
||||||
|
|||||||
@@ -624,8 +624,8 @@ def build_sample_inst_bin(instruments: list) -> tuple:
|
|||||||
struct.pack_into('<H', inst_bin, base + 8, ls)
|
struct.pack_into('<H', inst_bin, base + 8, ls)
|
||||||
struct.pack_into('<H', inst_bin, base + 10, le)
|
struct.pack_into('<H', inst_bin, base + 10, le)
|
||||||
inst_bin[base + 12] = flags_byte
|
inst_bin[base + 12] = flags_byte
|
||||||
# Volume envelope: hold at instrument volume (vol*4 clamped to 255)
|
# Volume envelope: hold at instrument volume (clamped to 0x3F)
|
||||||
env_vol = min(inst.volume * 4, 255)
|
env_vol = min(inst.volume, 63)
|
||||||
inst_bin[base + 16] = env_vol # volume
|
inst_bin[base + 16] = env_vol # volume
|
||||||
inst_bin[base + 17] = 0 # offset minifloat = 0 → hold
|
inst_bin[base + 17] = 0 # offset minifloat = 0 → hold
|
||||||
|
|
||||||
|
|||||||
@@ -2018,10 +2018,10 @@ Instrument bin: Registry for 256 instruments, formatted as:
|
|||||||
Bit8 Reserved
|
Bit8 Reserved
|
||||||
Bit16x8 Volume envelopes
|
Bit16x8 Volume envelopes
|
||||||
Byte 1: Volume (00..3F)
|
Byte 1: Volume (00..3F)
|
||||||
Byte 2: Second offset from the prev point, in 3.5 Unsigned Minifloat
|
Byte 2: Time until the next point, in seconds (3.5 Unsigned Minifloat). 0 = hold at this point indefinitely.
|
||||||
Bit16x8 Panning envelopes
|
Bit16x8 Panning envelopes
|
||||||
Byte 1: Pan (00..FF)
|
Byte 1: Pan (00..FF)
|
||||||
Byte 2: Second offset from the prev point, in 3.5 Unsigned Minifloat
|
Byte 2: Time until the next point, in seconds (3.5 Unsigned Minifloat). 0 = hold at this point indefinitely.
|
||||||
Bit16x8 Reserved
|
Bit16x8 Reserved
|
||||||
|
|
||||||
Play Data: play data are series of tracker-like instructions, visualised as:
|
Play Data: play data are series of tracker-like instructions, visualised as:
|
||||||
|
|||||||
Reference in New Issue
Block a user