Skip to main content

Crate beamer_macros

Crate beamer_macros 

Source
Expand description

Derive macros for the Beamer audio plugin framework.

This crate provides the #[derive(Parameters)] macro for generating parameter trait implementations automatically.

§Declarative Parameter Descriptor

Parameters can be defined entirely through attributes - the macro generates the Default impl automatically:

use beamer::prelude::*;

#[derive(Parameters)]
pub struct GainParameters {
    #[parameter(id = "gain", name = "Gain", default = 0.0, range = -60.0..=12.0, kind = "db")]
    pub gain: FloatParameter,

    #[parameter(id = "bypass", bypass = true)]
    pub bypass: BoolParameter,
}

// No manual Default impl needed - macro generates everything!

The macro generates implementations for both Parameters (high-level) and ParameterStore (host integration) traits, plus Default when all required attributes are present.

§Flat Visual Grouping

Use group = "..." for visual grouping in the DAW without nested structs:

#[derive(Parameters)]
pub struct SynthParameters {
    // Filter parameters - grouped visually in DAW
    #[parameter(id = "cutoff", name = "Cutoff", group = "Filter", ...)]
    pub cutoff: FloatParameter,

    #[parameter(id = "reso", name = "Resonance", group = "Filter", ...)]
    pub resonance: FloatParameter,

    // Output parameters - different visual group
    #[parameter(id = "gain", name = "Gain", group = "Output", ...)]
    pub gain: FloatParameter,
}

// Access is flat: parameters.cutoff, parameters.resonance, parameters.gain
// But DAW shows them in collapsible "Filter" and "Output" groups

Attribute Macros§

export
Attribute macro that generates plugin configuration and entry points.

Derive Macros§

EnumParameter
Derive macro for implementing EnumParameterValue trait on enums.
HasParameters
Derive macro for implementing the HasParameters trait.
Parameters
Derive macro for implementing parameter traits.