2 // main.cc -- implement silly main() entry point
3 // should have Root class.
5 // copyright 1997 Jan Nieuwenhuizen <jan@digicash.com>
10 Sources
* source_l_g
= &source
;
12 Verbose level_ver
= NORMAL_ver
;
14 // ugh, another global
16 find_file( String str
)
25 "Usage: mi2mu [options] midi-file\n"
26 "Translate midi-file to mudela\n"
29 " -b, --no-quantify write exact durations, e.g.: a4*385/384\n"
30 " -d, --debug print lots of debugging stuff\n"
31 " -h, --help this help\n"
32 " -I, --include=DIR add DIR to search path\n"
33 " -n, --no-silly assume no plets or double dots, smallest is 16\n"
34 " -o, --output=FILE set FILE as default output\n"
35 " -p, --no-plets assume no plets\n"
36 " -q, --quiet be quiet\n"
37 " -s, --smallest=N assume no shorter (reciprocal) durations than N\n"
38 " -v, --verbose be verbose\n"
39 " -w, --warranty show warranty and copyright\n"
40 " -x, --no-double-dots assume no double dotted notes\n"
47 tor( NORMAL_ver
) << mi2mu_version_str() << endl
;
55 "Mi2mu, translate midi to mudela.\n"
56 "Copyright (C) 1997 by\n"
57 " Han-Wen Nienhuys <hanwen@stack.nl>\n"
59 " Jan Nieuwenhuizen <jan@digicash.com>\n"
61 " This program is free software; you can redistribute it and/or\n"
62 "modify it under the terms of the GNU General Public License version 2\n"
63 "as published by the Free Software Foundation.\n"
65 " This program is distributed in the hope that it will be useful,\n"
66 "but WITHOUT ANY WARRANTY; without even the implied warranty of\n"
67 "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n"
68 "General Public License for more details.\n"
70 " You should have received a copy (refer to the file COPYING) of the\n"
71 "GNU General Public License along with this program; if not, write to\n"
72 "the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139,\n"
77 main( int argc_i
, char* argv_sz_a
[] )
79 Long_option_init long_option_init_a
[] = {
90 0, "no-double-dots", 'x',
93 Getopt_long
getopt_long( argc_i
, argv_sz_a
, long_option_init_a
);
97 while ( Long_option_init
* long_option_init_p
= getopt_long() )
98 switch ( long_option_init_p
->shortname
) {
100 Duration_convert::no_quantify_b_s
= true;
103 level_ver
= DEBUG_ver
;
110 // path->push( getopt_long.optarg );
113 Duration_convert::no_double_dots_b_s
= true;
114 Duration_convert::no_triplets_b_s
= true;
115 Duration_convert::no_smaller_than_i_s
= 16;
118 output_str
= getopt_long
.optarg
;
121 Duration_convert::no_triplets_b_s
= true;
124 level_ver
= QUIET_ver
;
127 int i
= String_convert::dec2_i( getopt_long
.optarg
);
132 Duration_convert::no_smaller_than_i_s
= i
;
136 level_ver
= VERBOSE_ver
;
143 Duration_convert::no_double_dots_b_s
= false;
151 while ( ( arg_sz
= getopt_long
.get_next_arg() ) ) {
152 My_midi_parser
midi_parser( arg_sz
, & source
);
153 midi_parser_l_g
= &midi_parser
;
155 int error_i
= midi_parser
.parse();
158 if ( !output_str
.length_i() ) {
159 String d
, dir
, base
, ext
;
161 split_path(arg_sz
, d
, dir
, base
, ext
);
163 output_str
= base
+ ext
+ ".ly";
165 error_i
= midi_parser
.output_mudela( output_str
);