summaryrefslogtreecommitdiff
path: root/parser.h
diff options
context:
space:
mode:
Diffstat (limited to 'parser.h')
-rw-r--r--parser.h48
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
+