ws-cleanup: type diagnostics 1109 -> 94 unique; lint gate against tools/lint_types_baseline.txt
ws/cleanup-types (merged before) annotated Types, init, core, codecs, containers, ops, host and the formats; this commit fixes the rest in the modules ws-cleanup added (AudioOps, Resample, Vorbis / FLAC / Opus encoders). tools/lint.sh now counts unique diagnostics (the analyzer printed every required src module twice: master's '2499' was 1109 unique) and fails when the count rises above tools/lint_types_baseline.txt (94); LINT_TYPES_UPDATE=1 lowers it. Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
1 parent
b77660343a
commit
dca1130324
7 files changed
+39
-24
No files matched your search
@@ -208,7 +208,7 @@ local function run(st: State, limitOut: number, out: buffer?): (buffer, number)
|
||||
st.histFrames = 0
|
||||
st.base = base + histFrames
|
||||
else
|
||||
local nh = table.create((histFrames - drop) * ch)
|
||||
local nh: { number } = table.create((histFrames - drop) * ch) :: any
|
||||
table.move(hist, drop * ch + 1, histFrames * ch, 1, nh)
|
||||
st.hist = nh
|
||||
st.histFrames = histFrames - drop
|
||||
@@ -251,7 +251,7 @@ function Resample.new(from: number, to: number, channels: number, opts: Options?
|
||||
if type(channels) ~= "number" or channels < 1 or channels > 256 or channels ~= floor(channels) then
|
||||
return nil, "bad channel count"
|
||||
end
|
||||
local q = QUALITY[(opts and opts.quality) or "medium"]
|
||||
local q: { number }? = QUALITY[(opts and opts.quality) or "medium"]
|
||||
if not q then
|
||||
return nil, "quality must be low, medium or high"
|
||||
end
|
||||
@@ -260,12 +260,11 @@ function Resample.new(from: number, to: number, channels: number, opts: Options?
|
||||
return nil, "cutoff must be 0.5 .. 1"
|
||||
end
|
||||
-- positions are exact integers: output j sits at input j * M / L (non-integer rates: to 1 / 1000 Hz)
|
||||
local fi, ti = from, to
|
||||
if from ~= floor(from) or to ~= floor(to) then
|
||||
fi, ti = floor(from * 1000 + 0.5), floor(to * 1000 + 0.5)
|
||||
end
|
||||
local g = gcd(fi, ti)
|
||||
local L, M = ti // g, fi // g
|
||||
local scale = if from ~= floor(from) or to ~= floor(to) then 1000 else 1
|
||||
local fi: number = floor(from * scale + 0.5)
|
||||
local ti: number = floor(to * scale + 0.5)
|
||||
local g: number = gcd(fi, ti)
|
||||
local L: number, M: number = ti // g, fi // g
|
||||
local exact = L <= MAX_EXACT
|
||||
local phases = if exact then L else INTERP_PHASES
|
||||
local st: State = {
|
||||
@@ -348,7 +347,7 @@ function Resample.source(src: any, to: number, opts: Options?): (any, string?)
|
||||
function out.read(self: any, n: number, dst: buffer?): (buffer, number)
|
||||
n = floor(n)
|
||||
while pendingFrames - pendingPos <= 0 and not ended do
|
||||
local b, m = src:read(math.max(1024, floor(n * src.sampleRate / to) + 64), inTmp)
|
||||
local b: buffer, m: number = (src :: any):read(math.max(1024, floor(n * src.sampleRate / to) + 64), inTmp)
|
||||
inTmp = b
|
||||
local r: buffer, k: number
|
||||
if m <= 0 then
|
||||
|
||||
Reference in new issue
Block a user