From: fred Date: Sun, 24 Mar 2002 19:43:45 +0000 (+0000) Subject: lilypond-0.0.65 X-Git-Tag: release/1.5.59~4705 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=a2bdb067d4a2809f6576fa5defa9a0d654144b12;p=lilypond.git lilypond-0.0.65 --- diff --git a/flower/include/interval.hh b/flower/include/interval.hh index ec39f0d7e2..bf4e4cc0e7 100644 --- a/flower/include/interval.hh +++ b/flower/include/interval.hh @@ -75,7 +75,7 @@ struct Interval_t { Interval_t &operator *=(T r) { left *= r; right *= r; - if (r <0) { + if (r < T(0)) { T t = left; left = right; right = t; diff --git a/flower/include/interval.tcc b/flower/include/interval.tcc index 49be704608..ab2eb95ec3 100644 --- a/flower/include/interval.tcc +++ b/flower/include/interval.tcc @@ -98,7 +98,7 @@ Interval_t::str() const return "[empty]"; String s("["); - return s + left + "," + right +"]"; + return s + String( left ) + String( "," ) + String( right ) + String( "]" ); } template diff --git a/flower/interval.cc b/flower/interval.cc index 1db78d8dbf..12152d6227 100644 --- a/flower/interval.cc +++ b/flower/interval.cc @@ -15,5 +15,5 @@ Interval__instantiate(Real); Real Interval_t::infinity() { - return HUGE; + return HUGE_VAL; } diff --git a/lib/duration-convert.cc b/lib/duration-convert.cc index 1b738507af..4a46bf9e64 100644 --- a/lib/duration-convert.cc +++ b/lib/duration-convert.cc @@ -121,18 +121,23 @@ Duration_convert::mom2standardised_dur( Moment mom ) for ( int i = 0; i < dur_array_s.size() - 1; i++ ) { Moment lower_mom = dur2_mom( dur_array_s[ i ] ); if ( mom <= lower_mom ) { - // all arbitrary, but 1/4 will get rid of the noise... -// if ( i || ( mom / lower_mom > Moment( 3, 4 ) ) ) -//kinda ok if ( i || ( mom / lower_mom > Moment( 2, 4 ) ) ) - if ( i || ( mom / lower_mom > Moment( 2, 6 ) ) ) + // all arbitrary, but 3/4 will get rid of the noise... + // kinda ok + if ( i || ( mom / lower_mom > Moment( 3, 4 ) ) ) return dur_array_s[ i ]; else return Duration( 0 ); } Moment upper_mom = dur2_mom( dur_array_s[ i + 1 ] ); +#if 0 // % deviation of upper/lower from mom, perhaps it's better to use if ( ( mom < upper_mom ) && ( ( mom - lower_mom ) / mom < ( upper_mom - mom ) / mom ) ) +#else // % deviation of mom from lower/upper? + if ( ( mom < upper_mom ) + && ( ( mom - lower_mom ) / lower_mom + < ( upper_mom - mom ) / upper_mom ) ) +#endif return dur_array_s[ i ]; } // return dur_array_s[ dur_array_s.length_i() ]; diff --git a/mi2mu/.version b/mi2mu/.version index 4e05deeab5..0bd28567f0 100644 --- a/mi2mu/.version +++ b/mi2mu/.version @@ -1,6 +1,6 @@ MAJOR_VERSION = 0 MINOR_VERSION = 0 -PATCH_LEVEL = 16 +PATCH_LEVEL = 17 # use to send patches, always empty for released version: MY_PATCH_LEVEL = # diff --git a/mi2mu/Makefile b/mi2mu/Makefile index 1afa1ac1f8..abb87bb775 100644 --- a/mi2mu/Makefile +++ b/mi2mu/Makefile @@ -40,8 +40,7 @@ VERSION_DEPENDENCY = $(mi2mu-version) # list of distribution files: # -DISTFILES = Makefile .version $(ALL_SOURCES) - +EXTRA_DISTFILES = .version TODO # # list of custom libraries: diff --git a/mi2mu/TODO b/mi2mu/TODO new file mode 100644 index 0000000000..5fb343a0ca --- /dev/null +++ b/mi2mu/TODO @@ -0,0 +1,160 @@ +# mi2mu/TODO + +Most of the items are marked in the code as well, with full explanation. +grep for TODO and ugh/ugr + + +IMPORTANT + + * important? lily is important, go work on lily! + + * faq about mi2mu midi t1. ? + +PROJECTS + + * write something interesting in mi2mu manual page + + * check/use type 0 / 1 / 2 of midi file + + * create Indentable_stream (see Tex_stream) as base for Lily_stream + + * use dynamic info + + * use aftertouch info (to guess slurs/ties, scripts (staccato?)) + + * lyric events + + * parse all midi events + + * handle time based midi files + + * use dstream feature from lily + + * midi esp.: use I32 iso int where 32 bits are needed (or assumed...) + + * read unsigned words as U16 (not as I16) + + * check use of integral and unsigned in lexer + + * get rid of ugly statics in Duration_convert + + * change option double-dots to max-dots + + * set Key, Meter, ... command line options + +BUGS + + * mi2mu nonexist.midi ? + + * output of 0 duration c'0 + + * no output on certain midis + + * silly progress indicator upon mudela output + + * check for illegal track names, e.g. "Piano________ = \melodic" + + * array memleaks(?): use Link_array / create Pointer_array? + + * fix "#undef MEVENT_LIST" source tree: Array + + * split notes that cross bar limit + +FUTURE + + * guess plets (i.e.: only use plet-duration *2/3 if there's a + whole plet) + + * merge midi-events with lily's midi-items? + + * guess beams + + * guess / follow tempo changes + + * check out NIFF / analogies? + + * steal good ideas of other gpl midi parsers + + * lily: add mudela info into midi as specials + mi2mu: use special info + +# mi2mu/TODO + +Most of the items are marked in the code as well, with full explanation. +grep for TODO and ugh/ugr + + +IMPORTANT + + * important? lily is important, go work on lily! + + * faq about mi2mu midi t1. ? + +PROJECTS + + * write something interesting in mi2mu manual page + + * check/use type 0 / 1 / 2 of midi file + + * create Indentable_stream (see Tex_stream) as base for Lily_stream + + * use dynamic info + + * use aftertouch info (to guess slurs/ties, scripts (staccato?)) + + * lyric events + + * parse all midi events + + * handle time based midi files + + * use dstream feature from lily + + * midi esp.: use I32 iso int where 32 bits are needed (or assumed...) + + * read unsigned words as U16 (not as I16) + + * check use of integral and unsigned in lexer + + * get rid of ugly statics in Duration_convert + + * change option double-dots to max-dots + + * set Key, Meter, ... command line options + +BUGS + + * mi2mu nonexist.midi ? + + * output of 0 duration c'0 + + * no output on certain midis + + * silly progress indicator upon mudela output + + * check for illegal track names, e.g. "Piano________ = \melodic" + + * array memleaks(?): use Link_array / create Pointer_array? + + * fix "#undef MEVENT_LIST" source tree: Array + + * split notes that cross bar limit + +FUTURE + + * guess plets (i.e.: only use plet-duration *2/3 if there's a + whole plet) + + * merge midi-events with lily's midi-items? + + * guess beams + + * guess / follow tempo changes + + * check out NIFF / analogies? + + * steal good ideas of other gpl midi parsers + + * lily: add mudela info into midi as specials + mi2mu: use special info + diff --git a/mi2mu/midi-event.cc b/mi2mu/midi-event.cc index 028730acac..e98149d597 100644 --- a/mi2mu/midi-event.cc +++ b/mi2mu/midi-event.cc @@ -39,8 +39,6 @@ Midi_key::mudela_str( bool command_mode_bo ) str += String( (char)( ( key_i_ + 2 ) % 7 + 'A' ) ); else // heu, -2: should be - 1 1/2: A -> fis str += String( (char)( ( key_i_ + 2 - 2 ) % 7 + 'a' ) ); -// if ( !command_mode_bo ) -// str = String( '\\' ) + str; str = String( "%" ) + str + "\n"; // "\key\F" not supported yet... return str; } @@ -84,7 +82,7 @@ Midi_key::notename_str( int pitch_i ) this switch can be used to write simple plets like c4*2/3 as - \plet{ 2/3 } c4 \plet{ 1/1 } + \plet 2/3; c4 \plet 1/1; */ bool const Midi_note::simple_plet_b_s = true; @@ -99,17 +97,20 @@ String Midi_note::mudela_str( bool command_mode_bo ) { // assert( !command_mode_bo ); + if ( !dur_.type_i_ ) + return ""; + if ( simple_plet_b_s ) return name_str_ + Duration_convert::dur2_str( dur_ ); //ugh String str; if ( dur_.plet_b() ) - str += String( "\\plet{ " ) + str += String( "\\plet " ) + String_convert::i2dec_str( dur_.plet_.iso_i_, 0, 0 ) + "/" + String_convert::i2dec_str( dur_.plet_.type_i_, 0, 0 ) - + " } "; + + "; "; str += name_str_; @@ -118,7 +119,7 @@ Midi_note::mudela_str( bool command_mode_bo ) str += Duration_convert::dur2_str( dur ); if ( dur_.plet_b() ) - str += String( " \\plet{ 1/1 }" ); + str += String( " \\plet 1/1;" ); return str; } @@ -213,11 +214,9 @@ Midi_time::num_i() String Midi_time::mudela_str( bool command_mode_bo ) { - String str = "\\meter{ " + String str = "\\meter " + String( num_i_ ) + "/" + String( 1 << den_i_ ) - + " }"; -// if ( !command_mode_bo ) -// str = String( '\\' ) + str; + + ";"; return str; } diff --git a/mi2mu/midi-lexer.l b/mi2mu/midi-lexer.l index 1bc41ded0a..a1cb3262a6 100644 --- a/mi2mu/midi-lexer.l +++ b/mi2mu/midi-lexer.l @@ -1,6 +1,15 @@ %{//-*-Fundamental-*- // midi-lexer.l +/* + yes, i know that midi is not really a (n evolving?) language, + and that using lex/yacc to parse midi is overkill, as well as + a grand example of misuse and asking for performance loss. + + it is, however, quite robust, simple, and very easy to extend + incrementally. + */ + /* backup rules diff --git a/mi2mu/midi-score.cc b/mi2mu/midi-score.cc index 28cb7dae55..1803cafc4c 100644 --- a/mi2mu/midi-score.cc +++ b/mi2mu/midi-score.cc @@ -43,6 +43,9 @@ Midi_score::output_mudela( String filename_str ) lily_stream << "\\score{"; lily_stream.indent(); for ( PCursor i( midi_track_p_list_.top() ); i.ok(); i++ ) { + if ( ( midi_track_p_list_.size() != 1 ) + && ( i == midi_track_p_list_.top() ) ) + continue; lily_stream << "\\staff{ melodicregs "; lily_stream << i->name_str(); lily_stream << " }"; diff --git a/mi2mu/template.cc b/mi2mu/template.cc index 24edd32cc4..e7f367a8a1 100644 --- a/mi2mu/template.cc +++ b/mi2mu/template.cc @@ -20,6 +20,6 @@ class ostream; //IPL_instantiate(Midi_event); IPL_instantiate(Midi_track); // PL_instantiate(Midi_voice); -// IPL_instantiate(Midi_voice); +IPL_instantiate(Midi_voice); //IPL_instantiate(Track_column);