adac.HotReload#
- class adac.HotReload(fs: float, *, name: str = 'FDN', dsp_path: str | Path = '/tmp/adac-live.dsp', config_path: str | Path = '/tmp/faust-current-dsp.txt', every: int = 1, min_interval: float = 0.5, controls: dict[str, Any] | None = None)[source]#
re-emit a flamo model to faust and publish it to the running plugin.
- Parameters:
fs (float) – sampling rate in hz, forwarded to flamo_to_faust().
name (str) – dsp name, appears in the generated faust header comment.
dsp_path (str | Path) – where the generated .dsp is written. the basename must stay stable across the run: the plugin matches reload events against the basename of the file it has loaded.
config_path (str | Path) – the plugin’s watched config file. its first line is kept pointing at dsp_path.
every (int) – publish at most every n-th call to update(). the first call always qualifies. default 1 (every call).
min_interval (float) – minimum seconds between published reloads. protects the plugin from reload storms when the training loop runs faster than the interpreter can swap factories. default 0.5.
controls (dict, optional) – macro controls (“rt60”, “dry_wet”, “pre_delay”) forwarded to flamo_to_faust(). slider addresses stay stable across publishes, and the plugin preserves parameter values by address, so knob positions survive every reload.
- __init__(fs: float, *, name: str = 'FDN', dsp_path: str | Path = '/tmp/adac-live.dsp', config_path: str | Path = '/tmp/faust-current-dsp.txt', every: int = 1, min_interval: float = 0.5, controls: dict[str, Any] | None = None)[source]#
Methods
__init__(fs, *[, name, dsp_path, ...])publish(code)publish a faust source string to the plugin.
update(model, *[, force])regenerate faust code from the model and publish it if due.
- publish(code: str) bool[source]#
publish a faust source string to the plugin.
lower-level entry point for callers who generate code themselves (for instance via json_to_faust after editing the config). skips the write when the code is identical to the last published version, so no spurious reload fires.
- update(model: Any, *, force: bool = False) bool[source]#
regenerate faust code from the model and publish it if due.
call this after each optimiser step. returns True when a new .dsp was actually written (and the plugin will reload), False when the call was throttled or the generated code is unchanged.
force=True bypasses the step and time throttles, for a final guaranteed publish after the training loop ends.