The crates
The Swift app lives in
apple/Dub/. Waveforms are drawn with Metal.
The audio thread is sacred
A crash or a dropout on stage ends a DJ’s night, so code that runs on the audio thread may not allocate memory, take a lock, make a system call, log, do I/O, callunwrap(), or box a dyn Trait.
That’s enforced three ways:
- At compile time. Every function reachable from the engine’s render
call takes a
RealtimeContexttoken, which can’t leave the audio thread. - In tests. Tests of the render path run under
assert_no_alloc; any allocation aborts the test. - In release builds. The same allocator check records the violation instead of crashing.
The bridge to Swift
dub-ffi exposes the engine to the app through
UniFFI. The Rust signatures are the
single source of truth: the Swift bindings are generated from them, packed
with the Rust core into DubCore.xcframework. Three objects make up the
surface: DubEngine, DubLibrary and DubRipSession. They stay separate
so library and disk work never becomes an audio-thread dependency.
The bridge carries a contract number, FFI_VERSION. Changing the surface
means bumping it, and make docs-check holds the docs to it.
The CLI doesn’t go through the bridge. It links the engine directly.
Engineering docs
The full picture is on GitHub:ARCHITECTURE.md
Threads, messaging, timecode, Thru, the BPM engine and the build.
PRD.md
What Dub is for, and the spec everything else answers to.
LIBRARY-SCHEMA.md
The library’s SQLite schema.
LIBRARY-FORMATS.md
How each DJ app’s library is read and written.
LICENSE-DEPENDENCIES.md
Every dependency’s licence, and why Dub is MIT OR Apache-2.0.
docs/README.md
Which doc to read for which task, including what’s in flight and the lessons learned.