libpromeki
1.0.0-alpha
PROfessional MEdia toolKIt
Loading...
Searching...
No Matches
notesequenceparser.h
Go to the documentation of this file.
1
8
#pragma once
9
10
11
#include <promeki/config.h>
12
#if PROMEKI_ENABLE_MUSIC
13
#include <
promeki/string.h
>
14
#include <
promeki/map.h
>
15
#include <
promeki/stringlist.h
>
16
#include <
promeki/musicalnote.h
>
17
#include <
promeki/musicalscale.h
>
18
19
PROMEKI_NAMESPACE_BEGIN
20
45
class
NoteSequenceParser {
46
public
:
52
MusicalNote::List parse(
const
String &input);
53
58
const
StringList &errors()
const
{
return
_errors; }
59
60
private
:
61
struct
Params {
62
double
tempo = 100.0;
63
double
noteLength = 0.25;
64
float
amplitude = 0.5f;
65
int
octave = 4;
66
MusicalScale scale;
67
float
legato = 0.5f;
68
float
vibrato = 0.0f;
69
float
vibratoRate = 5.0f;
70
float
tremolo = 0.0f;
71
float
tremoloRate = 5.0f;
72
};
73
74
String _input;
75
size_t
_pos = 0;
76
double
_currentTime = 0.0;
77
Params _params;
78
List<Params> _paramStack;
79
Map<String, Params> _namedParams;
80
MusicalNote::List _notes;
81
StringList _errors;
82
83
void
parseToken();
84
void
parseTempo();
85
void
parseNoteLengthParam();
86
void
parseAmplitude();
87
void
parseOctave();
88
void
parseScaleParam();
89
void
parseLegato();
90
void
parseVibrato();
91
void
parseTremolo();
92
void
parseLetterNote();
93
void
parseNumericNote();
94
void
parseRest();
95
void
parseBarRest();
96
void
parseSaveParams();
97
void
parseRecallParams();
98
void
pushParams();
99
void
popParams();
100
void
skipComment();
101
void
skipWhitespace();
102
103
char
current()
const
;
104
char
peek(
int
offset)
const
;
105
bool
atEnd()
const
;
106
String readParenArg();
107
double
parseDurationModifier();
108
void
emitNote(
float
midiNote,
int
dots,
double
lengthMod);
109
void
emitRest(
int
dots,
double
lengthMod);
110
void
addError(
const
String &msg);
111
112
static
double
parseNoteLengthValue(
const
String &s);
113
static
double
applyDots(
double
length,
int
dots);
114
};
115
116
PROMEKI_NAMESPACE_END
117
118
#endif
// PROMEKI_ENABLE_MUSIC
map.h
musicalnote.h
musicalscale.h
string.h
stringlist.h
include
promeki
notesequenceparser.h
Generated on 2026-05-21 02:27:58 from commit ffbc5cc (1.0.0-alpha).