ws-audio2: music/ptm (PolyTracker): it family, MOD letters with S3M fine slides, note slides, delta 8 / 16-bit samples; engine flags.panLaw = ft2 (square-root panning)

ops/MusicOps: accept modules of the other tracker formats by their engine family (Tracker.family), a one-line
backward-compatible change.
This commit is contained in:
4DBug committed 2026-10-31 14:29:01 -05:00
1 parent 48b4b4cc4e
commit 60544a3a77
9 files changed
+409 -4

No files matched your search

+4 -3
View File
@@ -27,7 +27,8 @@ local function bad(what: string): (nil, Err.Err)
end
local function isModule(m: any): boolean
return type(m) == "table" and m.kind == "music" and FORMATS[m.format] == true and type(m.patterns) == "table"
-- (the engine family: modules of the other tracker formats, music/mtm etc., play as one of the four)
return type(m) == "table" and m.kind == "music" and FORMATS[Tracker.family(m) or ""] == true and type(m.patterns) == "table"
end
local function int(v: any, lo: number, hi: number): boolean
@@ -243,7 +244,7 @@ function MusicOps.addSample(m: any, spec: SampleSpec): (number?, Err.Err?)
local copy = buffer.create(length * channels * 4)
buffer.copy(copy, 0, data, 0, length * channels * 4)
s.data, s.length, s.channels = copy, length, channels
s.bits = spec.bits or (if m.format == "mod" then 8 else 16)
s.bits = spec.bits or (if Tracker.family(m) == "mod" then 8 else 16)
if s.bits ~= 8 and s.bits ~= 16 then
return bad("addSample: bits must be 8 or 16")
end
@@ -298,7 +299,7 @@ function MusicOps.addInstrument(m: any, spec: InstrumentSpec): (number?, Err.Err
if not isModule(m) then
return bad("addInstrument: needs a tracker Module")
end
if m.format ~= "xm" and m.format ~= "it" then
if Tracker.family(m) ~= "xm" and Tracker.family(m) ~= "it" then
return bad("addInstrument: only xm and it modules have instruments (mod / s3m cells name samples)")
end
if type(spec) ~= "table" then