Deluge Firmware 1.3.0
Build date: 2026.11.28
Loading...
Searching...
No Matches
deluge::accidentals Namespace Reference

Classes

struct  SpelledKey
struct  NoteDestination
 Where a scale change puts a note. More...

Enumerations

enum class  AccidentalHandling { FOLLOW_ANCHOR , KEEP_PITCH }
 What a scale change which shifts scale degrees does with accidentals. More...

Functions

int32_t lineageAnchor (int32_t pitch, AnchorMarker marker, const SpelledKey &key)
AnchorMarker markerFor (int32_t pitch, int32_t anchor, const SpelledKey &newKey)
NoteDestination destination (int32_t pitch, AnchorMarker marker, const SpelledKey &oldKey, const ScaleChange &change, AccidentalHandling handling)

Detailed Description

Pure helpers for "accidental lineage": notes outside the key (accidentals) hang off an in-key anchor pitch, and follow it through scale changes. A Note stores an AnchorMarker only when its anchor can't be derived from its pitch and the key (e.g. after a scale change put it on an in-key pitch).

Enumeration Type Documentation

◆ AccidentalHandling

What a scale change which shifts scale degrees does with accidentals.

Enumerator
FOLLOW_ANCHOR 

They move along with the in-key note they hang off.

KEEP_PITCH 

They stay at their pitch (sharpening or flattening one degree).

Function Documentation

◆ destination()

NoteDestination deluge::accidentals::destination ( int32_t pitch,
AnchorMarker marker,
const SpelledKey & oldKey,
const ScaleChange & change,
AccidentalHandling handling )

Where a note at pitch with the given marker goes under a scale change away from oldKey. There are three kinds of change:

  • By letter (change.letterMapping is set; scale selection): every note moves with its anchor's degree letter, and one whose letter the target scale lacks keeps its pitch. handling is ignored.
  • Pitch-preserving (change.isIdentity()): no note moves; only the anchors are worked out again.
  • By degree (rotating the mode, nudging by scale degrees, sharpening or flattening one degree): a note which is its own in-key anchor moves by its degree's shift. What an accidental does is up to handling. Keep-pitch example: C major with an F# accidental, sharpen F: the F row lands on F#; the accidental stays on F# with anchor F, so it is marked offset(-1) and splits back out when F# is flattened back to F.

◆ lineageAnchor()

int32_t deluge::accidentals::lineageAnchor ( int32_t pitch,
AnchorMarker marker,
const SpelledKey & key )

The anchor of a note at pitch with the given marker: the one the marker names, or for a derived (unmarked) note its display anchor in the key (which is the pitch itself if that is in key).

◆ markerFor()

AnchorMarker deluge::accidentals::markerFor ( int32_t pitch,
int32_t anchor,
const SpelledKey & newKey )

Marker to store for a note which a scale change left at pitch with the given anchor, under the key after the change: derived if that key gives the pitch this anchor anyway (or the distance can't be stored), self if the note is its own anchor but the key would derive another, else the offset.