MML Parser

About

MML Parser. MML is Music Macro Language.

This software is part of Mona OS Project.

Requirements

How to use

   1 #include "types.h"
   2 #include "Parser.h"
   3 #include "Config.h"
   4 #include <stdio.h>
   5 
   6 //  memo for memory leak check
   7 //  valgrind --leak-check=full -v --show-reachable=yes ./src/mmlparser 2> val.log
   8 
   9 using namespace MonAPI::audio::mml;
  10 
  11 int main(int argc, char *argv[])
  12 {
  13     const char* mml_multi = ""
  14         "[Channel1]"
  15         "T180V15L8<<FCDF4CFE4C-EA4EAED<A>CD4<A>DC4<G>CF4CC<BA+A+A+A+A+FGA+AAA>D4<A>D<AG+G+"
  16         ">CD+GFD+C4C4C4CDF4FFFFCDE4C-D<A4EA>C+D<AB>D4<ABB+4G>CF4CDF<A+A+A+A+A+A+A+A+AAA>D4"
  17         "<AA>D<GGAAA+A+BB>CC<AAA+A+>CCC+4C+C+4C+4C+C+4C+C+4C+4C+<E4EE4EE4>E2.&ED+4ED+4.ED+4.ED+ED+N22A+4"
  18         "[Channel2]"
  19         "T180V12L8<FF4FF4FE4DEE2&EFF4FF4FG4FGA4.AAG4FD4.AAG4FC4.AAG4FD+4D4E1&EFF4FF4FE4DE"
  20         "E2&EFF4FF4FG4FGA4.AAG4FL4D.AAG8FD.GGGL8GAF4FE4.C+D+F4FD+4C+1&C+C+D+E4ED+4<B2&BG+4G+B4A+4BA+4.BA+4.BA+BA+2"
  21         "[Channel3]"
  22         "T180V12L8<AA4AA4AG4FGA2&AAA4AA4AA+4AA+>C4.CC<A+4AF4.>CC<A+4AF4.>CC<A+4G+G4F4G1&GAA4AA4AG4FGA2&AAA4AA4AA+4A"
  23         "A+>C4.CCL4<A+A8F.>CD<A8GF.A+A+A+L8A+B+A4AG4.FGG+4G+G4F1&FFGG+4G+F+4E2&E<B4B>E4D+4ED+4.ED+4.ED+ED+2\n";
  24 
  25     Parser parser;
  26     Channels* channels = parser.parse(mml_multi);
  27 
  28     for (Channels::iterator it = channels->begin(); it != channels->end(); it++)
  29     {
  30         Channel* channel = *it;
  31         printf("[channel]\n");
  32         for (Channel::iterator eit = channel->begin(); eit != channel->end(); eit++)
  33         {
  34             Element* e = *eit;
  35             if (e->isRest())
  36             {
  37                 printf("[Rest]%dms", e->ms);
  38             }
  39             else
  40             {
  41                 printf("[%dhz]%dms", e->hz, e->ms);
  42             }
  43         }
  44         printf("\n");
  45     }
  46 
  47     parser.destroyChannels(channels);
  48     return 0;
  49 }
  50 

How to install

  1. Download http://sourceforge.net/project/showfiles.php?group_id=164970&package_id=212065

  2. make

Authors

Contact

If you have a good idea, then mail Higepon your suggestion; or better yet, join as a developer and contribute!

Higepon?action=AttachFile&do=get&target=mailaddress

MMLParser (last edited 2007-12-17 16:23:03 by Higepon)