ws-audio2: api renderMusic uses a Module's own render method for non-tracker engines (AHX / HVL); docs/guide/music.md: AHX / HVL and MIDI variants section, Formats rows (docs inputs: tools/fixtures/docs_chip.py)

src/Formats/init.luau: renderMusic: a kind "music" value whose format is not mod/s3m/xm/it and that has a render
method renders through it (a failed render's .err becomes the error). Backward compatible.
This commit is contained in:
4DBug committed 2026-10-31 14:32:05 -05:00
1 parent 71bb89763e
commit d3ea84bb57
4 files changed
+126 -1

No files matched your search

+11
View File
@@ -54,6 +54,17 @@ t:eq(code(string.sub(Cases[1].data, 1, 60)), Err.TRUNCATED, "truncated")
local song = assert(Ahx.decode(Bytes.reader(buffer.fromstring(Cases[1].data))))
t:check(song:render({ subsong = 9 }).err ~= nil, "subsong out of range")
-- through the api: a Module saved as audio renders through its own engine
do
local F = require("@formats")
local wav, err = F.save(song, nil, { format = "wav", sampleRate = 22050 })
t:check(wav, "F.save as wav: " .. tostring(err))
t:eq(F.detect(wav :: buffer), "wav", "F.save as wav")
t:eq(F.detect(buffer.fromstring(Cases[1].data)), "ahx", "F.detect")
local _, e2 = F.save(song, nil, { format = "wav", subsong = 7 })
t:check(e2 ~= nil, "F.save: a failed render is an error")
end
t:fuzz("decode", function(b: buffer)
return Ahx.decode(Bytes.reader(b))
end, samples)