49 return overview_ !=
nullptr && !overview_->empty();
54 return overview_ ? overview_->info().num_source_frames : 0;
63 vp_start_ = std::min(start_frame, total);
64 vp_end_ = std::min(end_frame, total);
65 if (vp_end_ < vp_start_)
100 bool column_peak(uint64_t f0, uint64_t
f1,
float& out_min,
float& out_max)
const {
103 const auto& lvl = overview_->level(0);
104 if (lvl.samples_per_peak == 0 || lvl.peaks.empty())
107 uint64_t p0 = f0 / lvl.samples_per_peak;
108 uint64_t p1 = (
f1 + lvl.samples_per_peak - 1) / lvl.samples_per_peak;
111 if (p0 >= lvl.peaks_per_channel)
113 p1 = std::min<uint64_t>(p1, lvl.peaks_per_channel);
115 float lo = 1.0f, hi = -1.0f;
116 const auto fold = [&](uint32_t ch) {
117 if (ch >= lvl.peaks.size())
119 const auto& col = lvl.peaks[ch];
120 for (uint64_t
i = p0;
i < p1 &&
i < col.size(); ++
i) {
121 lo = std::min(lo, col[
i].min());
122 hi = std::max(hi, col[
i].max());
126 for (uint32_t ch = 0; ch < lvl.peaks.size(); ++ch)
141 canvas.set_fill_color(bg_color_);
142 canvas.fill_rect(0.0f, 0.0f,
b.width,
b.height);
144 if (!
has_overview() || vp_end_ <= vp_start_ ||
b.width < 1.0f)
147 const float cy =
b.height * 0.5f;
148 const float half_h =
b.height * 0.5f;
149 canvas.set_stroke_color(line_color_);
150 canvas.set_line_width(1.0f);
152 const uint64_t span = vp_end_ - vp_start_;
153 const int cols =
static_cast<int>(
b.width);
154 for (
int px = 0;
px < cols; ++
px) {
156 vp_start_ + span *
static_cast<uint64_t
>(
px) /
static_cast<uint64_t
>(cols);
158 vp_start_ + span *
static_cast<uint64_t
>(
px + 1) /
static_cast<uint64_t
>(cols);
162 float lo = 0.0f, hi = 0.0f;
166 const float x =
static_cast<float>(
px) + 0.5f;
167 const float y_top = cy - hi * half_h;
168 float y_bot = cy - lo * half_h;
169 if (y_bot - y_top < 1.0f)
170 y_bot = y_top + 1.0f;
171 canvas.stroke_line(
x, y_top,
x, y_bot);
178 uint64_t vp_start_ = 0;
179 uint64_t vp_end_ = 0;
Definition canvas.hpp:240
Rect local_bounds() const
Definition view.hpp:88
Definition affine_transform.hpp:24
Hover-cursor tracking for platform window hosts.
Definition fwd.hpp:27
@ px
Absolute pixels.
Definition geometry.hpp:393
@ c
Definition input_events.hpp:39
@ i
Definition input_events.hpp:40
@ b
Definition input_events.hpp:39
@ x
Definition input_events.hpp:41
@ f1
Definition input_events.hpp:61
static constexpr Color rgba8(uint8_t r, uint8_t g, uint8_t b, uint8_t a=255)
Construct from 8-bit channels [0,255] — convenience for legacy/hex code.
Definition canvas.hpp:61
Axis-aligned rectangle in continuous (float) coordinates.
Definition geometry.hpp:52