summaryrefslogtreecommitdiff
path: root/project/Core/Inc/Project/parser.h
blob: 85da26c8035c1f953c3d428d41343da44038ed57 (plain) (blame)
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
/*
 * player.h
 *
 *  Created on: Dec 10, 2025
 *      Author: sowgro
 */

#ifndef INC_PROJECT_PARSER_H_
#define INC_PROJECT_PARSER_H_

#include <stdint.h>

#define NOTE_OFF_EVENT (0)
#define NOTE_ON_EVENT (1)
#define KEY_PRESSURE (2)

typedef struct {
	uint8_t ev_type;
	uint32_t abs_time;
	uint8_t key_number;
	uint8_t value;
} note_event_t;

typedef struct {
	note_event_t events[1024];
	int nEvents;
	int curEventIndex;
} track_t;

typedef struct {
	char *title;
	char *copyright;
	int tempo;
} song_info_t;

void parser_play_init();

void parser_play_loop();

void parse_song(uint8_t *p_song);

uint8_t *parse_track(uint8_t *p_song, track_t *track);

uint8_t *parse_song_info(uint8_t *p_song, song_info_t *ret);

song_info_t parser_get_song_info();

#endif /* INC_PROJECT_PARSER_H_ */