The Simple API

Only 3 functions are provided in the library.
The user will receive an event with some parameters by MML_CALLBACK function that you provided.
This is really simple way to parse MML text you've ever seen.

Initialize

MML_RESULT mml_init(MML *handle, MML_CALLBACK callback, void *extobj);

Setup

MML_RESULT mml_setup(MML *handle, MML_OPTION *option, char *text);

Fetch

MML_RESULT mml_fetch(MML *handle);

The Simple Callback Function

The definition of the callback function shown in below.

Prototype

typedef void (*MML_CALLBACK)(MML_INFO *p, void *extobj);

Arguments

typedef struct {
  MML_TYPE type;
  union {
    MML_ARGS_NOTE note;
    MML_ARGS_REST rest;
    MML_ARGS_TEMPO tempo;
    MML_ARGS_LENGTH length;
    MML_ARGS_VOLUME volume;
    MML_ARGS_OCTAVE octave;
    MML_ARGS_OCTAVE octave_up;
    MML_ARGS_OCTAVE octave_down;
  } args;
} MML_INFO;

State Diagram