summaryrefslogtreecommitdiff
path: root/parser.h
blob: 3454bd469196f3df00af52e46753fe1c2184a9a6 (plain)
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
#ifndef PARSER_H
#define PARSER_H
#include "util.h"
#include "instrument.h"

/* Parse a complex sheet file so that it is easy to generate complex
   sounds. */

/* A unit for the parser.  This typically represents one note, but can
   serve different purposes.  In our format, a unit is given in one
   line. */

struct PUnit_s;

typedef struct PUnit_s PUnit;

struct PNote_s;

typedef struct PNote_s PNote;

/* A sheet is just an array of units.  But we need to know the length
   of the array as well. */

typedef struct {
  PUnit *data;
  LENT len;
} PSheet;

U_ATTR void print_sheet(const PSheet sh);

/* Might be helpful, or not */

H_ATTR unsigned char is_empty_note(PNote *n);

/* The function to read the sheet. */

U_ATTR PSheet read_sheet(const char *str, LENT len);

/* Destructor */

U_ATTR void destroy_sheet(PSheet sh);

/* Now play sheet */

U_ATTR WaveFrag play_sheet(const PSheet sh, const Volume v);

#endif