-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathRhythm.h
50 lines (35 loc) · 1.22 KB
/
Rhythm.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
49
50
#ifndef _rhythm_h_
#define _rhythm_h_
#define RHYTHM_PATTERN_LENGTH 512
#define PATTERN_MAX_LENGTH 16
/* Minimum note: sixteenth note */
#define NOTE_VALUE_MIN 16
#ifndef _include_libs_arduino_
#define _include_libs_arduino_
#include <Arduino.h>
#endif;
class Rhythm {
private:
/* length of the Notes array */
static uint8_t Patterns_length;
/* array of note names for the notes we can play */
static uint8_t Patterns[][PATTERN_MAX_LENGTH];
public:
/* Time Signature: number of beats in each measure */
uint8_t measure_number_beats;
/* Time Signature: value of each beat in the measure */
uint8_t measure_beat_value;
/* note composition of the rhythmic pattern - adjusted for measure_number_beats
and measure_beat_value.
positive numbers are notes, negative numbers are pauses, zero marks measure end */
int8_t pattern[RHYTHM_PATTERN_LENGTH];
/* length of the rhythmic pattern */
uint32_t pattern_length;
/* measure count of the rhythmic pattern */
uint8_t measures_count;
void build_rhythm();
Rhythm(uint8_t measure_number_beats, uint8_t measure_beat_value);
Rhythm(uint8_t measure_number_beats, uint8_t measure_beat_value, uint32_t measures_count);
void print_debug();
};
#endif;