]> git.donarmstrong.com Git - lilypond.git/commitdiff
lilypond-0.0.62
authorfred <fred>
Sun, 24 Mar 2002 19:42:57 +0000 (19:42 +0000)
committerfred <fred>
Sun, 24 Mar 2002 19:42:57 +0000 (19:42 +0000)
NEWS
README
mi2mu/include/midi-track.hh
mi2mu/include/midi-voice.hh
mi2mu/include/track-column.hh
mi2mu/main.cc
mi2mu/midi-track.cc
mi2mu/version.cc

diff --git a/NEWS b/NEWS
index f21cc70d039aa5fc557bdfcf255907c0c75f8b46..aafcdc5d14a7257891f2737e6a2dc32990842385 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -1,5 +1,22 @@
+pl 61.jnc1
+       - smarter + faster duration-convert using Array
+       - bf: mi2mu compilation/duration-conversions
+       - lots faster mi2mu, hopefully does type 1 too...
+pl 60.jnc1
+       - mi2mu handles non-quantified rests, try mi2mu -b wtk-i/fugue2.midi
+
+
+pl 62
+       - make clean bf: remove lex & yacc files too 
+       - added kludge in case measure too long 
+       - added kludge in case of unconnected columns.
+       - kludged columns get error marker
+       - kludged lines get error marker
+       
+**********
+may 14 
 pl 61
-       - scales.ly bugfix: dimensions default to ((0,0),(0,0))
+       - scales.ly bugfix: dimensions default to ((0,0), (0,0))
        - naming: PointerList->Pointer_list
        - tied notes don't get accidental
        - bf: crescendo size
@@ -11,14 +28,19 @@ pl 60.mb
        - set_flower_debug: Warning if -d is used when NPRINT is defined.
        - Fixed several TeX details. vcenter renamed since it interfered
          with LaTeX. Position of accents changed.
-       - New example; scriptS.ly
+       - New example; scripts.ly
        - table_sixteen: added scriptdefinition (Lilypond breaks if a
          script is defined without dimensions).
        - bf: ifndef typos in p-score.cc, choleski.cc
        - bf: Slur::do_post_processing(), whole notes caused SIGSEGV.
 
-
+(ascension break :-)
 *******
+pl 57.jcn4
+       - mi2mu handles rests (quantified only)
+       - fixed configure buglet
+        - "!date" Fri May  2 02:18:12 MET DST 1997
+
 pl 60
        - Request_register::get_feature(), tie direction, Slur direction
        - lilypond output is now directly texable. 
diff --git a/README b/README
index 416108902bb94b8645b179d1ce660c673019fd87..1dc3546a4c51376dc2fa6e4720f92704d3f0f3aa 100644 (file)
--- a/README
+++ b/README
@@ -27,9 +27,17 @@ NOTE:
 
 LilyPond is a long way from finished and polished. I do appreciate
 criticism, comments, bugreports, patches, etc. Please send e-mail to
-me,
+the mailing lists 
 
-       hanwen@stack.nl
 
+       info-gnu-music-request@vuse.vanderbilt.edu
+       help-gnu-music-request@vuse.vanderbilt.edu
+       bug-gnu-music-request@vuse.vanderbilt.edu
+       gnu-music-discuss-request@vuse.vanderbilt.edu,
+
+(or directly to us: hanwen@stack.nl, jan@digicash.com)
+
+       
+       
 Have fun!
 
index 5173c93532dda1e2f276edb738cb3ab845647b16..5e3394da3501b100dd35d90e777e140c569a8778 100644 (file)
@@ -28,21 +28,20 @@ public:
        String name_str_;
        Midi_tempo* midi_tempo_p_;
        Midi_time* midi_time_p_;
+       int number_i_;
 
 private:
-       void add_begin_at( PointerList<Midi_voice*>& open_voices_r, Moment mom );
+       void add_begin_at( Pointer_list<Midi_voice*>& open_voices_r, Moment mom );
        int check_begin_bar_i( Moment now_mom, int open_bar_i );
        int check_end_bar_i( Moment now_mom, int open_bar_i );
        Midi_voice* get_free_midi_voice_l( Moment mom );
