Deluge Firmware 1.3.0
Build date: 2026.11.28
Loading...
Searching...
No Matches
scale_change.h
1#pragma once
2
3#include "model/scale/note_set.h"
4#include <array>
5#include <cstdint>
6#include <optional>
7
13 bool preferFlats = false;
15 std::array<int8_t, 12> sourceLetter{-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1};
17 std::array<int8_t, 7> sourcePrimary{-1, -1, -1, -1, -1, -1, -1};
19 std::array<int8_t, 7> targetPrimary{-1, -1, -1, -1, -1, -1, -1};
21 std::array<int8_t, 7> targetSecond{-1, -1, -1, -1, -1, -1, -1};
22};
23
25public:
29 NoteSet target;
32 int8_t operator[](uint8_t degree) const { return degreeOffset[degree]; }
33 int8_t& operator[](uint8_t degree) { return degreeOffset[degree]; }
42 NoteSet applyTo(NoteSet notes) const;
43
47 bool isIdentity() const {
48 if (letterMapping) {
49 return false;
50 }
51 for (int8_t offset : degreeOffset) {
52 if (offset != 0) {
53 return false;
54 }
55 }
56 return true;
57 }
58
60 std::optional<LetterMapping> letterMapping;
61
62private:
63 int8_t degreeOffset[kMaxScaleSize] = {0};
64};
Definition note_set.h:20
Definition scale_change.h:24
NoteSet source
Definition scale_change.h:28
int8_t operator[](uint8_t degree) const
Definition scale_change.h:32
bool isIdentity() const
Definition scale_change.h:47
NoteSet applyTo(NoteSet notes) const
Definition scale_change.cpp:4
std::optional< LetterMapping > letterMapping
Definition scale_change.h:60
Definition scale_change.h:11
std::array< int8_t, 12 > sourceLetter
Letter 0..6 of each interval of the source scale.
Definition scale_change.h:15
std::array< int8_t, 7 > sourcePrimary
For each letter, the interval of the source scale's (primary) note with it.
Definition scale_change.h:17
bool preferFlats
How anchors outside the source scale are spelled.
Definition scale_change.h:13
std::array< int8_t, 7 > targetSecond
For each letter, the interval of the target scale's second note with it, if two share the letter.
Definition scale_change.h:21
std::array< int8_t, 7 > targetPrimary
For each letter, the interval of the target scale's (primary) note with it.
Definition scale_change.h:19