27 #ifndef PTTTL_PARSER_H
28 #define PTTTL_PARSER_H
38 #define PTTTL_VERSION "v0.3.0"
45 #ifndef PTTTL_MAX_CHANNELS_PER_FILE
46 #define PTTTL_MAX_CHANNELS_PER_FILE (16u)
55 #ifndef PTTTL_MAX_NAME_LEN
56 #define PTTTL_MAX_NAME_LEN (256u)
61 #define PTTTL_NOTE_VIBRATO_FREQ(note) (((note)->vibrato_settings) & 0xffffu)
64 #define PTTTL_NOTE_VIBRATO_VAR(note) ((((note)->vibrato_settings) >> 16u) & 0xffffu)
67 #define PTTTL_NOTE_VALUE(note) (((note)->note_settings) & 0x7fu)
72 #define PTTTL_NOTE_DURATION_IDX(note) ((((note)->note_settings) >> 7u) & 0x7u)
75 #define PTTTL_NOTE_DOT(note) ((((note)->note_settings) >> 10u) & 0x1u)
134 int (*read)(
char *input_char);
147 int (*seek)(uint32_t position);
int ptttl_parse_init(ptttl_parser_t *parser, ptttl_parser_input_iface_t iface)
#define PTTTL_MAX_CHANNELS_PER_FILE
Definition: ptttl_parser.h:46
int ptttl_parse_next(ptttl_parser_t *parser, uint32_t channel_idx, ptttl_output_note_t *note)
ptttl_parser_error_t ptttl_parser_error(ptttl_parser_t *state)
#define PTTTL_MAX_NAME_LEN
Definition: ptttl_parser.h:56
Definition: ptttl_parser.h:82
uint32_t note_settings
Definition: ptttl_parser.h:95
uint32_t vibrato_settings
Definition: ptttl_parser.h:102
Definition: ptttl_parser.h:156
const char * error_message
Human-readable error message.
Definition: ptttl_parser.h:157
int column
Column number within input text.
Definition: ptttl_parser.h:159
int line
Line number within input text.
Definition: ptttl_parser.h:158
Definition: ptttl_parser.h:167
unsigned int default_duration
Default note duration from the "settings" section.
Definition: ptttl_parser.h:170
ptttl_parser_error_t error
Last parsing error that occurred.
Definition: ptttl_parser.h:174
uint32_t channel_count
Total number of channels present in input text.
Definition: ptttl_parser.h:175
ptttl_parser_input_iface_t iface
Input interface for reading PTTTL source.
Definition: ptttl_parser.h:179
unsigned int default_vibrato_freq
Default vibrato frequency from the "settings" section.
Definition: ptttl_parser.h:172
ptttl_parser_input_stream_t stream
Input stream used for 'settings' section.
Definition: ptttl_parser.h:177
unsigned int default_vibrato_var
Default vibrato variance from the "settings" section.
Definition: ptttl_parser.h:173
unsigned int bpm
BPM from the "settings" section.
Definition: ptttl_parser.h:169
unsigned int default_octave
Default octave from the "settings" section.
Definition: ptttl_parser.h:171
ptttl_parser_input_stream_t * active_stream
Input stream currently being parsed.
Definition: ptttl_parser.h:176