-       void remove_end_at( PointerList<Midi_voice*>& open_voices_r, Moment mom );
+       void remove_end_at( Pointer_list<Midi_voice*>& open_voices_r, Moment mom );
        void output_mudela_begin_bar( Lily_stream& lily_stream_r, Moment now_mom, int bar_i );
        void output_mudela_rest( Lily_stream& lily_stream_r, Moment begin_mom, Moment end_mom );
        void output_mudela_rest_remain( Lily_stream& lily_stream_r, Moment mom );
 
-       IPointerList<Track_column*> tcol_p_list_;
-       IPointerList<Midi_voice*> midi_voice_p_list_;
-       int number_i_;
-
+       IPointer_list<Track_column*> tcol_p_list_;
+       IPointer_list<Midi_voice*> midi_voice_p_list_;
 };
 
 #endif // MIDI_TRACK_HH
index cf3df8417183520e337fe0fed5017b28c1affb31..6cadebfccb0a0ed173bcd0f2700e8d82e0af95a8 100644 (file)
@@ -3,10 +3,10 @@
 //
 // copyright 1997 Jan Nieuwenhuizen <jan@digicash.com>
 
-/// (midi_voice)
 #ifndef MIDI_VOICE_HH
 #define MIDI_VOICE_HH
 
+/// (midi_voice)
 class Midi_voice {
 public:
        Midi_voice( Moment begin_mom );
@@ -15,11 +15,14 @@ public:
        Moment begin_mom();
        Moment end_mom();
 
-       String mudela_str( Moment from_mom, Moment to_mom, bool multiple_bo );
+       String mudela_str( Moment to_mom, Moment to_mom, bool multiple_bo );
+    // ARE you sure?              ^^             ^^  
 
 private:
-       Moment begin_mom_;
-       IPointerList<Midi_event*> midi_event_p_list_;
+    int events_i_;
+       Moment end_mom_;
+       Moment begin_mom_;
+       IPointer_list<Midi_event*> midi_event_p_list_;
 };
 
 #endif // MIDI_VOICE_HH
index 0ed0323a97682e7302ee59bd1d867eef55a47882..c1126437e668dfa37b28c3b774f3fe0a721d8215 100644 (file)
@@ -15,7 +15,7 @@ public:
        Moment mom();
 
 //private:
-       IPointerList<Midi_event*> midi_event_p_list_;
+       IPointer_list<Midi_event*> midi_event_p_list_;
        Moment mom_;
 };
 
index 33fab2906f8dc01fc85b55e15e5b275ee07a8c7d..06589c789152107a0cb72d93731ca767fcab8b40 100644 (file)
@@ -30,7 +30,7 @@ usage()
        "  -d, --debug            print lots of debugging stuff\n"
        "  -h, --help             this help\n"
         "  -I, --include=DIR      add DIR to search path\n"
-        "  -n, --no-silly         assume no plets or double dots, smallest is 16\n"
+        "  -n, --no-silly         assume no plets or double dots, smallest is 32\n"
        "  -o, --output=FILE      set FILE as default output\n"
        "  -p, --no-plets         assume no plets\n"
        "  -q, --quiet            be quiet\n"
@@ -54,9 +54,8 @@ notice()
        "\n"
        "Mi2mu, translate midi to mudela.\n"
        "Copyright (C) 1997 by\n"
-       "  Han-Wen Nienhuys <hanwen@stack.nl>\n"
-//     "Contributors\n"
        "  Jan Nieuwenhuizen <jan@digicash.com>\n"
+       "  Han-Wen Nienhuys <hanwen@stack.nl>\n"
        "\n"
        "    This program is free software; you can redistribute it and/or\n"
        "modify it under the terms of the GNU General Public License version 2\n"
@@ -112,7 +111,7 @@ main( int argc_i, char* argv_sz_a[] )
                case 'n':
                        Duration_convert::no_double_dots_b_s = true;
                        Duration_convert::no_triplets_b_s = true;
