SUPERB
Flows

metronome reference

Generated from the source by scripts/reference.py. Do not edit this file. The short page, with the examples, is [metronome](metronome.md).

Reference

Every function of the metronome flow: what it takes, what it returns, what it refuses, and how it undoes. A Result<T> is Ok(T) or a SuperbError; the errors listed are the ones you can cause.

enable

pub fn enable(session: &mut Session, on: bool) -> Result<()>

Turns the click on or off. State, like mute: saved with the session, heard at the next block, not an undo step.

Takes

  • session: &mut Session — the open session, borrowed mutably
  • on: bool — true to switch on, false to switch off

Returns Result<()> — nothing

Errors never.

Undo none: state, not an edit (saved through the state file, see session::state_file); heard at the next block.

Made of MetronomeState::enabled through session::set_state → ClickParams::set_enabled.

Example

metronome::enable(&mut session, true)?;

level

pub fn level(session: &mut Session, db: f32) -> Result<()>

Sets the click level in dB. Moves within Session::COALESCE_WINDOW are one undo step; heard at once.

Takes

  • session: &mut Session — the open session, borrowed mutably
  • db: f32 — a level in decibels; 0.0 is unity, negative is quieter

Returns Result<()> — nothing

Errors never.

Undo one undo step per drag: calls within Session::COALESCE_WINDOW (half a second) merge; heard at once.

Made of set_metronome_level_db through session::edit → ClickParams::set_level.

Example

metronome::level(&mut session, -12.0)?;

count_in

pub fn count_in(session: &mut Session, bars: u32) -> Result<()>

Sets how many bars of count-in a recording gets when it starts at the playhead: record::start rolls the transport that many bars early with the click sounding, and drops into record at the playhead. 0 for none. State, saved with the session.

Takes

  • session: &mut Session — the open session, borrowed mutably
  • bars: u32 — bars of click before a recording that starts at the playhead; 0 for none

Returns Result<()> — nothing

Errors never.

Undo none: state, not an edit (saved through the state file, see session::state_file).

Made of MetronomeState::count_in through session::set_state.

Example

metronome::count_in(&mut session, 2)?;   // two bars of click before a recording at the playhead

On this page