Skip to content

Manifest

Front-end-agnostic intermediate representation. Decouples the parser from platform generators.

manifest

Front-end-agnostic manifest for gen-dsp platform backends.

The Manifest captures everything a platform generator needs -- I/O counts, parameter metadata, buffer names -- without coupling to any particular front-end (gen~ exports, future Python DSL, etc.).

Typical data flow:

gen~ export -> parser -> ExportInfo -> manifest_from_export_info() -> Manifest
                                    -> project.py passes Manifest to platforms

ParamInfo dataclass

ParamInfo(
    index: int,
    name: str,
    has_minmax: bool,
    min: float,
    max: float,
    default: float,
)

Metadata for a single parameter.

RemappedInput dataclass

RemappedInput(
    gen_input_index: int, input_name: str, param_index: int
)

A signal input remapped to a parameter.

When gen~ exports use signal-rate in objects for control data (e.g., pitch, gate), --inputs-as-params converts them to plugin parameters. The gen~ perform function still receives input buffers -- the bridge fills them with the parameter value each block.

Manifest dataclass

Manifest(
    gen_name: str,
    num_inputs: int,
    num_outputs: int,
    params: list[ParamInfo] = list(),
    buffers: list[str] = list(),
    remapped_inputs: list[RemappedInput] = list(),
    source: str = "gen~",
    version: str = "0.8.0",
)

Front-end-agnostic intermediate representation for platform backends.

parse_params_from_export

parse_params_from_export(
    export_info: ExportInfo,
) -> list[ParamInfo]

Parse parameter metadata from a gen~ export's .cpp file.

Returns an empty list if parsing fails or no params exist.

manifest_from_export_info

manifest_from_export_info(
    export_info: ExportInfo,
    buffers: list[str],
    version: str,
) -> Manifest

Build a Manifest from a parsed gen~ ExportInfo.

apply_inputs_as_params

apply_inputs_as_params(
    manifest: Manifest,
    input_names: list[str],
    remap_names: list[str] | None = None,
) -> Manifest

Remap signal inputs to parameters.

When remap_names is None (bare --inputs-as-params), all signal inputs are remapped. When a list is given, only those named inputs are remapped.

The returned manifest has reduced num_inputs and extra ParamInfo entries appended for each remapped input. The remapped_inputs list records the mapping from gen~ input index to param index.

Parameters:

Name Type Description Default
manifest Manifest

Original manifest with gen~'s real I/O counts.

required
input_names list[str]

Input names from ExportInfo.input_names.

required
remap_names list[str] | None

Subset of input names to remap, or None for all.

None

Returns:

Type Description
Manifest

New Manifest with remapped inputs applied.

Raises:

Type Description
ValueError

If a requested name is not in input_names.

build_remap_defines

build_remap_defines(manifest: Manifest) -> str

Build CMake compile definition lines for input-to-parameter remapping.

Returns an empty string if no inputs are remapped, or newline+indent separated definition strings suitable for CMake target_compile_definitions().

Follows the same pattern as build_midi_defines() in midi.py.

build_remap_defines_make

build_remap_defines_make(
    manifest: Manifest, flag_vars: str | list[str] = "FLAGS"
) -> str

Build Make-style compile flags for input-to-parameter remapping.

Returns an empty string if no inputs are remapped, or newline-separated FLAG_VAR += -DKEY=VALUE lines suitable for Makefile templates.

flag_vars can be a single variable name or a list (e.g. ["CFLAGS", "CPPFLAGS"]) to emit defines for multiple flag variables.