]> git.donarmstrong.com Git - lilypond.git/commitdiff
lilypond-0.1.10
authorfred <fred>
Sun, 24 Mar 2002 19:55:26 +0000 (19:55 +0000)
committerfred <fred>
Sun, 24 Mar 2002 19:55:26 +0000 (19:55 +0000)
17 files changed:
bin/genheader.in
flower/include/string-convert.hh
flower/string-convert.cc
lib/binary-source-file.cc
lib/include/binary-source-file.hh
lib/include/source.hh
lib/source-file.cc
lib/source.cc
lily/include/command-request.hh
mi2mu/Makefile
mi2mu/TODO
mi2mu/VERSION
mi2mu/include/mi2mu-proto.hh
mi2mu/include/midi-score-parser.hh [new file with mode: 0644]
mi2mu/include/midi-track-parser.hh [new file with mode: 0644]
mi2mu/include/mudela-score.hh
mi2mu/mudela-staff.cc

index 9b6bb4d6cb8f4d6d4a403d58fa8bc22d7ab0ba9a..8643a3794fdaf8b264d683778f4ef0d89ca929a5 100644 (file)
@@ -6,7 +6,7 @@ my $fn;
 sub
     do_init
 {
-    $MAILADRESS=$ENV{MAILADRESS};
+    $MAILADDRESS=$ENV{MAILADDRESS};
      @pw=(getpwuid($<));
      $username=$pw[6];
 
@@ -34,7 +34,7 @@ sub
 
   source file of $PROJECT
 
-  (c) 1997 $username <$MAILADRESS>
+  (c) 1997 $username <$MAILADDRESS>
 */\n";
     print $headstr;
 }
index 63785ac28d6e94becef8ebb5c3ffa40c60f5b4ae..1d3f5d0300130f72326f1e9ee8037410c7e19d06 100644 (file)
@@ -21,7 +21,8 @@ public:
     static String bin2dec_str (String bin_str);
     static String bin2hex_str (String bin_str);
     static String dec2bin_str (String str);
-    static int bin2_i (String str);
+    static int bin2_i (String bin_str);
+    static unsigned bin2_u (String bin_str);
     static String char_str (char c, int n);
     static int dec2_i (String dec_str);
     static double dec2_f (String dec_str);
index c105169cee55d179e8963dd9dbb95febefb08741..5acdb4c88f55003a16702b66771773275df37b36 100644 (file)
@@ -40,15 +40,21 @@ String_convert::bin2hex_str (String bin_str)
 int
 String_convert::bin2_i (String bin_str)
 {
-  assert (bin_str.length_i() <= 4);
+  return bin2_u (bin_str);
+}
+
+unsigned
+String_convert::bin2_u (String bin_str)
+{
+  assert (bin_str.length_i() <= (int)sizeof(unsigned));
 
-  int result_i = 0;
+  unsigned result_u = 0;
   for ( int i = 0; i < bin_str.length_i(); i++) 
     {
-       result_i <<= 8;
-       result_i += (Byte)bin_str[ i ];
+       result_u <<= 8;
+       result_u += (Byte)bin_str[ i ];
     }
-  return result_i;
+  return result_u;
 }
 
 // breendet imp from String
index 666012f0c62c9a7a35a3dc30454891493de69dd0..8c4aac44741aeb2cf7716848fab5b1830ca4fcfb 100644 (file)
@@ -27,7 +27,7 @@ Binary_source_file::~Binary_source_file()
 }
 
 String
-Binary_source_file::error_str( char const* pos_ch_c_l )
+Binary_source_file::error_str( char const* pos_ch_c_l ) const
 {
     assert( this );
     if ( !in_b( pos_ch_c_l ) )
@@ -53,7 +53,7 @@ Binary_source_file::error_str( char const* pos_ch_c_l )
 }
 
 int
-Binary_source_file::line_i( char const* pos_ch_c_l )
+Binary_source_file::line_i( char const* pos_ch_c_l ) const
 {
     if ( !in_b( pos_ch_c_l ) )
        return 0;
index bc8279f6abe54044a5e4867fda833f9ff8adeed4..63127ea9ad03b8b43f8840346117fc8ca507cacb 100644 (file)
@@ -13,8 +13,8 @@ public:
        Binary_source_file( String& filename_str );
        virtual ~Binary_source_file();
 
-       virtual String error_str( char const* pos_ch_c_l );
-       virtual int line_i( char const* pos_ch_c_l );
+       virtual String error_str( char const* pos_ch_c_l ) const;
+       virtual int line_i( char const* pos_ch_c_l ) const;
 };
 
 #endif // BINARY_SOURCE_FILE_HH //
