audio perf: type annotations (lint baseline)

This commit is contained in:
4DBug committed 2026-11-01 19:50:56 -06:00
1 parent a2cd103674
commit 688503fb2d
3 files changed
+6 -4

No files matched your search

+2 -2
View File
@@ -715,14 +715,14 @@ local function up2HQ(S: { number }, out: { number }, oo: number, inp: { number }
end
-- FIR12 per phase ti, in tap order: FIR12[4 ti + 1 .. 4 ti + 4], FIR12[4 (11 - ti) + 4 .. 4 (11 - ti) + 1]
local FIR12_ROWS = table.create(12)
local FIR12_ROWS: { { number } } = table.create(12) :: any
for ti = 0, 11 do
local f0, f1 = ti * 4, (11 - ti) * 4
FIR12_ROWS[ti + 1] = { FIR12[f0 + 1], FIR12[f0 + 2], FIR12[f0 + 3], FIR12[f0 + 4], FIR12[f1 + 4], FIR12[f1 + 3], FIR12[f1 + 2], FIR12[f1 + 1] }
end
local function iirFirInterpol(out: { number }, oo: number, buf: { number }, max_index_Q16: number, incr: number): number
local rows = FIR12_ROWS
local rows: { { number } } = FIR12_ROWS
local index_Q16 = 0
while index_Q16 < max_index_Q16 do
local r = rows[((index_Q16 % 65536) * 12) // 65536 + 1]
+1 -1
View File
@@ -282,7 +282,7 @@ function Resample.new(from: number, to: number, channels: number, opts: Options?
local L: number, M: number = ti // g, fi // g
local exact = L <= MAX_EXACT
local phases = if exact then L else INTERP_PHASES
local hist = table.create(channels)
local hist: { { number } } = table.create(channels) :: any
for c = 1, channels do
hist[c] = {}
end
+3 -1
View File
@@ -221,7 +221,9 @@ if want("midi render sf2 (test song)") or want("midi render fallback") or want("
render("midi render sf2 (test song)", 3, function()
return assert(Midi.render(song, { soundfont = sf, tail = 0 }))
end)
local fb = assert(Midi.decode(Bytes.reader(buffer.fromstring(case(require("@tests/gen/midi_cases"), "song").data))))
local midiCases: any = require("@tests/gen/midi_cases")
local fbData: string = case(midiCases, "song").data
local fb = assert(Midi.decode(Bytes.reader(buffer.fromstring(fbData))))
render("midi render fallback", 3, function()
return assert(Midi.render(fb, { tail = 0 }))
end)