Deluge Firmware 1.3.0
Build date: 2026.11.28
Loading...
Searching...
No Matches
AnchorMarker Class Reference

#include <anchor_marker.h>

Public Member Functions

constexpr int8_t raw () const
constexpr bool isDerived () const
constexpr bool isSelf () const
constexpr bool isTagged () const
constexpr int32_t letter () const
 The degree letter 0..6 a tagged marker remembers.
constexpr int32_t semitonesToAnchor () const
 Semitones from the note's pitch to its anchor. Meaningless for derived(), which stores no anchor.
constexpr bool operator== (const AnchorMarker &) const =default

Static Public Member Functions

static constexpr AnchorMarker derived ()
static constexpr AnchorMarker self ()
static constexpr AnchorMarker offset (int32_t semitones)
 derived() if semitones is 0 or too large to store
static constexpr AnchorMarker tagged (int32_t letter, int32_t semitones)
 derived() if semitones is further than kMaxTaggedOffset
static constexpr AnchorMarker fromRaw (int8_t raw)

Static Public Attributes

static constexpr int32_t kMaxTaggedOffset = 4
 Largest distance (either way) a tagged marker can hold.

Private Member Functions

constexpr AnchorMarker (int8_t raw)

Private Attributes

int8_t raw_ = 0

Static Private Attributes

static constexpr int8_t kSelf = INT8_MIN
static constexpr int8_t kTagBase = INT8_MIN + 1
static constexpr int32_t kTagSpan = 2 * kMaxTaggedOffset + 1
static constexpr int8_t kLowestPlainOffset = kTagBase + 7 * kTagSpan

Detailed Description

What a Note remembers about its "anchor": the in-key pitch an accidental (a note outside the key) hangs off, and follows through scale changes (see model/scale/accidentals.h).

Usually nothing needs remembering, because the anchor follows from the note's pitch and the key. A marker is only stored when a scale change left the note somewhere that doesn't say where it came from. It is one of:

  • derived (the zero value): no marker. An in-key note is its own anchor; an accidental hangs off the row it is displayed on.
  • offset(n): the anchor is n semitones from the note's pitch.
  • self(): the note is its own anchor, although the key would derive another one for its pitch.
  • tagged(letter, n): the anchor is n semitones from the note's pitch (n == 0: the note itself), and was the note of degree letter 0..6 (see model/scale/scale_degrees.h) in a scale whose successor has no such degree. The anchor kept its pitch when that degree went away, so it may now sit on another degree's pitch or outside the key; the letter lets it find its degree again.

One byte, trivially copyable, and all-zero means derived, so Notes in zeroed raw memory are unmarked. raw() is what song files store.


The documentation for this class was generated from the following file: