Merge branch 'ws/cleanup' into ws/docs

This commit is contained in:
4DBug committed 2026-10-31 13:25:13 -05:00
commit 3fde582f8c
2 files changed
+12 -1

No files matched your search

+2 -1
View File
@@ -7,7 +7,8 @@ generation) and on **LuaJIT / LÖVE** (through `tools/build.py`). Every format o
About 76 formats across images, audio, video, 3D models, CAD, fonts, archives, data, vector graphics, layered images, About 76 formats across images, audio, video, 3D models, CAD, fonts, archives, data, vector graphics, layered images,
subtitles, music and playlists: see [docs/FORMATS.md](docs/FORMATS.md) (generated from the code) for the list and each subtitles, music and playlists: see [docs/FORMATS.md](docs/FORMATS.md) (generated from the code) for the list and each
format's capabilities, and [docs/API.md](docs/API.md) for the whole API. format's capabilities, [docs/API.md](docs/API.md) for the whole API, and the guide
([docs/guide/README.md](docs/guide/README.md)) for walkthroughs.
```luau ```luau
local F = require(Formats) -- LuaJIT: require("formats"); luau CLI: require("@formats") local F = require(Formats) -- LuaJIT: require("formats"); luau CLI: require("@formats")
+10
View File
@@ -117,6 +117,16 @@ function Pcm.collect(src: Source, maxFrames: number?): (Types.Audio?, Err.Err?)
local total = 0 local total = 0
local limit = maxFrames or 2 ^ 31 local limit = maxFrames or 2 ^ 31
local tmp: buffer? = nil local tmp: buffer? = nil
-- a known length: one read straight into the result (decoders write into a big enough out buffer: no copy)
if src.frames > 0 and src.frames <= limit then
local b, n = src:read(src.frames, data)
if n > 0 then
if b ~= data then
buffer.copy(data, 0, b, 0, math.min(n, cap) * ch * 4)
end
total = math.min(n, cap)
end
end
while true do while true do
local b, n = src:read(16384, tmp) local b, n = src:read(16384, tmp)
if n <= 0 then if n <= 0 then