diff options
author | JSDurand <mmemmew@gmail.com> | 2021-07-11 18:45:38 +0800 |
---|---|---|
committer | JSDurand <mmemmew@gmail.com> | 2021-07-11 18:45:38 +0800 |
commit | 6c358a842baaf6d211a5c8c1717d815e7813ed96 (patch) | |
tree | c78122d49e75a540a4f6054b224a90738b554606 /parser.h |
First commit
Now I have a kind of piano like instrument. A violin-like instrument
is being constructed.
Diffstat (limited to 'parser.h')
-rw-r--r-- | parser.h | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/parser.h b/parser.h new file mode 100644 index 0000000..3454bd4 --- /dev/null +++ b/parser.h @@ -0,0 +1,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 + |