-                       Duration_convert::no_smaller_than_i_s = 16;
+                       Duration_convert::no_smaller_than_i_s = 32;
                        break;
                case 'o':
                        output_str = getopt_long.optarg;
index 436bec8aa3d2bfcae85ab77dabdd44b0123329ed..07f57c0a6722ea34bc183c49a909eb03c6e72726 100644 (file)
@@ -10,10 +10,7 @@ Midi_track::Midi_track( int number_i, String copyright_str, String track_name_st
        number_i_ = number_i;
        copyright_str_ = copyright_str;
        instrument_str_ = instrument_str;
-       if ( track_name_str.length_i() )
-               name_str_ = track_name_str;
-       else
-               name_str_ = String( "track" ) + String( number_i_ );
+       name_str_ = track_name_str;
        midi_time_p_ = new Midi_time( 4, 2, 24, 8 );
        midi_tempo_p_ = new Midi_tempo( 1000000 );
        tcol_p_list_.bottom().add( new Track_column( Moment( 0 ) ) );
@@ -26,7 +23,7 @@ Midi_track::~Midi_track()
 }
 
 void
-Midi_track::add_begin_at( PointerList<Midi_voice*>& open_voices_r, Moment mom )
+Midi_track::add_begin_at( Pointer_list<Midi_voice*>& open_voices_r, Moment mom )
 {
        for ( PCursor<Midi_voice*> i( midi_voice_p_list_.top() ); i.ok(); i++ )
                if ( i->begin_mom() == mom ) {
@@ -90,11 +87,12 @@ Midi_track::get_free_midi_voice_l( Moment mom )
        return midi_voice_l; 
 }
 
-// too much red tape?
 String
 Midi_track::name_str()
 {
-       return name_str_;
+       if ( name_str_.length_i() )
+               return name_str_;
+       return String( "track" ) + String( number_i_ );
 }
 
 Moment
@@ -122,6 +120,9 @@ Midi_track::next_end_mom( Moment now_mom )
 void
 Midi_track::process()
 {
+       /* 
+          columns to voices
+       */
        int bar_i = 1;
        for ( PCursor<Track_column*> i( tcol_p_list_.top() ); i.ok(); i++ ) {
                int begin_bar_i = check_begin_bar_i( i->mom(), bar_i );
@@ -143,7 +144,7 @@ Midi_track::process()
 void
 Midi_track::output_mudela( Lily_stream& lily_stream_r )
 {
-       lily_stream_r << name_str_ << " = \\melodic{";
+       lily_stream_r << name_str() << " = \\melodic{";
        lily_stream_r.indent();
        lily_stream_r << "% midi copyright:" << copyright_str_;
        lily_stream_r.newline();
@@ -152,9 +153,28 @@ Midi_track::output_mudela( Lily_stream& lily_stream_r )
 
        int bar_i = 0;
 
-       PointerList<Midi_voice*> open_voices;
+       Pointer_list<Midi_voice*> open_voices;
        Moment now_mom = 0.0;
-       /// ugh, avoid status track 0...
+       Real now_f = now_mom;
+       Real begin_f = 0;
+       Real end_f = end_mom();
+       Real then_f;
+
+       /* 
+          now we step through time while writing all voices
+
+          we can only output time slices that have a constant
+          number of open voices; each begin or end of a voice
+          starts or ends a chord or multivoice
+
+          [todo]
+          voice defragmentation/concatenation could make this
+          lost blonder
+       */
+
+       bool start_of_track_bo = true;
+
+       /// ugh, avoid status track 0 full of rests...
        while ( number_i_ && ( now_mom < end_mom() ) ) {
                int begin_bar_i = check_begin_bar_i( now_mom, bar_i );
                if ( begin_bar_i )
@@ -176,19 +196,33 @@ Midi_track::output_mudela( Lily_stream& lily_stream_r )
                tor( DEBUG_ver ) << "begin: " << begin_mom << " end: " << end_mom << endl;
                tor( DEBUG_ver ) << "slice: " << now_mom << ", " << then_mom << endl;
 
-// rests, ugh
-               String str;
-//             if ( !open_voices.size() )
-//                     output_mudela_rest( lily_stream_r, now_mom, then_mom );
+               now_f = now_mom;
+               begin_f = begin_mom;
+               end_f = end_mom;
+               then_f = then_mom;
+               
+// ugh, rests
+// checking for no open voice does not work for initial rests.
+// for some reason the voice is open, but does not procuce notes?
                if ( open_voices.size() > 1 )
                        lily_stream_r << "< ";
-               for ( PCursor<Midi_voice*> i( open_voices.top() ); i.ok(); i++ )
-//                     lily_stream_r << i->mudela_str( now_mom, then_mom, open_voices.size() - 1 );
-                       str += i->mudela_str( now_mom, then_mom, open_voices.size() - 1 );
-               if ( str.length_i() )
-                       lily_stream_r << str;
-               else
-                       output_mudela_rest( lily_stream_r, now_mom, then_mom );
+               if ( start_of_track_bo ) {
+                       start_of_track_bo = false;
+                       String str;
+                       for ( PCursor<Midi_voice*> i( open_voices.top() ); i.ok(); i++ )
+                               lily_stream_r << i->mudela_str( now_mom, then_mom, open_voices.size() - 1 );
+                       if ( str.length_i() )
+                               lily_stream_r << str;
+                       else
+                               output_mudela_rest( lily_stream_r, now_mom, then_mom );
+               }
+               else {
+                       for ( PCursor<Midi_voice*> i( open_voices.top() ); i.ok(); i++ )
+                               lily_stream_r << i->mudela_str( now_mom, then_mom, open_voices.size() - 1 );
+                       if ( !open_voices.size() )
+                               output_mudela_rest( lily_stream_r, now_mom, then_mom );
+               }
+//             *lily_stream_r.os_p_ << flush;
                        
                if ( open_voices.size() > 1 )
                        lily_stream_r << "> ";
@@ -202,7 +236,7 @@ Midi_track::output_mudela( Lily_stream& lily_stream_r )
        tor( NORMAL_ver ) << '[' << bar_i << ']' << flush; 
 
        lily_stream_r.tnedni();
-       lily_stream_r << "} % " << name_str_;
+       lily_stream_r << "} % " << name_str();
        lily_stream_r.newline();
 }
 
@@ -229,58 +263,80 @@ Midi_track::output_mudela_rest( Lily_stream& lily_stream_r, Moment begin_mom, Mo
 {
        Moment bar_mom = midi_time_p_->bar_mom();
        Moment now_mom = begin_mom;
-       int begin_bar_i =(int)( now_mom / bar_mom ) + 1; 
-       Moment remain_mom = now_mom - Moment( begin_bar_i - 1 ) * bar_mom;
-        if ( remain_mom > Moment( 0 ) )
-               output_mudela_rest_remain( lily_stream_r, remain_mom );
 
+       int begin_bar_i = (int)( now_mom / bar_mom ) + 1; 
        int end_bar_i = (int)( end_mom / bar_mom ) + 1;
-       now_mom += remain_mom;
 
+       if ( end_bar_i == begin_bar_i ) {
+               output_mudela_rest_remain( lily_stream_r, end_mom - begin_mom );
+               return;
+       }
+
+       // multiple bars involved
        int bar_i = (int)( now_mom / bar_mom ) + 1;
-       bar_i = check_end_bar_i( now_mom, bar_i );
-       for ( int i = 0; i < end_bar_i - begin_bar_i; i++ ) {
+
+       //fill current bar
+       Moment begin_bar_mom = Moment( begin_bar_i - 1 ) * bar_mom;
+       if ( now_mom > begin_bar_mom ) {
+               int next_bar_i = (int)( now_mom / bar_mom ) + 2; 
+               Moment next_bar_mom = Moment( next_bar_i - 1 ) * bar_mom;
+               assert( next_bar_mom <= end_mom );
+
+               Moment remain_mom = next_bar_mom - now_mom;
+               if ( remain_mom > Moment( 0 ) ) {
+                       output_mudela_rest_remain( lily_stream_r, remain_mom );
+                       now_mom += remain_mom;
+               }
+
+               bar_i = check_end_bar_i( now_mom, bar_i );
+       }
+
+       // fill whole bars
+       int count_i = end_bar_i - bar_i;
+       for ( int i = 0; i < count_i; i++ ) {
                int begin_bar_i = check_begin_bar_i( now_mom, bar_i );
                if ( begin_bar_i )
                        output_mudela_begin_bar( lily_stream_r, now_mom, begin_bar_i );
                lily_stream_r << "r1 ";
+//             *lily_stream_r.os_p_ << flush;
                tor( NORMAL_ver ) << begin_bar_i << flush; 
                bar_i = check_end_bar_i( now_mom, bar_i );
                now_mom += bar_mom;
        }
+
        // use "int i" here, and gcc 2.7.2 hits internal compiler error
        int ii = check_begin_bar_i( now_mom, bar_i );
        if ( ii )
                output_mudela_begin_bar( lily_stream_r, now_mom, ii );
-       bar_i = check_end_bar_i( now_mom, bar_i );
 
-       remain_mom = end_mom - Moment( end_bar_i - 1 ) * bar_mom;
-        if ( remain_mom > Moment( 0 ) )
+//     bar_i = check_end_bar_i( now_mom, bar_i );
+
+       Moment remain_mom = end_mom - Moment( end_bar_i - 1 ) * bar_mom;
+        if ( remain_mom > Moment( 0 ) ) {
                output_mudela_rest_remain( lily_stream_r, remain_mom );
+               now_mom += remain_mom;
+       }
+       assert( now_mom == end_mom );
 }
 
-
 void
 Midi_track::output_mudela_rest_remain( Lily_stream& lily_stream_r, Moment mom )
 {
-       int type_i = 2;
-       while ( mom > Moment( 0 ) ) {
-               Duration dur( type_i );
-               Moment type_mom = Duration_convert::dur2_mom( dur );
-               int count_i = (int)( mom / type_mom ); 
-               for( int i = 0; i < count_i; i++ )
-                       lily_stream_r << "r" << dur.str() << " ";
-               type_i *= 2;
-               mom -= Moment( count_i ) * type_mom;
-               if ( Duration_convert::no_smaller_than_i_s
-                       && ( type_i > Duration_convert::no_smaller_than_i_s ) ) 
-                       break;  
+       if ( Duration_convert::no_quantify_b_s ) {
+               Duration dur = Duration_convert::mom2_dur( mom );
+               lily_stream_r << "r" << dur.str() << " ";
+//             assert( mom == dur.mom() );
+               assert( mom == dur.length() );
+               return;
        }
-
+               
+       Duration dur = Duration_convert::mom2standardised_dur( mom );
+       if ( dur.type_i_ )
+               lily_stream_r << "r" << dur.str() << " ";
 }
 
 void
-Midi_track::remove_end_at( PointerList<Midi_voice*>& open_voices_r, Moment mom )
+Midi_track::remove_end_at( Pointer_list<Midi_voice*>& open_voices_r, Moment mom )
 {
        for ( PCursor<Midi_voice*> i( open_voices_r.top() ); i.ok(); i++ )
 //             if ( i->end_mom() == mom ) { }
index 3eb7e4d25c358830924e7df90e9cea3d4fc3c430..03b78e14eb1f87ad91ac3d5ab79b3143e44fe8a4 100644 (file)
@@ -6,7 +6,7 @@ const char * mi2mu_version_sz();
 String
 mi2mu_version_str()
 {
-       return String ( "This is " ) + mi2mu_version_sz()
+       return  String( mi2mu_version_sz())
            + "/" + flower_version_sz()
                + " of " +  __DATE__ + " " + __TIME__;
 }