Pulp 1.88.0
Cross-platform audio plugin framework
Loading...
Searching...
No Matches
midi_lane.hpp
Go to the documentation of this file.
1#pragma once
2
5
6#include <compare>
7#include <cstdint>
8#include <vector>
9
10// Storage shape for the continuous controller and expression streams a MIDI
11// clip carries alongside its notes.
12//
13// Every address field below is the MIDI wire value it names, not a Pulp-local
14// enumeration of controller families: `group` and `channel` are the address a
15// UMP channel-voice message carries, `status` is that message's status nibble,
16// and `bank`/`index` are the controller's own bank and index numbers. A plain
17// continuous controller leaves `bank` zero; a registered or assignable
18// controller fills it. Keeping the wire encoding means a lane is emitted
19// without a translation table, and a controller family nobody anticipated
20// needs new *values*, never a new C++ type.
21//
22// The layout is per-stream rather than one interleaved event list, because the
23// question a player asks on every seek is "what did this one stream last say
24// at or before t" — answerable by binary search within a single lane, but only
25// a linear scan across an interleaved list.
26namespace pulp::timeline {
27
31
33inline constexpr std::uint8_t midi_lane_address_maximum = 15u;
34
43 std::uint8_t group = 0;
45 std::uint8_t channel = 0;
47 std::uint8_t status = 0;
49 std::uint8_t bank = 0;
51 std::uint8_t index = 0;
52
53 constexpr auto operator<=>(const MidiLaneAddress&) const = default;
54};
55
57constexpr bool midi_lane_address_well_formed(const MidiLaneAddress& address) noexcept {
58 return address.group <= midi_lane_address_maximum &&
59 address.channel <= midi_lane_address_maximum &&
60 address.status <= midi_lane_address_maximum;
61}
62
71 std::uint32_t value = 0;
80 bool chased = false;
81
82 constexpr auto operator<=>(const MidiLanePoint&) const = default;
83};
84
93 std::vector<MidiLanePoint> points;
94
95 auto operator<=>(const MidiExpressionLane&) const = default;
96};
97
99
100} // namespace pulp::timeline
constexpr bool midi_lane_address_well_formed(const MidiLaneAddress &address) noexcept
Returns whether every address component fits the width the wire gives it.
Definition midi_lane.hpp:57
constexpr std::uint8_t midi_lane_address_maximum
Largest admitted UMP group and channel address component.
Definition midi_lane.hpp:33
Definition program_compiler.hpp:18
Definition tick.hpp:61
Nonzero monotonic identity for a Timeline-owned object.
Definition item_id.hpp:19
One controller stream's authored points, ordered by (position, id).
Definition midi_lane.hpp:90
auto operator<=>(const MidiExpressionLane &) const =default
std::vector< MidiLanePoint > points
Definition midi_lane.hpp:93
ItemId id
Definition midi_lane.hpp:91
MidiLaneAddress address
Definition midi_lane.hpp:92
Address of one continuous controller stream within a MidiContent.
Definition midi_lane.hpp:41
std::uint8_t group
UMP group carrying the stream.
Definition midi_lane.hpp:43
std::uint8_t bank
Controller bank; zero for controllers that have none.
Definition midi_lane.hpp:49
std::uint8_t index
Controller index within its bank.
Definition midi_lane.hpp:51
std::uint8_t status
Channel-voice status nibble identifying the controller family.
Definition midi_lane.hpp:47
std::uint8_t channel
Channel within the group.
Definition midi_lane.hpp:45
constexpr auto operator<=>(const MidiLaneAddress &) const =default
One authored value on a controller lane, positioned in canonical ticks.
Definition midi_lane.hpp:68
constexpr auto operator<=>(const MidiLanePoint &) const =default
std::uint32_t value
Definition midi_lane.hpp:71
ItemId id
Definition midi_lane.hpp:69
timebase::TickPosition position
Definition midi_lane.hpp:70
bool chased
Whether flattening derived this point at a retained-window boundary rather than reading it where the ...
Definition midi_lane.hpp:80