Skip to content

Overview

The lane graph, the channel strip order, the buses, and where FX sits in the mixer signal path.

The mixer is a dasp_graph graph of one node per deck. Each node owns that deck’s playback, its sampler, and its channel strip. The whole path from PCM to bus therefore lives in engine-dsp with no I/O.

The per-deck side is a lane: crates/engine-dsp/src/mixer_lane.rs joins the deck, its sampler and one strip into a graph node. The mixer-wide side, crates/engine-dsp/src/mixer.rs, renders the lanes, sums the crossfader, routes the buses, and owns master peaks and FX tempo. FX sits inside the strip, but its configuration is one shared unit across decks; see FX chain.

User-facing docs: Mixer overview and Beat FX.

Signal path

Deck (resample / stretch / jog)
        │  dry PCM chunk
        ▼
MixerChannel strip
  auto gain + gain trim
        │
        3-band EQ
        │
        DJ filter
        │
        FX chain            ← only when fx_routed; see /docs/developers/mixer/fx-chain
        │
        ├─► level peaks + pre-fader buffer (cue / PFL tap)
        │
        channel fader
        ▼
crossfader gains (resolved curve)  ──►  master mix  ──►  master bus
        │
        └─► cue bus (pre-fader taps of cue-enabled channels + optional master tap)

The pre-fader tap is captured after EQ, filter and FX. Headphones and the channel meter therefore carry the wet signal, while the fader still scales both dry and wet.

Chunking

Mixer::process requires the frame count to be a positive multiple of Buffer::LEN (64 samples) and renders that many chunks per callback. Everything inside the callback is allocation-free. Buffers, scratch space and level state are allocated in constructors and reused, and no lock is taken on the audio thread.

Crossfader curves

The crossfader law is a two-channel curve group (deck A, deck B). It is resolved and compiled on the control thread and only evaluated inside Mixer::process, so the audio callback never parses an id or allocates.

  • curve-core owns the target-agnostic model: CurveSpec (points + per-segment shape), CurveGroup (one curve per output), CurveSet and CurveLibrary, and ResolvedCurveGroup, which blends adjacent set members for a morph position.
  • audio-core/src/crossfader_curve.rs owns ResolvedCrossfaderCurve: the compiled A/B tables plus the disabled and hamster flags applied after evaluation. Its default is the equal-power constant_power group.
  • engine-core/src/curve_presets.rs is the crossfader preset registry (constant_power, linear, fast_cut(cut)), with reserved names listed but unavailable.
  • engine-core/src/curve_library.rs resolves a selection id in order: preset → custom group → curve set. It also converts the persisted CurveLibrarySpec into a validated CurveLibrary.

Selection ids are canonical snake_case everywhere: settings, bus payloads, controller mappings, and logs. An unknown id installs constant_power and publishes a Notice; it never fails the load or the command. Duplicate group or set ids in SetCurveLibrary reject the whole update and keep the previous library.

Event Payload Effect
SetCrossfaderCurve id Select a preset, custom group, or curve set. Answers with EngineStatus.
SetCrossfaderCurveAmount set, amount, soft_takeover Install set when it is not active, then sweep its morph. Gated by mixer soft takeover.
SetCrossfaderBehavior hamster, disabled Apply both flags without rebuilding the gain tables. hamster is the wire name for the user-facing Invert flag.
SetCurveLibrary library Validate and replace the custom curve library.

EngineStatus.crossfader_curve reports the active id, display name, morph position, and both flags, so a controller can drive a curve button or knob and mirror its state back as LEDs.

Settings persist the same defaults under audio.default_crossfader_curve, audio.crossfader_behavior, and audio.curve_library in the engine config, which the app fills from Settings → Mixer → Crossfader. That is why a headless start and a GUI start agree on the active curve.

The point/segment editor and curve-set editor exist under apps/gui-flutter/lib/widgets/curves/, but the full Settings → Curves section is intentionally not exposed in the app yet. Until it ships, VirtualDJ import/export lives in Settings → Integrations through crates/host-flutter/src/api/curve_editor.rs, which calls config-adapters. An imported custom point script arrives as a native two-channel group and can be selected as the default curve like any other group.

Filter smoothing

The FLT knob changes a cutoff on every step, so DjFilter never applies one abruptly. It keeps the commanded position (filter_db(), which the UI and soft takeover read back) and glides an internal copy toward it inside process_buffer, re-deriving the biquad coefficients every 16 frames across a full-range 0.02 s sweep. Coefficients are swapped in place with Biquad::set_coeffs rather than rebuilt, because a rebuilt biquad starts with an empty delay line and each step becomes an audible click. While the knob is off centre a low-pass and a high-pass both run, blended by a weight that reaches zero at the centre, so the LP→HP swap there is continuous as well.

File map

Path Responsibility
crates/engine-dsp/src/deck.rs Playback, transport, tempo ratio, beat grid, effective_bpm()
crates/engine-dsp/src/mixer_lane.rs Graph node: deck + sampler + strip, sampler route into the mix
crates/engine-dsp/src/mixer_channel.rs The strip: gain, EQ, filter, FX, meter/PFL capture, fader
crates/engine-dsp/src/fx/ FX chain, echo, reverb; see FX chain
crates/engine-dsp/src/mixer.rs Lane rendering, crossfade sum, bus routing, master peaks, FX tempo
crates/audio-core/src/crossfader_curve.rs Compiled crossfader tables, disabled/hamster flags, equal-power default
crates/engine-core/src/curve_presets.rs Crossfader preset registry and catalog
crates/engine-core/src/curve_library.rs Selection resolution, library validation, settings ↔ curve-core conversion
crates/host-flutter/src/api/curve_editor.rs VirtualDJ curve import/export bridge over config-adapters
apps/gui-flutter/lib/widgets/curves/ Point, segment, and curve-set editor widgets
apps/gui-flutter/lib/widgets/settings/settings_curves_panel.dart Curves settings section and named-library management
crates/bus-api/src/payload.rs DeckSnapshot / DeckUpdated fields, CmdBody variants
crates/engine-core/src/control.rs Command decode + dispatch, mixer vs deck origin
crates/engine-core/src/status.rs DSP state → wire snapshot mapping
crates/host-flutter/src/api/engine.rs FRB transport methods and event mirrors
apps/gui-flutter/lib/providers/mixer/ Riverpod state, optimistic commands, device providers

Command shape

  • Mixer-wide: published with Origin::Mixer and answered with CmdOutcome::DecksUpdated, one DeckUpdated per deck. Applies to the crossfader, master and cue volumes, and the FX unit’s shared configuration, because the value lives on every channel.
  • Deck-scoped: published with Origin::Deck(i) and answered with a single DeckUpdated (CmdOutcome::DeckUpdated). Applies to volume, EQ, filter, gain trim, cue, and the FX routing switch.

Pages in this topic

  • FX chain: the Fx trait, echo and reverb DSP, the shared-unit wire contract, and how to add an effect.