Control Surface
2.1.2
MIDI Control Surface library for Arduino
Toggle main menu visibility
Loading...
Searching...
No Matches
src
MIDI_Constants
Notes.hpp
Go to the documentation of this file.
1
/* ✔ */
2
3
#pragma once
4
5
#include <
Settings/NamespaceSettings.hpp
>
6
#include <stdint.h>
7
8
BEGIN_CS_NAMESPACE
9
12
29
namespace
MIDI_Notes
{
30
31
class
Note
{
32
private
:
33
int8_t
base
;
34
constexpr
Note
(int8_t
base
) :
base
(
base
) {}
35
36
public
:
37
constexpr
int8_t
operator()
(int8_t octave = -1)
const
{
38
return
base
+ 12 * (octave + 1);
39
}
40
constexpr
int8_t
operator[]
(int8_t octave)
const
{
return
(*
this
)(octave); }
41
42
constexpr
static
Note
(
C
)() {
return
Note
{0}; }
43
constexpr
static
Note
(
Db
)() {
return
Note
{1}; }
44
constexpr
static
Note
(
D
)() {
return
Note
{2}; }
45
constexpr
static
Note
(
Eb
)() {
return
Note
{3}; }
46
constexpr
static
Note
(
E
)() {
return
Note
{4}; }
47
constexpr
static
Note
(
F
)() {
return
Note
{5}; }
48
constexpr
static
Note
(
Gb
)() {
return
Note
{6}; }
49
constexpr
static
Note
(
G
)() {
return
Note
{7}; }
50
constexpr
static
Note
(
Ab
)() {
return
Note
{8}; }
51
constexpr
static
Note
(
A
)() {
return
Note
{9}; }
52
constexpr
static
Note
(
Bb
)() {
return
Note
{10}; }
53
constexpr
static
Note
(
B
)() {
return
Note
{11}; }
54
};
55
56
constexpr
Note
C
= (
Note::C
)();
57
constexpr
Note
Db
= (
Note::Db
)();
58
constexpr
Note
D
= (
Note::D
)();
59
constexpr
Note
Eb
= (
Note::Eb
)();
60
constexpr
Note
E
= (
Note::E
)();
61
constexpr
Note
F
= (
Note::F
)();
62
constexpr
Note
Gb
= (
Note::Gb
)();
63
constexpr
Note
G
= (
Note::G
)();
64
constexpr
Note
Ab
= (
Note::Ab
)();
65
constexpr
Note
A
= (
Note::A
)();
66
constexpr
Note
Bb
= (
Note::Bb
)();
67
constexpr
Note
B
= (
Note::B
)();
68
69
CS_DEPREC
(
"Instead of `MIDI_Notes::F_(4)`, use `MIDI_Notes::F[4]`"
)
70
constexpr
Note
F_
= (
Note
::
F
)();
71
73
CS_DEPREC
(
"Instead of `note(C, 4)`, use `MIDI_Notes::C(4)`"
)
74
constexpr int8_t
note
(
Note
note
, int8_t numOctave) {
return
note
(numOctave); }
75
76
}
// namespace MIDI_Notes
77
79
80
END_CS_NAMESPACE
NamespaceSettings.hpp
CS_DEPREC
#define CS_DEPREC(...)
Definition
Settings/NamespaceSettings.hpp:30
END_CS_NAMESPACE
#define END_CS_NAMESPACE
Definition
Settings/NamespaceSettings.hpp:14
BEGIN_CS_NAMESPACE
#define BEGIN_CS_NAMESPACE
Definition
Settings/NamespaceSettings.hpp:11
MIDI_Notes::Note
Definition
Notes.hpp:31
MIDI_Notes::Note::F
static constexpr Note F()
Definition
Notes.hpp:47
MIDI_Notes::Note::A
static constexpr Note A()
Definition
Notes.hpp:51
MIDI_Notes::Note::base
int8_t base
Definition
Notes.hpp:33
MIDI_Notes::Note::operator[]
constexpr int8_t operator[](int8_t octave) const
Definition
Notes.hpp:40
MIDI_Notes::Note::Bb
static constexpr Note Bb()
Definition
Notes.hpp:52
MIDI_Notes::Note::E
static constexpr Note E()
Definition
Notes.hpp:46
MIDI_Notes::Note::D
static constexpr Note D()
Definition
Notes.hpp:44
MIDI_Notes::Note::Db
static constexpr Note Db()
Definition
Notes.hpp:43
MIDI_Notes::Note::Note
constexpr Note(int8_t base)
Definition
Notes.hpp:34
MIDI_Notes::Note::C
static constexpr Note C()
Definition
Notes.hpp:42
MIDI_Notes::Note::Eb
static constexpr Note Eb()
Definition
Notes.hpp:45
MIDI_Notes::Note::operator()
constexpr int8_t operator()(int8_t octave=-1) const
Definition
Notes.hpp:37
MIDI_Notes::Note::G
static constexpr Note G()
Definition
Notes.hpp:49
MIDI_Notes::Note::Gb
static constexpr Note Gb()
Definition
Notes.hpp:48
MIDI_Notes::Note::B
static constexpr Note B()
Definition
Notes.hpp:53
MIDI_Notes::Note::Ab
static constexpr Note Ab()
Definition
Notes.hpp:50
MIDI_Notes
MIDI note names.
Definition
Notes.hpp:29
MIDI_Notes::F_
constexpr Note F_
F (Fa).
Definition
Notes.hpp:70
MIDI_Notes::note
constexpr int8_t note(Note note, int8_t numOctave)
Get the MIDI note in the given octave.
Definition
Notes.hpp:74
MIDI_Notes::Bb
constexpr Note Bb
A♯, B♭ (La sharp, Si flat).
Definition
Notes.hpp:66
MIDI_Notes::Db
constexpr Note Db
C♯, D♭ (Do sharp, Re flat).
Definition
Notes.hpp:57
MIDI_Notes::F
constexpr Note F
F (Fa).
Definition
Notes.hpp:61
MIDI_Notes::Gb
constexpr Note Gb
F♯, G♭ (Fa sharp, Sol flat).
Definition
Notes.hpp:62
MIDI_Notes::G
constexpr Note G
G (Sol).
Definition
Notes.hpp:63
MIDI_Notes::Eb
constexpr Note Eb
D♯, E♭ (Re sharp, Mi flat).
Definition
Notes.hpp:59
MIDI_Notes::Ab
constexpr Note Ab
G♯, A♭ (Sol sharp, La flat).
Definition
Notes.hpp:64
MIDI_Notes::E
constexpr Note E
E (Mi).
Definition
Notes.hpp:60
MIDI_Notes::B
constexpr Note B
B (Si).
Definition
Notes.hpp:67
MIDI_Notes::A
constexpr Note A
A (La).
Definition
Notes.hpp:65
MIDI_Notes::C
constexpr Note C
C (Do).
Definition
Notes.hpp:56
MIDI_Notes::D
constexpr Note D
D (Re).
Definition
Notes.hpp:58
Generated by
1.17.0