Module engine

Module engine 

Source
Expand description

Main Milkdrop engine implementation.

The update() orchestrator lives here; the three heavyweight per-frame phases that used to dominate the file are split into sibling modules, each adding its own impl MilkEngine block:

That split keeps engine.rs focused on the lifecycle (new, load_preset, update, public getters) and supports preset transitions, where two engine instances drive the wave/shape paths in parallel.

Modulesยง

morph ๐Ÿ”’
Smart boolean interpolation of motion params across a preset transition.
preset_slot ๐Ÿ”’
Per-preset state bundle.
shape_phase ๐Ÿ”’
Custom-shape (shapecode_N) phase of the engine update loop.
state_sync ๐Ÿ”’
Mirror a slotโ€™s evaluator context into its RenderState.
transition_state ๐Ÿ”’
Engine-side preset transition state.
wave_phase ๐Ÿ”’
Custom-wave (wavecode_N) phase of the engine update loop.

Structsยง

EngineConfig
Engine configuration.
FrameProfile
Per-phase wall-clock breakdown for one MilkEngine::update call. Populated when EngineConfig::profile is true; exposed by MilkEngine::last_profile() for the bench tool and any future overlay.
MilkEngine
Main Milkdrop visualization engine.

Enumsยง

ProgressSource
Source for the MD2 progress uniform.
QualityPreset
Quality preset for engine configuration.

Constantsยง

SPECTRUM_FFT_SIZE ๐Ÿ”’
FFT window size used to expose value1/value2 spectrum bins to wavecode_N per-point equations when b_spectrum is set. Power of 2, large enough to give a reasonable bin density without ballooning the analyzer cost. Matches the standard MD2 FFT size.

Functionsยง

tick_slot_evaluator ๐Ÿ”’
Advance one slotโ€™s per-frame state: push the shared audio levels + time + frame into its evaluator context, then run its per-frame equations. Called once for current and (during transitions) once for fading_out each frame.