Sys
Raw FFI bindings for libsymphonia, the Rust wrapper around Symphonia built
from this package's native/ folder. Prefer Symphonia.Decoder over calling the library directly.
opus and sodium load their library when they are required, and dave swaps in a stub module without FFI.
Symphonia loads lazily instead: requiring it, or audio, never downloads a 2 to 3 MB library that a bot which
plays no files would never use. load loads it on its first call.
Summary
Properties
Sys.library :: Lib?Sys.loading :: booleanSys.waitingThreads :: { thread }Sys.logger :: logger.LoggerSys.infoField :: { sampleRate: number, channels: number, isOpus: number, durationMilliseconds: number, skippedPackets: number, isFailed: number, endedEarly: number, state: number }Sys.describeField :: { codec: number, container: number, failure: number }Functions
Sys.load() → LibProperties
Section titled “Properties”library
Section titled “library”The loaded library, nil until a load succeeds.
loading
Section titled “loading”Whether a load is in flight.
waitingThreads
Section titled “waitingThreads”The threads waiting on the load in flight, resumed with its result.
logger
Section titled “logger”The loader's logger, named Symphonia and at Info.
infoField
Section titled “infoField”sampleRate: number,
channels: number,
isOpus: number,
durationMilliseconds: number,
skippedPackets: number,
isFailed: number,
endedEarly: number,
state: number,
}
The field numbers symphonia_info takes. endedEarly (6) is 1 when decoding ended short of the length the file
states, because the file is truncated or damaged packets were skipped. state (7) is 0 while a stream probes,
1 once open, 2 at the end and 3 after a failure; isFailed (5) is 1 exactly when it is 3.
describeField
Section titled “describeField”The field numbers symphonia_describe takes. failure (2) is the failure text, empty until the state is 3.
Functions
Section titled “Functions”Sys . load ( ) -> Lib
Returns the library, loading it on the first call and caching it. The load runs in its own deferred thread and every caller waits for it, so the first call always yields, and callers that arrive while it is in flight share its result; a caller cancelled while it waits never strands the others. The first load may download the library and checks its sha256, which takes about 360 ms of Luau for a 3 MB file; call it at startup to take that cost early. A failed load is not cached, so the next call tries again.
Raises Symphonia requires FFI which is not available on this runtime without FFI, and
libsymphonia ABI version <n> does not match 3; update the symphonia package for a library this package cannot use.
Returns
| Lib |