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 | |
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.
| 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.
|
static |
True for decade boundaries (100, 1k, 10k) — the lines conventionally drawn heavier and labeled.
| 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].
| float pulp::view::LogFrequencyScale::to_frequency | ( | float | px | ) | const |
Frequency at a pixel x. Inverse of 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.
| float pulp::view::LogFrequencyScale::max_hz = 20000.0f |
| float pulp::view::LogFrequencyScale::min_hz = 20.0f |
| float pulp::view::LogFrequencyScale::width = 0.0f |
axis width, pixels
| float pulp::view::LogFrequencyScale::x = 0.0f |
left edge, pixels