Pulp 1.88.0
Cross-platform audio plugin framework
Loading...
Searching...
No Matches
pulp::timeline_editor::SnapGrid Class Reference

A validated musical grid whose phase restarts at every authored bar. More...

#include <snap_grid.hpp>

Public Member Functions

timebase::TickPosition snap (const timebase::CompiledMeterMap &meter_map, timebase::TickPosition position, SnapDirection direction=SnapDirection::Nearest) const noexcept
 Snap position without leaving the signed tick domain.
timebase::TickDuration interval () const noexcept
timebase::SwingRatio swing () const noexcept

Static Public Member Functions

static runtime::Result< SnapGrid, SnapGridError > create (timebase::TickDuration interval, timebase::SwingRatio swing=timebase::kStraightSwing) noexcept

Detailed Description

A validated musical grid whose phase restarts at every authored bar.

The interval is expressed in ticks so callers can offer straight, dotted, triplet or custom resolutions without a UI enum leaking into the kernel. Every bar boundary is also a grid boundary, including when the interval does not divide that bar. Swing warps interior boundaries in pairs and is restarted from the bar, so a meter change cannot inherit the previous signature's phase.

Member Function Documentation

◆ create()

runtime::Result< SnapGrid, SnapGridError > pulp::timeline_editor::SnapGrid::create ( timebase::TickDuration interval,
timebase::SwingRatio swing = timebase::kStraightSwing )
staticnoexcept

◆ interval()

timebase::TickDuration pulp::timeline_editor::SnapGrid::interval ( ) const
inlinenoexcept

◆ snap()

timebase::TickPosition pulp::timeline_editor::SnapGrid::snap ( const timebase::CompiledMeterMap & meter_map,
timebase::TickPosition position,
SnapDirection direction = SnapDirection::Nearest ) const
noexcept

Snap position without leaving the signed tick domain.

All directions include an exact boundary. Nearest resolves an exact midpoint toward the later tick so two input devices cannot disagree through incidental rounding. A directional request with no representable boundary on that side clamps to the signed endpoint; nearest still chooses a real representable boundary on the other side.

◆ swing()

timebase::SwingRatio pulp::timeline_editor::SnapGrid::swing ( ) const
inlinenoexcept

The documentation for this class was generated from the following file:
  • /home/runner/work/pulp/pulp/core/timeline_editor/include/pulp/timeline_editor/snap_grid.hpp