]> git.donarmstrong.com Git - lilypond.git/blobdiff - mi2mu/main.cc
release: 0.1.54
[lilypond.git] / mi2mu / main.cc
index 8626213568eb953ffa413f83e9e99248d8e90a31..7f89342476ce3df368a0bd6d18b204335bd45f60 100644 (file)
@@ -15,7 +15,7 @@
 #include "midi-score-parser.hh"
 #include "mudela-item.hh"
 #include "mudela-score.hh"
-#include "version.hh"
+//#include "version.hh"
 
 // ugh
 String filename_str_g;
@@ -23,20 +23,19 @@ String filename_str_g;
 // ugh
 Mudela_score* mudela_score_l_g = 0;
 
+bool no_timestamps_b_g = false;
+
 Sources source;
 
 static File_path path;
 
 Verbose level_ver = NORMAL_ver;
 
-/// just to make sure print_rat is linked in
-static void (*rat_printer)(Moment const&);
-
 void
 usage()
 {
   LOGOUT(NORMAL_ver) <<
-       "Usage: mi2mu [options] midi-file\n"
+       _("Usage: mi2mu [options] midi-file\n"
   "Translate midi-file to mudela\n"
   "\n"
   "Options:\n"
@@ -49,10 +48,11 @@ usage()
   "  -o, --output=FILE      set FILE as default output\n"
   "  -p, --no-plets         assume no plets\n"
   "  -q, --quiet            be quiet\n"
+  "  -T, --no-timestamps    don't timestamp the output\n"
   "  -s, --smallest=N       assume no shorter (reciprocal) durations than N\n"
   "  -v, --verbose          be verbose\n"
   "  -w, --warranty         show warranty and copyright\n"
-  "  -x, --no-double-dots   assume no double dotted notes\n"
+  "  -x, --no-double-dots   assume no double dotted notes\n")
   ;
 }
 
@@ -61,12 +61,12 @@ identify()
 {
   LOGOUT(NORMAL_ver) << mi2mu_version_str() << endl;
 }
-  
-void 
+
+void
 notice()
 {
   LOGOUT(NORMAL_ver) <<
-  "\n"
+  _("\n"
   "Mi2mu, translate midi to mudela.\n"
   "Copyright (C) 1997 by\n"
   "  Jan Nieuwenhuizen <jan@digicash.com>\n"
@@ -84,16 +84,15 @@ notice()
   "    You should have received a copy (refer to the file COPYING) of the\n"
   "GNU General Public License along with this program; if not, write to\n"
   "the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139,\n"
-  "USA.\n";
+  "USA.\n");
 }
 
 int
 main (int argc_i, char* argv_sz_a[])
 {
   Mudela_key key (0, 0);
-  rat_printer = print_rat;     
 
-  Long_option_init long_option_init_a[] = 
+  Long_option_init long_option_init_a[] =
     {
        {0, "no-quantify", 'b'},
        {0, "debug", 'd'},
@@ -104,6 +103,7 @@ main (int argc_i, char* argv_sz_a[])
        {0, "no-plets", 'p'},
        {0, "quiet", 'q'},
        {1, "smallest", 's'},
+       {0, "no-timestamps", 'T'},
        {0, "verbose", 'v'},
        {0, "warranty", 'w'},
        {0, "no-double-dots", 'x'},
@@ -113,7 +113,7 @@ main (int argc_i, char* argv_sz_a[])
 
   String output_str;
   while (Long_option_init const* long_option_init_p = getopt_long())
-       switch (long_option_init_p->shortname) 
+       switch (long_option_init_p->shortname)
          {
        case 'b':
            Duration_convert::no_quantify_b_s = true;
@@ -130,12 +130,12 @@ main (int argc_i, char* argv_sz_a[])
 //         path->push (getopt_long.optional_argument_ch_C_);
 //         break;
        case 'k':
-         { 
+         {
            String str = getopt_long.optional_argument_ch_C_;
            int i = str.index_i (':');
            i = (i >=0 ? i : str.length_i ());
            key.accidentals_i_ = String_convert::dec2_i (str.left_str (i));
-           key.minor_i_ = (int)(bool)String_convert::dec2_i (str.mid_str (i,1));
+           key.minor_i_ = (int)(bool)String_convert::dec2_i (str.cut (i + 1,1));
            break;
          }
        case 'n':
@@ -152,16 +152,19 @@ main (int argc_i, char* argv_sz_a[])
        case 'q':
            level_ver = QUIET_ver;
            break;
-       case 's': 
+       case 'T':
+           no_timestamps_b_g = true;
+           break;
+       case 's':
          {
                int i = String_convert::dec2_i (getopt_long.optional_argument_ch_C_);
-               if (!i) 
+               if (!i)
                  {
                    identify();
                    usage();
                    exit (2); //usage
                  }
-               Duration_convert::no_smaller_than_i_s = 
+               Duration_convert::no_smaller_than_i_s =
                  Duration_convert::i2_type(i);
              }
            break;
@@ -180,7 +183,7 @@ main (int argc_i, char* argv_sz_a[])
            assert (0);
            break;
            }
-  
+
   // flag -q must be checked first
   identify();
 
@@ -189,7 +192,7 @@ main (int argc_i, char* argv_sz_a[])
   source.set_path (&path);
 
   char const* arg_sz = 0;
-  while ( (arg_sz = getopt_long.get_next_arg ())) 
+  while ( (arg_sz = getopt_long.get_next_arg ()))
     {
        filename_str_g = arg_sz;
        Midi_score_parser midi_parser;
@@ -198,12 +201,12 @@ main (int argc_i, char* argv_sz_a[])
        if (!score_p)
          return 1;
 
-       if (!score_p->mudela_key_l_)
-         score_p->mudela_key_l_ = &key;
+       // if given on command line: override
+       score_p->mudela_key_l_ = &key;
        mudela_score_l_g = score_p;
        score_p->process();
 
-       if (!output_str.length_i ()) 
+       if (!output_str.length_i ())
          {
            String d, dir, base, ext;
            split_path (arg_sz, d, dir, base, ext);