ws-audio2: bench lines for AHX / HVL render; type fixes (no new diagnostics); Types.Module format comment lists ahx / hvl
Types.luau: comment only.
This commit is contained in:
1 parent
d3ea84bb57
commit
d2c470013d
8 files changed
+39
-18
No files matched your search
@@ -66,7 +66,7 @@ function Load.parse(b: buffer, base: number, limit: number): (Tune?, string?, st
|
||||
local magic = buffer.readstring(b, base, 3)
|
||||
local ahx = magic == "THX" and u8(3) < 3
|
||||
if not ahx and not (magic == "HVL" and u8(3) <= 1) then
|
||||
return nil, "not an AHX / HVL module"
|
||||
return nil, "not an AHX / HVL module", nil
|
||||
end
|
||||
if not ahx and size < 16 then
|
||||
return nil, "truncated header", "truncated"
|
||||
@@ -94,7 +94,7 @@ function Load.parse(b: buffer, base: number, limit: number): (Tune?, string?, st
|
||||
emptyTrack0 = bit32.band(u8(6), 0x80) ~= 0,
|
||||
}
|
||||
if posn == 0 or posn > 1000 or trkl > 64 or trkl == 0 or insn > 64 then
|
||||
return nil, string.format("bad header (positions %d, track length %d, instruments %d)", posn, trkl, insn)
|
||||
return nil, string.format("bad header (positions %d, track length %d, instruments %d)", posn, trkl, insn), nil
|
||||
end
|
||||
if chnn > 16 then
|
||||
return nil, "unsupported: more than 16 channels", "unsupported"
|
||||
|
||||
@@ -668,7 +668,8 @@ local function processFrame(st: State, v: Voice)
|
||||
d3 += v.squareSign
|
||||
v.squarePos = s16(d3)
|
||||
v.plantSquare = true
|
||||
v.squareWait = if v.instrument then v.instrument.squareSpeed else 0
|
||||
local ins: any = v.instrument
|
||||
v.squareWait = if ins then ins.squareSpeed else 0
|
||||
end
|
||||
end
|
||||
|
||||
@@ -815,12 +816,9 @@ local function setAudio(st: State, v: Voice)
|
||||
v.plantPeriod = false
|
||||
v.delta = deltaOf(v.audioPeriod, st.freq)
|
||||
end
|
||||
if v.newWaveform and v.audioSrc then
|
||||
if v.waveform == 3 then
|
||||
fillCycles(v.voiceBuf, v.audioSrc, v.audioOff, 0x280)
|
||||
else
|
||||
fillCycles(v.voiceBuf, v.audioSrc, v.audioOff, 4 * 2 ^ v.waveLength)
|
||||
end
|
||||
local src: buffer? = v.audioSrc or nil
|
||||
if v.newWaveform and src then
|
||||
fillCycles(v.voiceBuf, src, v.audioOff, if v.waveform == 3 then 0x280 else 4 * 2 ^ v.waveLength)
|
||||
end
|
||||
if v.ringPlantPeriod then
|
||||
v.ringPlantPeriod = false
|
||||
|
||||
@@ -290,7 +290,7 @@ function Render.merge(events: { Types.MidiEvent }, offs: { PendingOff }): { Type
|
||||
end
|
||||
return a.seq < b.seq
|
||||
end)
|
||||
local out: { Types.MidiEvent } = table.create(#events + #offs)
|
||||
local out: { Types.MidiEvent } = table.create(#events + #offs) :: { Types.MidiEvent }
|
||||
local k = 1
|
||||
for _, ev in events do
|
||||
while k <= #offs and (offs[k].tick < ev.tick or (offs[k].tick == ev.tick and offs[k].onTick < ev.tick)) do
|
||||
|
||||
Reference in new issue
Block a user