Pulp 1.88.0
Cross-platform audio plugin framework
Loading...
Searching...
No Matches
graph_scale.hpp File Reference

Shared axis mapping for frequency-domain plots. More...

#include <cstddef>
#include <span>
#include <vector>

Go to the source code of this file.

Classes

struct  pulp::view::LogFrequencyScale
 Maps frequency (Hz) to a horizontal pixel position on a logarithmic axis. More...
struct  pulp::view::DecibelScale
 Maps decibels to a vertical pixel position on a linear axis (dB is already logarithmic in amplitude, so the axis itself is linear in dB). More...

Namespaces

namespace  pulp
namespace  pulp::view
 Hover-cursor tracking for platform window hosts.

Functions

void pulp::view::resample_spectrum_log (std::span< const float > bins_db, float sample_rate, const LogFrequencyScale &scale, std::span< float > out)
 Resample a real-FFT magnitude array (bins spanning DC..Nyquist) onto out.size() log-spaced frequencies across [scale.min_hz, scale.max_hz], linearly interpolating in dB between adjacent bins.

Detailed Description

Shared axis mapping for frequency-domain plots.

Every widget that draws against a frequency axis — EQ curves, spectrum analyzers, spectrograms — needs the same four conversions and the same tick placement. When each one keeps its own private copy they drift: one ends up logarithmic and another linear, and then a spectrum can no longer be overlaid on an EQ curve because the two disagree about where 1 kHz is. These scales are the single definition, so the overlay lines up by construction.