Pulp 1.88.0
Cross-platform audio plugin framework
Loading...
Searching...
No Matches
grid_lines.hpp
Go to the documentation of this file.
1#pragma once
2
3#include <cstddef>
4#include <cstdint>
5#include <compare>
6#include <span>
7
10
11namespace pulp::timeline_editor {
12
14enum class GridLineLevel : std::uint8_t {
19};
20
22struct GridLine {
26 float x = 0.0f;
29 constexpr auto operator<=>(const GridLine&) const = default;
30};
31
45
51 std::size_t count = 0;
52
54 constexpr explicit operator bool() const noexcept {
55 return error == GridLineError::None;
56 }
57};
58
63 const timebase::CompiledMeterMap& meter,
64 float minimum_spacing_px,
65 std::span<GridLine> output) noexcept;
66
67} // namespace pulp::timeline_editor
Definition compiled_meter_map.hpp:64
Projects a visible musical-time range onto a horizontal pixel span.
Definition viewport_projection.hpp:36
ScriptedUiHost is a SequencerUiHost whose playhead is written by the caller instead of an engine,...
Definition edit_intent.hpp:14
GridLineLevel
Identifies the musical boundary represented by a grid line.
Definition grid_lines.hpp:14
@ Beat
Marks a beat subdivision after the bar boundary.
Definition grid_lines.hpp:18
@ Bar
Marks the first tick of a bar.
Definition grid_lines.hpp:16
GridLineError
Reports why grid-line generation stopped.
Definition grid_lines.hpp:33
@ NonPositiveSpacing
The requested minimum pixel spacing is zero or negative.
Definition grid_lines.hpp:39
@ NonFiniteSpacing
The requested minimum pixel spacing is not finite.
Definition grid_lines.hpp:37
@ None
Generation completed successfully.
Definition grid_lines.hpp:35
@ RangeOverflow
Meter or tick arithmetic could not advance safely through the range.
Definition grid_lines.hpp:41
@ OutputTooSmall
The output span filled before generation completed.
Definition grid_lines.hpp:43
GridLineResult generate_grid_lines(const TickProjection &projection, const timebase::CompiledMeterMap &meter, float minimum_spacing_px, std::span< GridLine > output) noexcept
Emits visible bar lines and beat lines that are at least minimum_spacing_px from their enclosing bar ...
Definition tick.hpp:61
Carries the generation status and the number of lines written.
Definition grid_lines.hpp:47
GridLineError error
Completion status for the generation attempt.
Definition grid_lines.hpp:49
std::size_t count
Number of initialized entries in the caller-provided output span.
Definition grid_lines.hpp:51
Describes one visible musical boundary in projected screen coordinates.
Definition grid_lines.hpp:22
constexpr auto operator<=>(const GridLine &) const =default
GridLineLevel level
Musical boundary level used to select its visual prominence.
Definition grid_lines.hpp:28
timebase::TickPosition tick
Musical position of the boundary.
Definition grid_lines.hpp:24
float x
Horizontal pixel coordinate produced by the projection.
Definition grid_lines.hpp:26