index 1d199671ffa1383977a14c42ae3dfc9b8ba3a427..fc0ca2728d196f89759f8abf826039489df54036 100644 (file)
 class Sources 
 {
 public:
+    Sources();
+
     Source_file * get_file_l( String &filename );
     Source_file* sourcefile_l( char const* ch_C );
     void set_path(File_path*p_C);
-    Sources();
     void set_binary(bool);
-    ~Sources();
+
 private:
     const File_path * path_C_;
     void add( Source_file* sourcefile_p );
index a67b46630016a03a21c33bcb564901d6a3e26ed2..4ac7017f051eb67ca1a774ba31e6fc1458b88e4b 100644 (file)
@@ -57,12 +57,14 @@ Source_file::name_str()const
 {
     return name_str_;
 }
+
 Source_file::~Source_file()
 {
     delete istream_p_;
     istream_p_ = 0;
     delete storage_p_;
 }
+
 String
 Source_file::error_str( char const* pos_ch_C )const
 {
index e60041553c84050e6237ce1e6ed35a5a714bdb2c..dd1c5f27d60f440088ef0ad26ce89d6c9692bd3a 100644 (file)
 #include "source.hh"
 #include "path.hh"
 
+Sources::Sources()
+{
+    path_C_= 0;
+    binary_b_ = false;
+}
+
+void
+Sources::set_binary(bool bo)
+{
+       binary_b_ = bo;
+}
+
 void
 Sources::set_path(File_path *f_C)
 {
@@ -47,12 +59,6 @@ Sources::get_file_l(String &file_str ) //UGH
     return f_p;
 }
 
-Sources::Sources()
-{
-    path_C_= 0;
-    binary_b_ = false;
-}
-
 void
 Sources::add( Source_file* sourcefile_p )
 {
@@ -74,5 +80,3 @@ Sources::sourcefile_l( char const* ch_C )
     return 0;
 }
 
-Sources::~Sources()
-{}
index 1a78f14d758b8a5917032eea588ab794b2b0b2c3..f5adca4428b9194c647087aa2caf2b61aed9d80f 100644 (file)
@@ -53,7 +53,6 @@ class Timing_req  : public Command_req  {
 public:
     REQUESTMETHODS(Timing_req, timing);
     virtual Tempo_req * tempo(){return 0; }
-    Tempo_req();
 };
 
 
index 7100902c8fa69f12397afbdafe4dac39fa774659..85bcfed18e8ceb8dc3b90122fb59c4f5bd381658 100644 (file)
@@ -75,7 +75,8 @@ DEPFILES = $(wildcard $(depdir)/*.dep)
 -include /dev/null $(DEPFILES)
 #
 localclean:
-       rm -f $(outdir)/{midi-parser,midi-lexer}.*
+# obsoliet
+#      rm -f $(outdir)/{midi-parser,midi-lexer}.*
 
 localinstall: installexe
 
index e9cb89c1431a2cd7624fd1826d8d29ae18312e08..e5221769554046fdbae1a4416b2f52a10f172a0a 100644 (file)
@@ -6,16 +6,6 @@ grep for TODO and ugh/ugr
 
 IMPORTANT
 
-       * fix parser: either 
-          - parse into midi-items (merge with lily/midi-*) and pass
-            these nealy up, same for track and score.  look at all
-            tracks a time (vertically through score), creating columns 
-            and mudela items in time-order (no searching for columns).
-         or
-          - junk lex/yacc altogether, parse on byte level, straight
-            from memore, vertically through score.  there might be no
-            need for midi-items, here.
-
        * get rid of (last few?) midi-specifics in mudela-*
 
        * find / remove trend (tempo) of mudela columns
@@ -64,16 +54,8 @@ PROJECTS
 
 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<Midi_event*> 
index 22b9eff149db9de3da073571260d946582181667..bbbdde49e2748096232ea62ec58d745a685bc3ff 100644 (file)
@@ -1,6 +1,6 @@
 MAJOR_VERSION = 0
 MINOR_VERSION = 0
-PATCH_LEVEL = 19
+PATCH_LEVEL = 20
 # use to send patches, always empty for released version:
 MY_PATCH_LEVEL = 
 #
index 5aa6579ae3a12f6b9ae374ef9581b21058882a72..da4d89ba548f96df297119f4f1f6a02641ca2978 100644 (file)
 #ifndef MI2MU_PROTO_HH
 #define MI2MU_PROTO_HH
 
-
+class Midi_parser;
+struct Midi_parser_info;
+class Midi_score_parser;
+class Midi_track_parser;
 class Mudela_stream;
 class Mudela_item;
 class Mudela_key;
@@ -21,8 +24,6 @@ class Mudela_text;
 class Mudela_score;
 class Mudela_staff;
 class Mudela_voice;
-class My_midi_lexer;
-class My_midi_parser;
 class Mudela_column;
 
 #endif // MI2MU_PROTO_HH
diff --git a/mi2mu/include/midi-score-parser.hh b/mi2mu/include/midi-score-parser.hh
new file mode 100644 (file)
index 0000000..f9c8b64
--- /dev/null
@@ -0,0 +1,33 @@
+/*
+  midi-score-parser.hh -- declare 
+
+  source file of the GNU LilyPond music typesetter
+
+  (c) 1997 Jan Nieuwenhuizen <jan@digicash.com>
+*/
+
+
+#ifndef MIDI_SCORE_PARSER_HH
+#define MIDI_SCORE_PARSER_HH
+
+#include "midi-parser.hh"
+#include "proto.hh"
+#include "mi2mu-proto.hh"
+#include "parray.hh"
+
+class Midi_score_parser : public Midi_parser
+{
+public:
+  Mudela_score* parse (String filename_str, Sources*);
+
+private:
+  void open (String filename_str, Sources*);
+
+  void parse_header ();
+  // why the #*&$#{%) has Link_array another behaviour than Link_list??
+  //  int find_earliest_i (Link_array<Midi_track_parser*>& tracks);
+  int find_earliest_i (Link_array<Midi_track_parser>& tracks);
+  Mudela_score* parse_score ();
+};         
+
+#endif // MIDI_SCORE_PARSER_HH
diff --git a/mi2mu/include/midi-track-parser.hh b/mi2mu/include/midi-track-parser.hh
new file mode 100644 (file)
index 0000000..021197c
--- /dev/null
@@ -0,0 +1,44 @@
+/*
+  midi-track-parser.hh -- declare 
+
+  source file of the GNU LilyPond music typesetter
+
+  (c) 1997 Jan Nieuwenhuizen <jan@digicash.com>
+*/
+
+
+#ifndef MIDI_TRACK_PARSER_HH
+#define MIDI_TRACK_PARSER_HH
+
+#include "proto.hh"
+#include "plist.hh"
+#include "moment.hh"
+#include "mi2mu-proto.hh"
+#include "midi-parser.hh"
+
+class Midi_track_parser : public Midi_parser
+{
+public:
+
+  Midi_track_parser (Midi_parser_info* info_l);
+  ~Midi_track_parser ();
+
+  Moment at_mom ();
+  Mudela_staff* parse (Mudela_column* col_l);
+
+private:
+  bool eot ();
+  void note_end (Mudela_column* col_l, int channel_i, int pitch_i, int aftertouch_i );
+  void note_end_all (Mudela_column* col_l) ;
+  void parse_delta_time ();
+  Mudela_item* parse_event (Mudela_column* col_l);
+  void parse_header ();
+
+  Moment at_mom_;
+  Byte running_byte_;
+  Link_list<Mudela_note*> open_note_l_list_;
+  Mudela_staff* mudela_staff_p_;
+  Midi_parser_info* track_info_p_;
+};
+
+#endif // MIDI_TRACK_PARSER_HH
index 6d752fe1d6529e132f35e1e081bbb9db8bd8e121..d1102f08088f80d234097c7cd1f183529f52746e 100644 (file)
@@ -20,7 +20,8 @@ public:
     void add_item (Mudela_item* mudela_item_p);
     void add_staff (Mudela_staff* mudela_staff_p);
 
-    Mudela_column* mudela_column_l (Moment mom);
+    Mudela_column* find_column_l (Moment mom);
+    Mudela_column* get_column_l (Moment mom);
 
     void output (String filename_str);
     void process();
@@ -36,10 +37,9 @@ private:
     void quantify_durations();
     void settle_columns();
 
-    Pointer_list<Mudela_column*> mudela_column_p_list_;
     Pointer_list<Mudela_staff*> mudela_staff_p_list_;
-//    Link_array<Mudela_column*> column_l_array_;
-    // huh?
+   // wants Pointer_array!
+//    Pointer_list<Mudela_column*> mudela_column_p_list_;
     Link_array<Mudela_column> column_l_array_;
 
 // ugh, ugh, ugh
index 3f1373a4acfecf3bc7cb605f57c6f28fc4c3d0ea..b8535618b911ecbfe637304a0ccf89e6a92dc2b5 100644 (file)
@@ -3,6 +3,7 @@
 //
 // copyright 1997 Jan Nieuwenhuizen <jan@digicash.com>
 
+#include <assert.h>
 #include <ctype.h>
 #include "moment.hh"
 #include "duration-convert.hh"
@@ -14,9 +15,9 @@
 #include "mudela-staff.hh"
 #include "mudela-stream.hh"
 #include "mudela-voice.hh"
-#include "my-midi-parser.hh"
 #include "mudela-score.hh"
 
+extern Mudela_score* mudela_score_l_g;
 
 Mudela_staff::Mudela_staff (int number_i, String copyright_str, String track_name_str, String instrument_str)
 {
@@ -60,7 +61,7 @@ Mudela_staff::eat_voice (Link_list<Mudela_item*>& items)
        {
          Moment dur = i->at_mom() - mom;
          // ugh, need score
-         Mudela_column* start = midi_parser_l_g->mudela_score_p_->mudela_column_l (mom);
+         Mudela_column* start = mudela_score_l_g->find_column_l (mom);
          voice_p->add_item (new Mudela_skip (start, dur));
          mom = i->at_mom();
        }