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

Projects an inclusive MIDI pitch range onto piano-roll rows. More...

#include <viewport_projection.hpp>

Public Member Functions

float y_at (std::uint8_t pitch) const noexcept
std::uint8_t pitch_at (float y) const noexcept
float row_height () const noexcept
constexpr std::uint8_t lowest_pitch () const noexcept
constexpr std::uint8_t highest_pitch () const noexcept
constexpr PixelSpan pixels () const noexcept

Static Public Member Functions

static runtime::Result< PitchProjection, ViewportProjectionError > create (std::uint8_t lowest_pitch, std::uint8_t highest_pitch, PixelSpan pixels) noexcept

Detailed Description

Projects an inclusive MIDI pitch range onto piano-roll rows.

Screen y increases downward, so the highest pitch owns the first row. A pitch projects to the center of its row without clipping, so renderers can cull notes outside the visible range. Inverse lookup returns the visible row that contains y and clamps outside input to the visible pitch endpoints.

Member Function Documentation

◆ create()

runtime::Result< PitchProjection, ViewportProjectionError > pulp::timeline_editor::PitchProjection::create ( std::uint8_t lowest_pitch,
std::uint8_t highest_pitch,
PixelSpan pixels )
staticnoexcept

◆ highest_pitch()

std::uint8_t pulp::timeline_editor::PitchProjection::highest_pitch ( ) const
inlinenodiscardconstexprnoexcept

◆ lowest_pitch()

std::uint8_t pulp::timeline_editor::PitchProjection::lowest_pitch ( ) const
inlinenodiscardconstexprnoexcept

◆ pitch_at()

std::uint8_t pulp::timeline_editor::PitchProjection::pitch_at ( float y) const
nodiscardnoexcept

◆ pixels()

PixelSpan pulp::timeline_editor::PitchProjection::pixels ( ) const
inlinenodiscardconstexprnoexcept

◆ row_height()

float pulp::timeline_editor::PitchProjection::row_height ( ) const
nodiscardnoexcept

◆ y_at()

float pulp::timeline_editor::PitchProjection::y_at ( std::uint8_t pitch) const
nodiscardnoexcept

The documentation for this class was generated from the following file: