-
Notifications
You must be signed in to change notification settings - Fork 0
/
Note.h
52 lines (33 loc) · 914 Bytes
/
Note.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#pragma once
#include <vector>
#include <cassert>
#include <functional>
#include <set>
#include <type_traits>
#include <Windows.h>
constexpr auto NOTE_LENGTH = 150;
constexpr auto FAST_DELAY = 100;
constexpr auto NO_DELAY = 3; // [] play together
enum class NoteType { // TODO: delete this?
SINGLE,
MULTI,
SILENT
};
class Note {
public:
const NoteType type;
const std::vector<char> keys;
// delay between this note and the next
const unsigned int delay;
static Note singleNote(char key) {
return Note{NoteType::SINGLE, {key}, NOTE_LENGTH};
}
static Note silentNote(unsigned int delay_len) {
return Note{NoteType::SILENT, {}, delay_len};
}
template<typename Iter>
static Note multiNote(Iter begin, Iter end) { // [] groups
assert(begin != end);
return Note{NoteType ::MULTI, {begin, end}, NOTE_LENGTH};
}
};