Pulp 1.88.0
Cross-platform audio plugin framework
Loading...
Searching...
No Matches
pulp::view::LogFrequencyScale Struct Reference

Maps frequency (Hz) to a horizontal pixel position on a logarithmic axis. More...

#include <graph_scale.hpp>

Public Member Functions

float to_x (float hz) const
 Pixel x of a frequency.
float to_frequency (float px) const
 Frequency at a pixel x. Inverse of to_x().
float frequency_at (std::size_t index, std::size_t count) const
 Frequency of point index of count, log-spaced across the axis, so point i lands on evenly spaced pixel columns.
std::vector< float > ticks () const
 Gridline frequencies in a 1-2-5 sequence per decade (20, 30, 50, 100, 200, …) clipped to [min_hz, max_hz].

Static Public Member Functions

static bool is_major_tick (float hz)
 True for decade boundaries (100, 1k, 10k) — the lines conventionally drawn heavier and labeled.

Public Attributes

float min_hz = 20.0f
float max_hz = 20000.0f
float x = 0.0f
 left edge, pixels
float width = 0.0f
 axis width, pixels

Detailed Description

Maps frequency (Hz) to a horizontal pixel position on a logarithmic axis.

Frequency is perceived roughly logarithmically, so an audio frequency axis is log by default — an octave occupies the same width everywhere.

Member Function Documentation

◆ frequency_at()

float pulp::view::LogFrequencyScale::frequency_at ( std::size_t index,
std::size_t count ) const

Frequency of point index of count, log-spaced across the axis, so point i lands on evenly spaced pixel columns.

Mirrors pulp::signal::log_frequency_at so a curve sampled in the DSP layer maps one-to-one onto this axis with no resampling.

◆ is_major_tick()

bool pulp::view::LogFrequencyScale::is_major_tick ( float hz)
static

True for decade boundaries (100, 1k, 10k) — the lines conventionally drawn heavier and labeled.

◆ ticks()

std::vector< float > pulp::view::LogFrequencyScale::ticks ( ) const

Gridline frequencies in a 1-2-5 sequence per decade (20, 30, 50, 100, 200, …) clipped to [min_hz, max_hz].

◆ to_frequency()

float pulp::view::LogFrequencyScale::to_frequency ( float px) const

Frequency at a pixel x. Inverse of to_x().

◆ to_x()

float pulp::view::LogFrequencyScale::to_x ( float hz) const

Pixel x of a frequency.

Not clamped — callers plotting a curve want points just outside the viewport to keep the line's slope correct at the edges.

Member Data Documentation

◆ max_hz

float pulp::view::LogFrequencyScale::max_hz = 20000.0f

◆ min_hz

float pulp::view::LogFrequencyScale::min_hz = 20.0f

◆ width

float pulp::view::LogFrequencyScale::width = 0.0f

axis width, pixels

◆ x

float pulp::view::LogFrequencyScale::x = 0.0f

left edge, pixels


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