]> git.donarmstrong.com Git - lilypond.git/commitdiff
lilypond-0.0.37
authorfred <fred>
Sun, 24 Mar 2002 19:33:48 +0000 (19:33 +0000)
committerfred <fred>
Sun, 24 Mar 2002 19:33:48 +0000 (19:33 +0000)
48 files changed:
Documentation/faq.pod
Sources.make
Variables.make
configure
deps/dummy.dep
hdr/lily-stream.hh [new file with mode: 0644]
hdr/midi-main.hh
hdr/midi-score.hh
hdr/midi-track.hh
hdr/midiitem.hh
hdr/my-midi-lexer.hh
hdr/my-midi-parser.hh
hdr/proto.hh
hdr/script.hh
hdr/stem.hh
hdr/textitem.hh
hdr/track-column.hh [new file with mode: 0644]
input/Makefile
input/fugue1.midi.ly [new file with mode: 0644]
input/pre1.midi.ly [new file with mode: 0644]
src/beam.cc
src/binary-source-file.cc
src/dimen.cc
src/duration.cc [new file with mode: 0644]
src/inputfile.cc
src/lexer.l
src/lily-stream.cc [new file with mode: 0644]
src/lyricitem.cc
src/main.cc
src/midi-lexer.l
src/midi-main.cc
src/midi-parser.y
src/midi-score.cc
src/midi-template.cc
src/midi-track.cc
src/midiitem.cc
src/midistream.cc
src/my-midi-lexer.cc
src/my-midi-parser.cc
src/mylexer.cc
src/note.cc
src/request.cc
src/script.cc
src/sourcefile.cc
src/stem.cc
src/tex.cc
src/textitem.cc
src/track-column.cc [new file with mode: 0644]

index d54266f053612be28755fbe1aa96ed15401ca207..79e511498ef3dcb34e2fb516c35e78ff76518348 100644 (file)
@@ -56,11 +56,14 @@ A: By using g++ LilyPond is portable to all platforms which support
 g++ (there are quite a few). Not having to support other compilers
 saves us a *lot* of trouble. LilyPond & FlowerLib uses:
 
-=over 5
+=over 6
 
 =item *
 builtin bool
 
+=item *
+64 bit integral type long long
+
 =item *
 typeof
 
index 014621714925a3ee3084789d08c437bb1919efd6..a4e776d8f4dec10108c4752f37b5e940d37fef8e 100644 (file)
@@ -1,7 +1,9 @@
 # Sources.make
 # sourcefiles to be shipped. Also used for dependencies
 
-hdr=bar.hh barreg.hh beam.hh boxes.hh break.hh clefreg.hh clefitem.hh\
+hdr=bar.hh barreg.hh beam.hh\
+       binary-source-file.hh\
+       boxes.hh break.hh clefreg.hh clefitem.hh\
        colhpos.hh  commandrequest.hh   \
        complexwalker.hh complexstaff.hh\
        const.hh debug.hh dimen.hh directionalspanner.hh\
@@ -86,20 +88,30 @@ stablecc=request.cc bar.cc boxes.cc break.cc  \
 # m2m headers
 #
 mym2mhh=\
- binary-source-file.hh\
+ duration.hh\
+ lily-stream.hh\
  midi-event.hh\
  midi-main.hh\
  midi-score.hh\
  midi-track.hh\
  my-midi-lexer.hh\
  my-midi-parser.hh\
+ track-column.hh\
+
+#
+
+# m2m shared headers
+#
+mym2msharedhh=\
+ binary-source-file.hh\
 
 #
+
 # m2m source
 #
 mym2mcc=\
- binary-source-file.cc\
+ duration.cc\
+ lily-stream.cc\
  midi-event.cc\
  midi-main.cc\
  midi-score.cc\
@@ -107,15 +119,17 @@ mym2mcc=\
  midi-track.cc\
  my-midi-lexer.cc\
  my-midi-parser.cc\
+ track-column.cc\
 
 #
 
 # m2m shared source
 #
 mym2msharedcc=\
+ binary-source-file.cc\
  inputfile.cc\
  sourcefile.cc\
  source.cc\
 
-
 # 
+
index 886b6eb256a6267a4be6dd82c1e63f41e80112d0..6a9b2cf738520a5cfd630876db83fb6574558e23 100644 (file)
@@ -3,7 +3,7 @@
 # version info
 MAJVER=0
 MINVER=0
-PATCHLEVEL=36
+PATCHLEVEL=37
 
 
 
index 1c611713a579f727fe0dbdf6008ec4baf821a2d3..fec8a5617d930894208dcd8848636971e3b91891 100755 (executable)
--- a/configure
+++ b/configure
@@ -12,7 +12,7 @@ function setversion() {
 
 MAKE=${MAKE:-make}
 PREFIX=${PREFIX:-.}
-NEEDFLOWERVER=1.1.2
+NEEDFLOWERVER=1.1.4
 
 echo using PREFIX=$PREFIX
 echo I need Flower version $NEEDFLOWERVER
index 8b137891791fe96927ad78e64b0aad7bded08bdc..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 100644 (file)
@@ -1 +0,0 @@
-
diff --git a/hdr/lily-stream.hh b/hdr/lily-stream.hh
new file mode 100644 (file)
index 0000000..55ae71b
--- /dev/null
@@ -0,0 +1,27 @@
+//
+//  lily-stream.hh -- part of LilyPond
+//
+//  copyright 1997 Jan Nieuwenhuizen <jan@digicash.com>
+
+// should i be named Mudela_stream?
+
+#ifndef LILY_STREAM_HH
+#define LILY_STREAM_HH
+
+/// Lily output
+struct Lily_stream {
+    ostream* os_p_;
+    String filename_str_;
+    
+    Lily_stream( String filename_str );
+    ~Lily_stream();
+
+    Lily_stream& operator <<( String str );
+    Lily_stream& operator <<( Midi_event& midi_event_r );
+
+    void header();
+    void open();
+};
+
+#endif // LILY_STREAM_HH
+
index 4eb86c27d2d0c58797f1fddacaa25d519190d64c..b58e077d432d06309699da86f205cf55010c3db4 100644 (file)
@@ -19,6 +19,9 @@ extern Verbose level_ver;
 #endif
 
 extern Source* source_l_g;
+extern bool no_triplets_bo_g;
 void message( String message_str, char const* context_ch_c_l );
 void warning( String message_str, char const* context_ch_c_l );
 void error( String message_str, char const* context_ch_c_l );
+
+String version_str();
index 2f88168a11daa244dff5daa898dddad1862d8b6b..68707633ef1987a427a03ed4416ff2d4ba7b01ef 100644 (file)
@@ -14,7 +14,10 @@ public:
 
        void add_track( Midi_track* midi_track_p );
 
+       int output_mudela( String filename_str );
+
 private:
+       IPointerList<Midi_track*> midi_track_p_list_;
        int format_i_;
        int tracks_i_;
        int tempo_i_;
index ce258c6eae33b938d2bec7769353889bde23ef49..d1458ed0ca98563c46cbd8470749ec9dfaa55ff4 100644 (file)
@@ -9,12 +9,17 @@
 /// (midi_track)
 class Midi_track {
 public:
-       Midi_track();
+       Midi_track( int track_i );
        ~Midi_track();
 
-       void add_event( Midi_event* midi_event_p );
+       void add_event( Moment mom, Midi_event* midi_event_p );
+       String name_str();
+       void output_mudela( Lily_stream& lily_stream_r );
+       Track_column* tcol_l( Moment mom );
 
 private:
+       IPointerList<Track_column*> tcol_p_list_;
+       String name_str_;
 };
 
 #endif // MIDI_TRACK_HH
index 486637c367a56c8f62df81264635bf0ed1698214..f4b14aa5ef14cda2c562bc3d447abd94b887312c 100644 (file)
@@ -10,7 +10,7 @@
 
 struct Midi_item {
     /* *************** */
-    static String int2varlength_str( int i );
+    static String i2varint_str( int i );
     virtual void output_midi( Midi_stream& midi_stream_r );
     virtual String str() = 0;
 };
index 5245d1be844151a46ff74c593ab306133e0f4910..032bf6752b848a8b02bd206246bf4ddda910cbce 100644 (file)
@@ -27,7 +27,7 @@ public:
        int close_i();
        void error( char const* sz_l );
        char const* here_ch_c_l();
-       static int varint2int_i( String str );
+       static int varint2_i( String str );
        int yylex();
 
 private:
index fd7e088654495c0f975c233288251ba9a896a864..d199bc1c4ec3decfc0011fcb4dfe76228815309b 100644 (file)
@@ -6,9 +6,8 @@
 #ifndef MY_MIDI_PARSER_HH
 #define MY_MIDI_PARSER_HH
 
-#include "proto.hh"
-#include "varray.hh"
-#include "string.hh"
+// #include "proto.hh"
+// #include "string.hh"
 
 int yyparse();
 
@@ -20,25 +19,26 @@ public:
        void add_score( Midi_score* midi_score_p );
        void error( char const* sz_l );
        int parse();
-       void forward( Real f );
+       void forward( int i );
+       Moment mom();
        void note_begin( int channel_i, int pitch_i, int dyn_i );
        Midi_event* note_end_midi_event_p( int channel_i, int pitch_i, int dyn_i );
-       int output( String filename_str );
-       void set_division( int clocks_per_4_i );
+       int output_mudela( String filename_str );
+       void reset();
+       void set_division_4( int division_4_i );
        void set_key( int accidentals_i, int minor_i );
        void set_tempo( int useconds_i );
        void set_time( int num_i, int den_i, int clocks_i, int count_32_i );
 
 private:
-       Real now_f_;
-       Real step_f_;
+       Int64 now_i64_; // 31 bits yields tipically about 1000 bars
 
        static int const CHANNELS_i = 16;
        static int const PITCHES_i = 128;
-       Real running_f_f_a_[ CHANNELS_i ][ PITCHES_i ];
+       Int64 running_i64_i64_a_[ CHANNELS_i ][ PITCHES_i ];
 
-       Array<Midi_score*> midi_score_p_array_;
-       int clocks_per_whole_i_;
+       Midi_score* midi_score_p_;
+       int division_1_i_;
        Midi_key* midi_key_p_;
        Midi_tempo* midi_tempo_p_;
        Midi_time* midi_time_p_;
index 0f2a007c7929a7668895156560155df8c0e50c9a..0ca6d726ddf10f5459df36b785f70a3da6947e93 100644 (file)
@@ -10,6 +10,9 @@
 #include "fproto.hh"
 #include "real.hh"
 
+/// (i64)
+typedef long long Int64;
+
 struct Absdynamic_req;
 struct Accidental;
 struct Atom;
@@ -33,6 +36,8 @@ struct Complex_staff;
 struct Complex_walker;
 struct Cresc_req;
 struct Decresc_req;
+struct Duration;
+struct Duration_iterator;
 struct Durational_req;
 struct Dynamic;
 struct Group_change_req;
@@ -50,6 +55,7 @@ struct Key_change_req;
 struct Key_item;
 struct Keyword;
 struct Keyword_table;
+struct Lily_stream;
 struct Line_of_score;
 struct Line_of_staff;
 struct Linestaff;
@@ -98,6 +104,7 @@ struct Offset;
 struct Output;
 struct PCol;
 struct Plet_req;
+struct Plet;
 struct PScore;
 struct PStaff;
 struct Paperdef;
@@ -151,6 +158,7 @@ struct Text_register;
 struct Text_req;
 struct Timing_req;
 struct Time_description;
+struct Track_column;
 struct Voice;
 struct Voice_element;
 struct Voice_group_registers;
index 9c48c75e248d5d33b631436df1965d1985f6b526..7c089e3a5426475b286df86a655b49c1418cfc1e 100644 (file)
@@ -32,7 +32,7 @@ struct Script : Item {
 private:
     void       set_symdir();
     void       set_default_dir();
-    void       set_default_pos();
+    void       set_default_index();
     Symbol symbol()const;
 };
 
index ccc02a6b594a561f223860b7f6813d60817b452c..2aafd66074c0ba1db2f5de7faa5eccd3b81d4c0f 100644 (file)
@@ -63,7 +63,7 @@ struct Stem : Item {
     void add(Notehead*n);
     const char * name() const;
 
-    Real hpos()const;
+    Real hindex()const;
     void do_print() const;
     void set_stemend(Real);
     int get_default_dir();
index c7df9069d96c11420b39e81616801b90335d717b..4e0e454941b85fde587ab1fd7a34345196a0dbc5 100644 (file)
@@ -18,7 +18,7 @@ struct Text_item : Item {
     
     /* ***************/
     const char * name() const;    
-    virtual void set_default_pos();
+    virtual void set_default_index();
     Molecule* brew_molecule_p() const;
     void do_pre_processing();
     
diff --git a/hdr/track-column.hh b/hdr/track-column.hh
new file mode 100644 (file)
index 0000000..1d86755
--- /dev/null
@@ -0,0 +1,24 @@
+//
+// track-column.hh -- declare Track_column
+//
+// copyright 1997 Jan Nieuwenhuizen <jan@digicash.com>
+
+#ifndef TRACK_COLUMN_HH
+#define TRACK_COLUMN_HH
+
+/// (tcol)
+class Track_column {
+public:
+       Track_column( Moment mom );
+       ~Track_column();
+
+       void add_event( Midi_event* midi_event_p );
+       Moment mom();
+
+//private:
+       IPointerList<Midi_event*> midi_event_p_list_;
+       Moment mom_;
+};
+
+#endif // TRACK_COLUMN_HH
+
index 92dfaf11c5ed391866ad03e27046627a01b9e58d..47e58f972d5a823373f00d89ceac7b6029dc3346 100644 (file)
@@ -7,7 +7,8 @@ DISTFILES=Makefile  kortjakje.ly maartje.ly\
        martien.ly mlalt.ly mlvio1.ly mlvio2.ly mlcello.ly\
        coriolan-alto.ly rhythm.ly \
        standchen.tex  scsii-menuetto.tex scsii-menuetto.ly\
-       martien.tex
+       martien.tex\
+       pre1.midi.ly fugue1.midi.ly
 
 
 dist:
diff --git a/input/fugue1.midi.ly b/input/fugue1.midi.ly
new file mode 100644 (file)
index 0000000..b2c091f
--- /dev/null
@@ -0,0 +1,100 @@
+% Creator: This is m2m 0.0.36-2/FlowerLib 1.1.3-1 of Feb 27 1997 02:41:23
+% Automatically generated, at Thu Feb 27 08:38:27 1997
+% from input file: 
+
+track0 = music { $
+       % \Time: 4/8, 96: 8 % \Tempo: 967742: 61 4 per minute 
+       % \Tempo: 1000000: 60 4 per minute 
+       % \Tempo: 1052632: 56 4 per minute 
+       % \Tempo: 1132075: 53 4 per minute 
+       % \Tempo: 1200000: 50 4 per minute 
+       % \Tempo: 1463415: 40 4 per minute 
+       % \Tempo: 1578947: 38 4 per minute 
+       
+$} % track0
+
+track1 = music { $
+       g8 a8 b8 c8. d32 c32 b8 e8 a8 d8. e16 d16 c16 
+       b16 g16 a16 b16 c16 b16 c16 d16 e16 d16 e16 
+       fis16 g8 b8 c8 a8 d16 c16 b16 a16 g8. g16 f16 
+       e16 f16 g16 a16 g16 a16 b16 c2 b4 c8 d8 e8 f8. 
+       g32 f32 e8 a8 d8 g8. a16 g16 f16 e8 a8. b16 a16 
+       g16 f2 e8. fis16 g2 fis4 g16 f16 e16 d16 c16 
+       d16 c16 b16 a16 c16 b16 a16 c16 a16 gis8 e8 
+       d8 c16 b16 a16 gis16 a16 b16 c16 fis16 gis16 
+       a16 b8 a16 b16 c8 f8 e8 d4 c16 b16 c64 b64 c64 
+       b64 c64 b64 c64 b64 c64 b32. a32. a4 g8 a8 b8 
+       c8. d32 c32 b8 c8 d8 e8 f8. g32 f32 e8 a8 d8 g8. 
+       a16 g16 f16 e8 a8 d8 ais8 a8 g16 f16 g16 f16 
+       g16 e16 f16 g16 g64 a64 g32 f32 g32 a16 cis16 
+       d16 g16 f64 e64 f64 e64 f64 e16. d32. d8. g8 
+       a8 b8 c8. d32 c32 b8 e8 a8 d8. e16 d16 c16 b16 
+       c16 d16 e16 f16 g16 a16 g16 f16 e16 d16 c16 
+       c64 b64 c64 b8. c8 d8 g8 c4 b8 c4 b8 ais8 a8 d4 
+       c8 d8 e8 f8.. a32. g32. f32. e32. f32. e32. 
+       d32. c2 g32 a32 b16 c16 d16 e16 f8. c32 d32 
+       e32 f16 g16 a8. b16 c2 
+$} % track1
+
+track2 = music { $
+       c8 d8 e8 f8. g32 f32 e8 a8 d8 g8. a16 g16 f16 
+       e16 f16 e16 d16 c16 d16 c16 b16 a8 fis8 g4. 
+       f16 e16 f8 d8 g8 f8 e8 d8 g4 f16 e16 f8.. f16 
+       e8 d4 c8 f8 g16 f16 e16 f8 d8 g4.. g8 a8 b8 c8. 
+       d32 c32 b8 e8 a8 d8. e16 d16 c16 b16.. d8 e8 
+       fis8 g8. a32 g32 f8 b8 e8 a8. b16 a16 gis16 
+       fis8 f8 e8 d8. e16 fis16 gis16 a16 gis16 a16 
+       b16 gis16 fis16 gis16 a16 b8 c8 d8 e8 f8. g32 
+       f32 e8 a8 d8 g8. a16 g16 f16 e16. e16. fis16. 
+       g4 fis8 gis8 a4 g8 a8 b8 c8. d32 c32 b16. e8 
+       a8 d8. e16 d16 c16 b8 g8 cis8 d8 e8 cis8 d8 e8 
+       a8 e8 fis8 g8 a8. b32 a32 g8 c8 fis8 b8. c16 
+       b16 a16 g16 fis16 e16 d16 e4 d4. a16 g16 f16 
+       e16 g16 f16 g4. a16 a16 ais8 c4 d8 g8 g4. f4 
+       e8 d4 e16. a4 g4 f8 g8 a8 ais8. c32 ais32 a8 
+       d8 g8 c8. d16 c16 ais16 a16 ais16 a16 g16 f16 
+       g16 f16 e16 g16 a4 f16 d8 e2 
+$} % track2
+
+track3 = music { $
+       g8 a8 b8 c8. d32 c32 b8 e8 a8 d8. e16 d16 c16 
+       b8 c4 ais8 a8 d8 g8 c8 a16 b16 c16 d4 g4 g8 a8 
+       b8 c8. d32 c32 b8 e8 a8 d8. e16 d16 c16 b8 e4. 
+       d4 b16 c16 a16 e16 d16 c16 b16 c16 a16 b16 c16 
+       d16 c16 b16 a16 g4 e8 fis8 gis8 a8. b32 a32 
+       g8 c8 fis8 b8. c16 b16 a16 gis16.. a4 gis8 
+       a4 g8 a8 b8 c8. d32 c32 b8 e8 a8 d4 g8 d4 c8 a8 
+       e4 d8 a8 b8 cis8 d8. e32 d32 c8 f8 b8 e8. f16 
+       e16 d16 cis8 a8 b8 cis8 d8. e32 d32 c8 fis8 
+       b8 e8. fis16 e16 d16 c4.. d16 c16 b16 a16 g16 
+       a16 fis16 g16.. b16.. c16.. d8 e8. f32 e32 
+       d8 g8 c8 f8. g16 f16 e16 d4 e8 d4 g8 g4. c8 d8 
+       e8 f8. g32 f32 e8 a8 d8 g8. a16 g16 f16 e16 d16 
+       e16 f16 g16 a16 ais16 g16 a16 e16 f16 g16 a16 
+       b16 c16 a16 c1 
+$} % track3
+
+track4 = music { $
+       c8 d8 e8 f8. g32 f32 e8 a8 d8 g8. a16 g16 f16 
+       e16 f16 e16 d16 c16 d16 c16 b16 a8 d8 a8 fis8 
+       g16 a16 ais16 g16 cis8 d8 a4 e4 a16 b16 c16 
+       d16 c16 b16 a16 g16 c8 g8 a8 b8 c8. d32 c32 b8 
+       e8 a8 d8. e16 d16 c16 b8 e4 d8 c8 f4 e4 d4 e8 f8 
+       e16 d16 e4 a4 g8 a8 b8 c8. d32 c32 b8 e8 a8 d8. 
+       e16 d16 c16 b8 ais8 a8 g8 a8 fis8 g8 e8 d4 e8 
+       f8 g8. a32 g32 f8 ais8 e8 a8. b16. a16 g16 f16 
+       e16 f16 d16 g8 a8 d4.. e16 d16 c16 b16 a16 g16 
+       fis16 e8 e8 fis8 g4 a16 g16 fis8 d8 g1 a4 b8 
+       c8 f16 a16 g16 f16 e16 d16 c16 b16 c16 d16 e16 
+       f16 g8 g8 b2 c8 
+$} % track4
+
+score {
+       staff { melodic music { track0 } }
+       staff { melodic music { track1 } }
+       staff { melodic music { track2 } }
+       staff { melodic music { track3 } }
+       staff { melodic music { track4 } }
+       commands { meter { 4*4 } }
+       midi { tempo 4:60 }
+}
diff --git a/input/pre1.midi.ly b/input/pre1.midi.ly
new file mode 100644 (file)
index 0000000..ca6beaf
--- /dev/null
@@ -0,0 +1,80 @@
+% Creator: This is m2m 0.0.36-2/FlowerLib 1.1.3-1 of Feb 27 1997 02:41:23
+% Automatically generated, at Thu Feb 27 02:54:33 1997
+% from input file: 
+
+track0 = music { $
+       % \Time: 4/8, 96: 8 % \Tempo: 857143: 69 4 per minute 
+       % \Tempo: 882353: 67 4 per minute 
+       % \Tempo: 909091: 65 4 per minute 
+       % \Tempo: 937500: 64 4 per minute 
+       % \Tempo: 967742: 61 4 per minute 
+       % \Tempo: 1000000: 60 4 per minute 
+       % \Tempo: 1200000: 50 4 per minute 
+       % \Tempo: 1224490: 48 4 per minute 
+       % \Tempo: 833333: 72 4 per minute 
+       
+$} % track0
+
+track1 = music { $
+       g16 c16 e16 g16 c16 e16 g16 c16 e16 g16 c16 
+       e16 a16 d16 f16 a16 d16 f16 a16 d16 f16 a16 
+       d16 f16 g16 d16 f16 g16 d16 f16 g16 d16 f16 
+       g16 d16 f16 g16 c16 e16 g16 c16 e16 g16 c16 
+       e16 g16 c16 e16 a16 e16 a16 a16 e16 a16 a16 
+       e16 a16 a16 e16 a16 fis16 a16 d16 fis16 a16 
+       d16 fis16 a16 d16 fis16 a16 d16 g16 d16 g16 
+       g16 d16 g16 g16 d16 g16 g16 d16 g16 e16 g16 
+       c16 e16 g16 c16 e16 g16 c16 e16 g16 c16 e16 
+       g16 c16 e16 g16 c16 e16 g16 c16 e16 g16 c16 
+       d16 fis16 c16 d16 fis16 c16 d16 fis16 c16 
+       d16 fis16 c16 d16 g16 b16 d16 g16 b16 d16 g16 
+       b16 d16 g16 b16 e16 g16 cis16 e16 g16 cis16 
+       e16 g16 cis16 e16 g16 cis16 d16 a16 d16 d16 
+       a16 d16 d16 a16 d16 d16 a16 d16 d16 f16 b16 
+       d16 f16 b16 d16 f16 b16 d16 f16 b16 c16 g16 
+       c16 c16 g16 c16 c16 g16 c16 c16 g16 c16 a16 
+       c16 f16 a16 c16 f16 a16 c16 f16 a16 c16 f16 
+       a16 c16 f16 a16 c16 f16 a16 c16 f16 a16 c16 
+       f16 g16 b16 f16 g16 b16 f16 g16 b16 f16 g16 
+       b16 f16 g16 c16 e16 g16 c16 e16 g16 c16 e16 
+       g16 c16 e16 ais16 c16 e16 ais16 c16 e16 ais16 
+       c16 e16 ais16 c16 e16 a16 c16 e16 a16 c16 e16 
+       a16 c16 e16 a16 c16 e16 a16 c16 dis16 a16 c16 
+       dis16 a16 c16 dis16 a16 c16 dis16 b16 c16 
+       d16 b16 c16 d16 b16 c16 d16 b16 c16 d16 g16 
+       b16 d16 g16 b16 d16 g16 b16 d16 g16 b16 d16 
+       g16 c16 e16 g16 c16 e16 g16 c16 e16 g16 c16 
+       e16 g16 c16 f16 g16 c16 f16 g16 c16 f16 g16 
+       c16 f16 g16 b16 f16 g16 b16 f16 g16 b16 f16 
+       g16 b16 f16 a16 c16 fis16 a16 c16 fis16 a16 
+       c16 fis16 a16 c16 fis16 g16 c16 g16 g16 c16 
+       g16 g16 c16 g16 g16 c16 g16 g16 c16 f16 g16 
+       c16 f16 g16 c16 f16 g16 c16 f16 g16 b16 f16 
+       g16 b16 f16 g16 b16 f16 g16 b16 f16 g16 ais16 
+       e16 g16 ais16 e16 g16 ais16 e16 g16 ais16 
+       e16 f16 a16 c16 f16 c16 a16 c16 a16 f16 a16 
+       f16 d16 f16 d16 g16 b16 d16 f16 d16 b16 d16 
+       b16 g16 b16 d16 f16 e64 f64 e32 d16 c1 
+$} % track1
+
+track2 = music { $
+       c2 e4. c2 e4. c2 d4. c2 d4. b2 d4. b2 d4. c2 e4. 
+       c2 e4. c2 e4. c2 e4. c2 d4. c2 d4. b2 d4. b2 d4. 
+       b2 c4. b2 c4. a2 c4. a2 c4. d2 a4. d2 a4. g2 b4. 
+       g2 b4. g2 ais4. g2 ais4. f2 a4. f2 a4. f2 gis4. 
+       f2 gis4. e2 g4. e2 g4. e2 f4. e2 f4. d2 f4. d2 
+       f4. g2 d4. g2 d4. c2 e4. c2 e4. c2 g4. c2 g4. 
+       f2 f4. f2 f4. fis2 c2 fis2 c4. gis2 f4. gis2 
+       f4. g2 f4. g2 f4. g2 e2 g2 e4. g2 d4. g2 d2 g2 
+       d4. g2 d4. g2 dis4. g2 dis4. g2 e4. g2 e4. g2 
+       d4. g2 d4. g2 d4. g2 d4. c2 c4. c2 c4. c1 c1 b1 
+       c1 c1 
+$} % track2
+
+score {
+       staff { melodic music { track0 } }
+       staff { melodic music { track1 } }
+       staff { melodic music { track2 } }
+       commands { meter { 4*4 } }
+       midi { tempo 4:60 }
+}
index 1b0fa2baa3c53f610eb5983aae11e20f0ffa8b48..f554d424bcbfee973ed9f3d15e6d5d40fdca9679 100644 (file)
@@ -28,7 +28,7 @@ struct Stem_info {
 
 Stem_info::Stem_info(const Stem*s)
 {
-    x = s->hpos();
+    x = s->hindex();
     int dir = s->dir;
     idealy  = max(dir*s->top, dir*s->bot);
     miny = max(dir*s->minnote, dir*s-> maxnote);
@@ -119,9 +119,9 @@ void
 Beam::set_stemlens()
 {
     iter_top(stems,s);
-    Real x0 = s->hpos();    
+    Real x0 = s->hindex();    
     for (; s.ok() ; s++) {
-       Real x =  s->hpos()-x0;
+       Real x =  s->hindex()-x0;
        s->set_stemend(left_pos + slope * x);   
     }
 }
@@ -192,8 +192,8 @@ Interval
 Beam::width() const
 {
     Beam * me = (Beam*) this;  // ugh
-    return Interval( (*me->stems.top()) ->hpos(),
-                    (*me->stems.bottom()) ->hpos() );
+    return Interval( (*me->stems.top()) ->hindex(),
+                    (*me->stems.bottom()) ->hindex() );
 }
 
 /*
@@ -202,8 +202,8 @@ Beam::width() const
 Molecule
 Beam::stem_beams(Stem *here, Stem *next, Stem *prev)const
 {
-    assert( !next || next->hpos() > here->hpos()  );
-    assert( !prev || prev->hpos() < here->hpos()  );
+    assert( !next || next->hindex() > here->hindex()  );
+    assert( !prev || prev->hindex() < here->hindex()  );
     Real dy=paper()->internote()*2;
     Real stemdx = paper()->rule_thickness();
     Real sl = slope*paper()->internote();
@@ -216,7 +216,7 @@ Beam::stem_beams(Stem *here, Stem *next, Stem *prev)const
     if (prev) {
        int lhalfs= lhalfs = here->beams_left - prev->beams_right ;
        int lwholebeams= here->beams_left <? prev->beams_right ;
-       Real w = (here->hpos() - prev->hpos())/4;
+       Real w = (here->hindex() - prev->hindex())/4;
        Symbol dummy;
        Atom a(dummy);
        if (lhalfs)             // generates warnings if not
@@ -233,7 +233,7 @@ Beam::stem_beams(Stem *here, Stem *next, Stem *prev)const
        int rhalfs = here->beams_right - next->beams_left;
        int rwholebeams = here->beams_right <? next->beams_left; 
 
-       Real w = next->hpos() - here->hpos();
+       Real w = next->hindex() - here->hindex();
        Atom a = paper()->lookup_p_->beam(sl, w + stemdx);
        
        int j = 0;
@@ -264,7 +264,7 @@ Beam::brew_molecule_p() const return out;
 {
     Real inter=paper()->internote();
     out = new Molecule;
-    Real x0 = stems.top()->hpos();
+    Real x0 = stems.top()->hindex();
     
     for (iter_top(stems,i); i.ok(); i++) {
        PCursor<Stem*> p(i-1);
@@ -273,7 +273,7 @@ Beam::brew_molecule_p() const return out;
        Stem * next = n.ok() ? n.ptr() : 0;
 
        Molecule sb = stem_beams(i, next, prev);
-       Real  x = i->hpos()-x0;
+       Real  x = i->hindex()-x0;
        sb.translate(Offset(x, (x * slope  + left_pos)* inter));
        out->add(sb);
     }
index 8335a13a5eed895b66e4a08bcb0c713bfc941efa..8545f221e9f260c80675df0cea252eafe93ffa4f 100644 (file)
@@ -32,13 +32,13 @@ Binary_source_file::error_str( char const* pos_ch_c_l )
     char const* end_ch_c_l = pos_ch_c_l + 7 <? ch_c_l() + length_off();
 
     String pre_str( (Byte const*)begin_ch_c_l, pos_ch_c_l - begin_ch_c_l );
-    pre_str = StringConversion::bin2hex_str( pre_str );
+    pre_str = String_convert::bin2hex_str( pre_str );
     for ( int i = 2; i < pre_str.length_i(); i += 3 )
-       pre_str = pre_str.left( i ) + " " + pre_str.mid( i + 1, INT_MAX );
+       pre_str = pre_str.left_str( i ) + " " + pre_str.mid_str( i + 1, INT_MAX );
     String post_str( (Byte const*)pos_ch_c_l, end_ch_c_l - pos_ch_c_l );
-    post_str = StringConversion::bin2hex_str( post_str );
+    post_str = String_convert::bin2hex_str( post_str );
     for ( int i = 2; i < post_str.length_i(); i += 3 )
-       post_str = post_str.left( i ) + " " + post_str.mid( i + 1, INT_MAX );
+       post_str = post_str.left_str( i ) + " " + post_str.mid_str( i + 1, INT_MAX );
 
     String str = pre_str
        + String( '\n' )
index 93077bd87b5b92e81ee4d05fd4739683ff2b5fa0..9489ae9a1eef6d7f1e66275776037c1badf93d24 100644 (file)
@@ -6,13 +6,13 @@
 Real
 parse_dimen(String dim)
 {
-    int i=dim.len()-1;
+    int i=dim.length_i()-1;
     const char *s = dim;
     while  (i > 0 && (isspace(s[i]) || isalpha(s[i])) ){
        i--;
     }
     String unit(s + i+1);
-    return convert_dimen(dim.fvalue(), unit); 
+    return convert_dimen(dim.value_f(), unit); 
 }
 
 
diff --git a/src/duration.cc b/src/duration.cc
new file mode 100644 (file)
index 0000000..6a25123
--- /dev/null
@@ -0,0 +1,249 @@
+//
+// duration.cc -- implement Duration, Plet, Duration_convert, Duration_iterator
+//
+// copyright 1997 Jan Nieuwenhuizen <jan@digicash.com>
+
+// split into 4?
+
+#include "proto.hh"         // ugh, these all for midi-main.hh 
+#include "plist.hh"
+#include "string.hh"
+#include "sourcefile.hh"
+#include "source.hh"
+#include "midi-main.hh"    // *tors
+
+#include "string.hh"
+#include "moment.hh"
+#include "duration.hh"
+
+Duration::Duration( int type_i, int dots_i = 0, Plet* plet_l )
+{
+       type_i_ = type_i;
+       dots_i_ = dots_i;
+       plet_p_ = 0;
+       set_plet( plet_l );
+}
+
+Duration::Duration( Duration const& dur_c_r )
+{
+       type_i_ = 0;
+       dots_i_ = 0;
+       plet_p_ = 0;
+       *this = dur_c_r;
+}
+
+Duration::~Duration()
+{
+       delete plet_p_;
+}
+
+Duration const& 
+Duration::operator =( Duration const& dur_c_r )
+{
+       if ( &dur_c_r == this )
+               return *this;
+
+       type_i_ = dur_c_r.type_i_;
+       dots_i_ = dur_c_r.dots_i_;
+       set_plet( dur_c_r.plet_p_ );
+
+       return *this;
+}
+
+void
+Duration::set_plet( Plet* plet_l )
+{
+       delete plet_p_;
+       plet_p_ = 0;
+       if ( plet_l )
+               plet_p_ = new Plet( *plet_l );
+}
+
+Plet::Plet( int iso_i, int type_i )
+{
+       iso_i_ = iso_i;
+       type_i_ = type_i;
+}
+
+Plet::Plet( Plet const& plet_c_r )
+{
+       iso_i_ = plet_c_r.iso_i_;
+       type_i_ = plet_c_r.type_i_;
+}
+
+String 
+Duration_convert::dur2_str( Duration dur )
+{
+       String str( dur.type_i_ );
+       str += String( '.', dur.dots_i_ );
+       if ( dur.plet_p_ )
+               str += String( "*" ) + String( dur.plet_p_->iso_i_ )
+                       + String( "/" ) + String( dur.plet_p_->type_i_ );
+       return str;
+}
+
+int
+Duration_convert::dur2_i( Duration dur, int division_1_i )
+{
+    return dur2_mom( dur ) * Moment( division_1_i );
+}
+
+Moment
+Duration_convert::dur2_mom( Duration dur )
+{
+       if ( !dur.type_i_ )
+               return 0;
+
+       Moment mom = Moment( 1 , dur.type_i_ );
+
+       Moment delta = mom;
+       while ( dur.dots_i_-- ) {
+               delta /= 2.0;
+               mom += delta;
+       }
+
+       return mom * plet_factor_mom( dur );    
+}
+
+Duration
+Duration_convert::mom2_dur( Moment mom )
+{
+       /* this is cute, 
+          but filling an array using Duration_iterator
+          might speed things up, a little
+          */
+       Duration_iterator iter_dur;
+       assert( iter_dur );
+       while ( iter_dur ) {
+               Duration lower_dur = iter_dur++;
+               Duration upper_dur( 0 );
+               if ( iter_dur )
+                       upper_dur = iter_dur();
+               Moment lower_mom = dur2_mom( lower_dur );
+               Moment upper_mom = dur2_mom( upper_dur );
+               if ( mom == lower_mom )
+                       return lower_dur;
+               if ( mom == upper_mom ) // don-t miss last (sic)
+                       return upper_dur;
+               if ( ( mom >= lower_mom ) && ( mom <= upper_mom ) ) {
+                       warning( String( "duration not exact: " ) + String( (Real)mom ) , 0 );
+                       if ( abs( mom - lower_mom ) < abs( mom - upper_mom ) )
+                               return lower_dur;
+                       else
+                               return upper_dur;
+               }
+               lower_dur = upper_dur;
+       }
+       return Duration( 0 );
+}
+
+Moment
+Duration_convert::plet_factor_mom( Duration dur )
+{
+       if ( !dur.plet_p_ )
+               return 1;
+       return Moment( dur.plet_p_->iso_i_, dur.plet_p_->type_i_ );
+}
+
+Real
+Duration_convert::sync_f( Duration dur, Moment mom )
+{
+       return mom / dur2_mom( dur );
+}
+
+Moment
+Duration_convert::i2_mom( int time_i, int division_1_i )
+{
+       if ( !time_i )
+               return Moment( 0 );
+
+       if ( division_1_i > 0 )
+               return Moment( time_i, division_1_i );
+       else 
+               return Moment( -division_1_i, time_i );
+}
+
+Duration_iterator::Duration_iterator()
+{
+       cursor_dur_.type_i_ = 128;
+       cursor_dur_.set_plet( 0 );
+}
+
+Duration 
+Duration_iterator::operator ++(int)
+{
+       return forward_dur();
+}
+
+Duration
+Duration_iterator::operator ()()
+{
+       return dur();
+}
+
+Duration_iterator::operator bool()
+{
+       return ok();
+}
+
+Duration
+Duration_iterator::dur()
+{
+       return cursor_dur_;
+}
+
+Duration
+Duration_iterator::forward_dur()
+{
+       // should do smart table? guessing: 
+       //      duration wholes
+       //      16      0.0625
+       //      32..    0.0703
+       //      8:2/3   0.0833
+       //      16.     0.0938
+       //      8       0.1250
+       //      16..    0.1406
+       //      4:2/3   0.1667
+       //      8.      0.1875
+
+       assert( ok() );
+
+       Duration dur = cursor_dur_;
+
+       if ( !cursor_dur_.dots_i_ && !cursor_dur_.plet_p_ ) {
+               cursor_dur_.type_i_ *= 2;
+               cursor_dur_.dots_i_ = 2;
+       }
+       else if ( cursor_dur_.dots_i_ == 2 ) {
+               assert( !cursor_dur_.plet_p_ );
+               cursor_dur_.dots_i_ = 0;
+               cursor_dur_.type_i_ /= 4;
+               cursor_dur_.set_plet( &Plet( 2, 3 ) );
+       }
+       else if ( cursor_dur_.plet_p_ 
+               && ( cursor_dur_.plet_p_->iso_i_ == 2 )
+               && ( cursor_dur_.plet_p_->type_i_ == 3 ) ) {
+               assert( !cursor_dur_.dots_i_ );
+               cursor_dur_.set_plet( 0 );
+               cursor_dur_.type_i_ *= 2;
+               cursor_dur_.dots_i_ = 1;
+       }
+       else if ( cursor_dur_.dots_i_ == 1 ) {
+               assert( !cursor_dur_.plet_p_ );
+               cursor_dur_.dots_i_ = 0;
+               cursor_dur_.type_i_ /= 2;
+       }
+               
+       // ugh
+       if ( no_triplets_bo_g && cursor_dur_.plet_p_ && ok() )
+               forward_dur();
+
+       return dur;
+}
+
+bool
+Duration_iterator::ok()
+{
+       return ( cursor_dur_.type_i_ 
+               && !( ( cursor_dur_.type_i_ == 1 ) && ( cursor_dur_.dots_i_ > 2 ) ) );
+}
index 2245c8dbe0136426257bf3f5419fbc6b2a57ea69..9e1a49683456786d793dbddb807d0655edd01715 100644 (file)
@@ -29,7 +29,7 @@ Input_file::Input_file(String s)
        else {
                Source_file* sourcefile_p = 0;
                // ugh, very dirty, need to go away
-               if ( ( pf.right( 3 ).lower() == "mid" ) || ( pf.right( 4 ).lower() == "midi" ) )
+               if ( ( pf.right_str( 3 ).lower_str() == "mid" ) || ( pf.right_str( 4 ).lower_str() == "midi" ) )
                    sourcefile_p = new Binary_source_file( pf );
                else
                    sourcefile_p = new Source_file( pf );
index 1e4e8488a558801ec27db128310198d0821c332c..6f72f7f2cce95883290829bebe82af920a6e89e3 100644 (file)
@@ -106,7 +106,7 @@ COMMENT             [%#].*\n
        return DOTS;
 }
 <notes>{INT}           {
-       yylval.i = String(YYText()).value();
+       yylval.i = String_convert::dec2_i( String( YYText() ) );
        return INT;
 }
 <notes>{COMMENT}       {
@@ -119,7 +119,7 @@ COMMENT             [%#].*\n
 }
 <notes>\"[^"]*\" {
        String s (YYText()+1);
-       s = s.left(s.len()-1);
+       s = s.left_str(s.length_i()-1);
        yylval.string = new String(s);
        return STRING;
 }
@@ -144,7 +144,7 @@ COMMENT             [%#].*\n
        return DOTS;
 }
 <lyrics>{INT}          {
-       yylval.i = String(YYText()).value();
+       yylval.i = String_convert::dec2_i( String( YYText() ) );
        return INT;
 }
 <lyrics>{NOTECOMMAND}  {
@@ -172,19 +172,19 @@ COMMENT           [%#].*\n
 }
 <lyrics>\"[^"]*\" {
        String s (YYText()+1);
-       s = s.left(s.len()-1);
+       s = s.left_str(s.length_i()-1);
        yylval.string = new String(s);
        return STRING;
 }
 <lyrics>{LYRICS} {
        String s (YYText()); 
        int i = 0;
-       while ((i=s.pos("_")) != 0) // change word binding "_" to " "
-               *(s.ch_l() + i - 1) = ' ';
-       if ((i=s.pos("\\,")) !=0)   // change "\," to TeX's "\c "
+       while ((i=s.index_i("_")) != -1) // change word binding "_" to " "
+               *(s.ch_l() + i) = ' ';
+       if ((i=s.index_i("\\,")) != -1)   // change "\," to TeX's "\c "
                {
-               *(s.ch_l() + i) = 'c';
-               s = s.left(i+1) + " " + s.right(s.len()-i-1);
+               *(s.ch_l() + i + 1) = 'c';
+               s = s.left_str(i+2) + " " + s.right_str(s.length_i()-i-2);
                }
        yylval.string = new String(s);
        return STRING;
@@ -221,8 +221,8 @@ include           {
 <incl>[ \t]*      { /* eat the whitespace */ }
 <incl>\"[^"]*\"+   { /* got the include file name */
    String s (YYText()+1);
-   s = s.left(s.len()-1);
-   defined_ch_c_l = here_ch_c_l() - String( YYText() ).len() - 1;
+   s = s.left_str(s.length_i()-1);
+   defined_ch_c_l = here_ch_c_l() - String( YYText() ).length_i() - 1;
    new_input(s);
    yy_pop_state();
 }
diff --git a/src/lily-stream.cc b/src/lily-stream.cc
new file mode 100644 (file)
index 0000000..2a4d4a4
--- /dev/null
@@ -0,0 +1,72 @@
+//
+// lily-stream.cc
+//
+// source file of the LilyPond music typesetter
+//
+// (c) 1997 Jan Nieuwenhuizen <jan@digicash.com>
+
+// should i be named Mudela_stream?
+
+#include <fstream.h>
+#include <time.h>
+
+#include "proto.hh"
+#include "plist.hh"
+#include "string.hh"
+
+#include "moment.hh"
+#include "sourcefile.hh"
+#include "source.hh"
+#include "midi-main.hh"    // *tors
+
+#include "duration.hh"
+#include "midi-event.hh"
+#include "lily-stream.hh"
+
+Lily_stream::Lily_stream( String filename_str )
+{
+       filename_str_ = filename_str;
+       os_p_ = 0;
+       open();
+       header();
+}
+
+Lily_stream::~Lily_stream()
+{
+       delete os_p_;
+}
+
+Lily_stream&
+Lily_stream::operator <<( String str )
+{
+       *os_p_ << str;
+       return *this;
+}
+
+Lily_stream&
+Lily_stream::operator <<( Midi_event& midi_event_r )
+{
+       midi_event_r.output_mudela( *this );
+       return *this;
+}
+
+void
+Lily_stream::header()
+{
+       *os_p_ << "% Creator: " << version_str() << "\n";
+       *os_p_ << "% Automatically generated, at ";
+       time_t t( time( 0 ) );
+       *os_p_ << ctime( &t );
+       *os_p_ << "% from input file: ";
+//     *os_p_ << midi_parser_l_g->
+       *os_p_ << "\n\n";    
+}
+
+void
+Lily_stream::open()
+{
+       os_p_ = new ofstream( filename_str_ );
+       if ( !*os_p_ )
+               error ( "can't open `" + filename_str_ + "\'", 0 );
+}
+
index 30f49e5bf4b71bc17a8afe13841a3bf4cc5a744f..b35c86676158e8617b4c63c18636e5709c85348d 100644 (file)
@@ -23,6 +23,6 @@ Lyric_item::do_pre_processing()
     // override Text_item
 
     // test context-error
-    if ( tdef_l_->text_str_.pos( "Gates" ) )// :-)
+    if ( tdef_l_->text_str_.index_i( "Gates" ) )// :-)
        warning( "foul word", tdef_l_->defined_ch_c_l_ );
 }
index 55a5129055fece4b9cdfcd598ce1a47f1e0f0496..450545ab253dda4d13f201faf307b746e6acbebc 100644 (file)
@@ -18,7 +18,7 @@ extern void parse_file(String,String);
 
 
 void
-destill_inname( String &inName);
+destill_inname( String &name_str_r);
 long_option_init theopts[] = {
     1, "output", 'o',
     0, "warranty", 'w',
@@ -147,20 +147,20 @@ find_file(String f)
 
 /// make input file name: add default extension. "" is stdin.
 void
-destill_inname( String &inName)
+destill_inname( String &name_str_r)
 {
-    if ( inName.len() )
+    if ( name_str_r.length_i() )
         {
-        if( inName[ 0 ] != '-' ) 
+        if( name_str_r[ 0 ] != '-' ) 
            {
            String a,b,c,d;
-           split_path(inName,a,b,c,d);
+           split_path(name_str_r,a,b,c,d);
 
            // add extension if not present.
            if (d == "") 
                d = ".ly";
-           inName = a+b+c+d;
+           name_str_r = a+b+c+d;
            }
-       } else inName = "";   
+       } else name_str_r = "";   
 }
 
index dfbafd5fbf6eb688de5a0770a13953404a59183c..49f74ead0e613500845a0870495381cb11a45d03 100644 (file)
@@ -89,14 +89,14 @@ SSME                [\0x7f][\x03]
 }
 {INT8} {
        error( String( "top level: illegal byte: " )
-               + StringConversion::bin2hex_str( String( *YYText() ) ) );
+               + String_convert::bin2hex_str( String( *YYText() ) ) );
        exit( 1 );
 }
 <int32>{INT32} {
        dtor << "lex: int32" << endl;
        assert( YYLeng() == 4 );
        String str( (Byte const*)YYText(), YYLeng() );
-       yylval.i = StringConversion::bin2int_i( str );
+       yylval.i = String_convert::bin2_i( str );
        yy_pop_state();
        return INT32;
 }
@@ -104,7 +104,7 @@ SSME                [\0x7f][\x03]
        dtor << "lex: int16" << endl;
        assert( YYLeng() == 2 );
        String str( (Byte const*)YYText(), YYLeng() );
-       yylval.i = StringConversion::bin2int_i( str );
+       yylval.i = String_convert::bin2_i( str );
        yy_pop_state();
        return INT16;
 }
@@ -119,16 +119,16 @@ SSME              [\0x7f][\x03]
 
 <track>{VARINT} {
        String str( (Byte const*)YYText(), YYLeng() );
-       yylval.i = My_midi_lexer::varint2int_i( str );
+       yylval.i = My_midi_lexer::varint2_i( str );
        dtor << String( "lex: track: varint(" ) 
                + String( yylval.i ) + "): "
-               + StringConversion::bin2hex_str( str ) << endl;
+               + String_convert::bin2hex_str( str ) << endl;
        yy_push_state( event ); 
        return VARINT;
 }
 <track>{INT8}  {
        error( String( "track: illegal byte: " ) 
-               + StringConversion::bin2hex_str( String( *YYText() ) ) );
+               + String_convert::bin2hex_str( String( *YYText() ) ) );
        exit( 1 );
 }
 <event>{RUNNING_STATUS}        {
@@ -240,7 +240,7 @@ SSME                [\0x7f][\x03]
 }
 <event>{INT8}  {
        error( String( "event: illegal byte: " ) 
-               + StringConversion::bin2hex_str( String( *YYText() ) ) );
+               + String_convert::bin2hex_str( String( *YYText() ) ) );
        exit( 1 );
 }
 <meta_event>{SEQUENCE} {       // ssss sequence number
@@ -353,7 +353,7 @@ SSME                [\0x7f][\x03]
 }
 <meta_event>{INT8} {
        warning( String( "meta_event: unimplemented event: " )
-               + StringConversion::bin2hex_str( String( *YYText() ) ),
+               + String_convert::bin2hex_str( String( *YYText() ) ),
                *this->here_ch_c_l() );
        yy_pop_state();
        yy_pop_state();
@@ -365,7 +365,7 @@ SSME                [\0x7f][\x03]
 <data>{VARINT} {
        dtor << "lex: data" << endl;
        String str( (Byte const*)YYText(), YYLeng() );
-       int i = My_midi_lexer::varint2int_i( str );
+       int i = My_midi_lexer::varint2_i( str );
        String* str_p = new String;
        while ( i-- )
                *str_p += (char)yyinput();
@@ -375,7 +375,7 @@ SSME                [\0x7f][\x03]
 }
 <data>{INT8}   {
        error( String( "data: illegal byte: " )
-               + StringConversion::bin2hex_str( String( *YYText() ) ) );
+               + String_convert::bin2hex_str( String( *YYText() ) ) );
        exit( 1 );
 }
 
index 5b6ecb3e2d73c4d68ea8fe599286d2b68e3eecd6..5dfdf64662bf89b11c4a23ebca8d8b1881ecee09 100644 (file)
@@ -5,6 +5,7 @@
 // copyright 1997 Jan Nieuwenhuizen <jan@digicash.com>
 
 #include <iostream.h>
+#include <limits.h>
 #include "proto.hh"
 #include "plist.hh"
 #include "version.hh"
@@ -15,6 +16,7 @@
 #include "sourcefile.hh"
 #include "midi-main.hh"
 #include "moment.hh"
+#include "duration.hh"
 #include "midi-event.hh"
 #include "midi-track.hh"
 #include "my-midi-lexer.hh"
@@ -25,6 +27,9 @@ Source* source_l_g = &source;
 
 Verbose level_ver = NORMAL_ver;
 
+// ugh
+bool no_triplets_bo_g = false;
+
 //ugh
 char const* defined_ch_c_l = 0;
 
@@ -76,9 +81,10 @@ help()
 {
     btor <<
        "--debug, -d            be really verbose\n"
-       "--help, -h             This help\n"
-        "--include, -I         add to file search path.\n"
-       "--output, -o           set default output\n"
+       "--help, -h             this help\n"
+        "--include=DIR, -I DIR add DIR to search path\n"
+        "--no-triplets, -n     assume no triplets\n"
+       "--output=FILE, -o FILE set FILE as default output\n"
        "--quiet, -q            be quiet\n"
        "--verbose, -v          be verbose\n"
        "--warranty, -w         show warranty & copyright\n"
@@ -88,8 +94,7 @@ help()
 void
 identify()
 {
-       mtor << "This is m2m "  << VERSIONSTR << "/FlowerLib " << FVERSIONSTR
-               << " of " << __DATE__ << " " << __TIME__ << endl;
+       mtor << version_str() << endl;
 }
     
 void 
@@ -119,6 +124,15 @@ notice()
        "USA.\n";
 }
 
+// should simply have Root class...
+String
+version_str()
+{
+       return String ( "This is m2m " ) + VERSIONSTR 
+               + "/FlowerLib " + FVERSIONSTR
+               + " of " +  __DATE__ + " " + __TIME__;
+}
+
 int
 main( int argc_i, char* argv_sz_a[] )
 {
@@ -126,6 +140,7 @@ main( int argc_i, char* argv_sz_a[] )
                0, "debug", 'd',
                0, "help", 'h',
 //             1, "include", 'I',
+               0, "no-triplets", 'n',
                1, "output", 'o',
                0, "quiet", 'q',
                0, "verbose", 'v',
@@ -148,6 +163,9 @@ main( int argc_i, char* argv_sz_a[] )
 //                     case 'I':
 //                             path->push( getopt_long.optarg );
 //                             break;
+                       case 'n':
+                               no_triplets_bo_g = true;
+                               break;
                        case 'o':
                                output_str = getopt_long.optarg;
                                break;
@@ -172,7 +190,14 @@ main( int argc_i, char* argv_sz_a[] )
                int error_i = midi_parser.parse();
                if ( error_i )
                        return error_i;
-               error_i = midi_parser.output( output_str );
+               if ( !output_str.length_i() ) {
+                       output_str = String( arg_sz ) + ".ly";
+                       // i-m sure there-s already some routine for this
+                       int name_i; // too bad we can-t declare local to if
+                       if ( ( name_i = output_str.index_last_i( '/' ) ) != -1 )
+                               output_str = output_str.mid_str( name_i + 1, INT_MAX );
+               }
+               error_i = midi_parser.output_mudela( output_str );
                if ( error_i )
                        return error_i;
        }
index 56680f4b773771ded5de455f35f97e4beab3d1cd..466b5c58d53abb7fe68d521031dffc759b162c1a 100644 (file)
@@ -12,6 +12,7 @@
 #include "my-midi-lexer.hh"
 #include "my-midi-parser.hh"
 #include "moment.hh"
+#include "duration.hh"
 #include "midi-event.hh"
 #include "midi-track.hh"
 #include "midi-score.hh"
@@ -20,6 +21,9 @@
 #define YYDEBUG 1
 #endif
 
+//ugh
+static track_i = 0;
+
 %}
 
 %union {
@@ -61,6 +65,7 @@
 midi:  /* empty */
        | midi midi_score {
                midi_parser_l_g->add_score( $2 );               
+               track_i = 0;
        }
        ;
 
@@ -69,34 +74,31 @@ midi_score:
        }
        | midi_score track {
                $$->add_track( $2 );
+               midi_parser_l_g->reset();
        }
        ;
 
 header:        
        HEADER INT32 INT16 INT16 INT16 {
                $$ = new Midi_score( $3, $4, $5 );
-               midi_parser_l_g->set_division( $5 );
+               midi_parser_l_g->set_division_4( $5 );
        }
        ;
 
 track: 
        TRACK INT32 {
-               $$ = new Midi_track;
+               $$ = new Midi_track( track_i++ );
        }
        | track event {
-               $$->add_event( $2 );
+               $$->add_event( midi_parser_l_g->mom(), $2 );
        }
        ;
 
 event: 
        varint the_event {
-               if ( $2 && $2->mudela_str().length_i() ) {
-                       if ( ( $2->mudela_str()[ 0 ] >= 'a' ) 
-                               && $2->mudela_str()[ 0 ] <= 'g' ) 
-                               qtor << $2->mudela_str() << " ";
-                       else
-                               vtor << $2->mudela_str() << " ";
-               }
+               $$ = $2;
+               if ( $2 && $2->mudela_str().length_i() )
+                       dtor << $2->mudela_str() << " " << flush;
        }
        ;
        
@@ -130,7 +132,7 @@ the_meta_event:
        }
        | text_event DATA {
                $$ = 0;
-               vtor << *$2 << endl;
+               dtor << *$2 << endl;
                delete $2;
        }
        | END_OF_TRACK {
@@ -138,7 +140,7 @@ the_meta_event:
        }
        | TEMPO INT8 INT8 INT8 { 
                $$ = new Midi_tempo( ( $2 << 16 ) + ( $3 << 8 ) + $4 );
-               vtor << $$->mudela_str() << endl; // ?? waai not at event:
+               dtor << $$->mudela_str() << endl; // ?? waai not at event:
                midi_parser_l_g->set_tempo( ( $2 << 16 ) + ( $3 << 8 ) + $4 );
        }
        | SMPTE_OFFSET INT8 INT8 INT8 INT8 INT8 { 
@@ -146,7 +148,7 @@ the_meta_event:
        }
        | TIME INT8 INT8 INT8 INT8 { 
                $$ = new Midi_time( $2, $3, $4, $5 );
-               vtor << $$->mudela_str() << endl; // ?? waai not at event:
+               dtor << $$->mudela_str() << endl; // ?? waai not at event:
                midi_parser_l_g->set_time( $2, $3, $4, $5 );
        }
        | KEY INT8 INT8 { 
@@ -161,25 +163,25 @@ the_meta_event:
 
 text_event: 
        TEXT {
-               vtor << endl << "Text: ";
+               dtor << "\n% Text: ";
        }
        | COPYRIGHT {
-               vtor << endl << "Copyright: ";
+               dtor << "\n% Copyright: ";
        }
        | TRACK_NAME {
-               vtor << endl << "Track  name: ";
+               dtor << "\n% Track  name: ";
        }
        | INSTRUMENT_NAME {
-               vtor << endl << "Instrument  name: ";
+               dtor << "\n% Instrument  name: ";
        }
        | LYRIC {
-               vtor << endl << "Lyric: ";
+               dtor << "\n% Lyric: ";
        }
        | MARKER {
-               vtor << endl << "Marker: ";
+               dtor << "\n% Marker: ";
        }
        | CUE_POINT {
-               vtor << endl << "Cue point: ";
+               dtor << "\n% Cue point: ";
        }
        ;
 
index 02a79a542d022861b52e65cc71729672d945081d..f24f9093d1178d43125eda84c589e7d04fdecddf 100644 (file)
@@ -4,6 +4,16 @@
 // copyright 1997 Jan Nieuwenhuizen <jan@digicash.com>
 
 #include "proto.hh"
+#include "plist.hh"
+#include "string.hh"
+#include "moment.hh"
+#include "duration.hh"
+#include "sourcefile.hh"
+#include "source.hh"
+#include "midi-main.hh"    // *tors
+#include "midi-event.hh"
+#include "lily-stream.hh"
+#include "track-column.hh"
 #include "midi-track.hh"
 #include "midi-score.hh"
 
@@ -21,4 +31,33 @@ Midi_score::~Midi_score()
 void
 Midi_score::add_track( Midi_track* midi_track_p )
 {
+       midi_track_p_list_.bottom().add( midi_track_p );
 }
+
+int
+Midi_score::output_mudela( String filename_str )
+{
+       mtor << "Lily output to " << filename_str << " ..." << endl;
+
+       Lily_stream lily_stream( filename_str );
+       for ( PCursor<Midi_track*> midi_track_l_pcur( midi_track_p_list_.top() ); midi_track_l_pcur.ok(); midi_track_l_pcur++ ) {
+               midi_track_l_pcur->output_mudela( lily_stream );
+               lily_stream << "\n";
+       }
+
+       lily_stream << "score {\n";
+
+       for ( PCursor<Midi_track*> midi_track_l_pcur( midi_track_p_list_.top() ); midi_track_l_pcur.ok(); midi_track_l_pcur++ ) {
+               lily_stream << "\tstaff { melodic music { ";
+               lily_stream << midi_track_l_pcur->name_str();
+               lily_stream << " } }\n";
+       }
+
+       lily_stream << "\tcommands { meter { 4*4 } }\n";
+       lily_stream << "\tmidi { tempo 4:60 }\n";
+
+       lily_stream << "}\n";
+
+       return 0;
+}
+
index 02315c320b21f49a782b90723a4ab20fcc4f1844..c4caa838b4d28bf2fdf7f1af29bfa5411145a7bd 100644 (file)
@@ -16,4 +16,14 @@ class ostream;
 #include "string.hh"
 #include "sourcefile.hh"
 
+#include "moment.hh"
+#include "duration.hh"
+#include "midi-event.hh"
+#include "lily-stream.hh"
+#include "track-column.hh"
+#include "midi-track.hh"
+
+IPL_instantiate(Midi_event);
+IPL_instantiate(Midi_track);
 IPL_instantiate(Source_file);
+IPL_instantiate(Track_column);
index 77abf04e1c8f76e3e779da579dd091da9bf9e98d..99bd9dee8c1d80f327e3ed2bafaef313c09b6b78 100644 (file)
@@ -4,13 +4,23 @@
 // copyright 1997 Jan Nieuwenhuizen <jan@digicash.com>
 
 #include "proto.hh"
+#include "plist.hh"
 #include "string.hh"
+#include "sourcefile.hh"
+#include "source.hh"
+#include "midi-main.hh"    // *tors
+
 #include "moment.hh"
+#include "duration.hh"
 #include "midi-event.hh"
+#include "lily-stream.hh"
+#include "track-column.hh"
 #include "midi-track.hh"
 
-Midi_track::Midi_track()
+Midi_track::Midi_track( int track_i )
 {
+       name_str_ = String( "track" ) + String( track_i );
+       tcol_p_list_.bottom().add( new Track_column( Moment( 0 ) ) );
 }
 
 Midi_track::~Midi_track()
@@ -18,6 +28,57 @@ Midi_track::~Midi_track()
 }
 
 void
-Midi_track::add_event( Midi_event* midi_event_p )
+Midi_track::add_event( Moment mom, Midi_event* midi_event_p )
+{
+       if ( ! midi_event_p )
+               return;
+       tcol_l( mom - midi_event_p->mom() )->add_event( midi_event_p );
+}
+
+// too much red tape ?
+String
+Midi_track::name_str()
+{
+       return name_str_;
+}
+
+void
+Midi_track::output_mudela( Lily_stream& lily_stream_r )
 {
+       lily_stream_r << name_str_ << " = music { $\n";
+       lily_stream_r << "\t";
+       int column_i = 8;
+
+       for ( PCursor<Track_column*> tcol_l_pcur( tcol_p_list_.top() ); tcol_l_pcur.ok(); tcol_l_pcur++ ) {
+               if ( tcol_l_pcur->midi_event_p_list_.size() > 1 )
+                       warning( "oeps, chord: can-t do that yet", 0 );
+               if ( !tcol_l_pcur->midi_event_p_list_.size() )
+                       continue;
+               lily_stream_r << **tcol_l_pcur->midi_event_p_list_.top();
+               column_i += tcol_l_pcur->midi_event_p_list_.top()->mudela_str().length_i();
+               if ( column_i > 40 ) {
+                       lily_stream_r << "\n\t";
+                       column_i = 8;
+               }
+       }
+       lily_stream_r << "\n$} % " << name_str_ << "\n";
 }
+
+Track_column*
+Midi_track::tcol_l( Moment mom )
+{
+       for ( PCursor<Track_column*> tcol_l_pcur( tcol_p_list_.top() ); tcol_l_pcur.ok(); tcol_l_pcur++ ) {
+               if ( tcol_l_pcur->mom() == mom )
+                       return *tcol_l_pcur;
+               if ( tcol_l_pcur->mom() > mom ) {
+                       Track_column* tcol_p = new Track_column( mom );
+                       tcol_l_pcur.insert( tcol_p );
+                       return tcol_p;
+               }
+       }
+
+       Track_column* tcol_p = new Track_column( mom );
+       tcol_p_list_.bottom().add( tcol_p );
+       return tcol_p;
+}
+
index 0ce9ead5e0357c58e14db154da7c888642e239a6..c57f9ff5de70d8e545aa3651b9efa168bc99d68d 100644 (file)
@@ -38,8 +38,8 @@ String
 Midi_chunk::str()
 {
     String str = header_str_;
-    String length_str = StringConversion::int2hex_str( data_str_.length_i() + footer_str_.length_i(), 8, '0' );
-    length_str = StringConversion::hex2bin_str( length_str );
+    String length_str = String_convert::i2hex_str( data_str_.length_i() + footer_str_.length_i(), 8, '0' );
+    length_str = String_convert::hex2bin_str( length_str );
     str += length_str;
     str += data_str_;
     str += footer_str_;
@@ -61,20 +61,20 @@ Midi_header::Midi_header( int format_i, int tracks_i, int clocks_per_4_i )
 {
     String str;
        
-    String format_str = StringConversion::int2hex_str( format_i, 4, '0' );
-    str += StringConversion::hex2bin_str( format_str );
+    String format_str = String_convert::i2hex_str( format_i, 4, '0' );
+    str += String_convert::hex2bin_str( format_str );
        
-    String tracks_str = StringConversion::int2hex_str( tracks_i, 4, '0' );
-    str += StringConversion::hex2bin_str( tracks_str );
+    String tracks_str = String_convert::i2hex_str( tracks_i, 4, '0' );
+    str += String_convert::hex2bin_str( tracks_str );
 
-    String tempo_str = StringConversion::int2hex_str( clocks_per_4_i, 4, '0' );
-    str += StringConversion::hex2bin_str( tempo_str );
+    String tempo_str = String_convert::i2hex_str( clocks_per_4_i, 4, '0' );
+    str += String_convert::hex2bin_str( tempo_str );
 
     set( "MThd", str, "" );
 }
 
 String
-Midi_item::int2varlength_str( int i )
+Midi_item::i2varint_str( int i )
 {
     int buffer_i = i & 0x7f;
     while ( (i >>= 7) > 0 ) {
@@ -136,8 +136,8 @@ Midi_tempo::str()
 {
     int useconds_per_4_i = 60 * (int)1e6 / tempo_i_;
     String str = "ff5103";
-    str += StringConversion::int2hex_str( useconds_per_4_i, 6, '0' );
-    return StringConversion::hex2bin_str( str );
+    str += String_convert::i2hex_str( useconds_per_4_i, 6, '0' );
+    return String_convert::hex2bin_str( str );
 }
 
 Midi_track::Midi_track( int number_i )
@@ -169,10 +169,10 @@ Midi_track::Midi_track( int number_i )
 
     String data_str;
     // only for format 0 (currently using format 1)?
-    data_str += StringConversion::hex2bin_str( data_ch_c_l );
+    data_str += String_convert::hex2bin_str( data_ch_c_l );
 
     char const* footer_ch_c_l = "00" "ff2f" "00";
-    String footer_str = StringConversion::hex2bin_str( footer_ch_c_l );
+    String footer_str = String_convert::hex2bin_str( footer_ch_c_l );
 
     set( "MTrk", data_str, footer_str );
 }
@@ -181,13 +181,14 @@ void
 Midi_track::add( int delta_time_i, String event_str )
 {
     assert(delta_time_i >= 0);
-    Midi_chunk::add( int2varlength_str( delta_time_i ) + event_str );
+    Midi_chunk::add( i2varint_str( delta_time_i ) + event_str );
 }
 
 void 
 Midi_track::add( Moment delta_time_moment, Midi_item* mitem_l )
 {
     // use convention of 384 clocks per 4
+    // use Duration_convert
     int delta_time_i = delta_time_moment * Moment( 384 ) / Moment( 1, 4 );
     add( delta_time_i, mitem_l->str() );
 }
index 84b105d27dc823282b1d3e3ef6c6c56dc83dca14..f561e0b946bf0659ffb6a48c56cf6a3e2d4b5f69 100644 (file)
@@ -18,6 +18,7 @@ Midi_stream::Midi_stream( String filename_str, int tracks_i, int clocks_per_4_i
     filename_str_ = filename_str;
     tracks_i_ = tracks_i;
     clocks_per_4_i_ = clocks_per_4_i;
+    os_p_ = 0;
     open();
     header();
 }
@@ -32,7 +33,7 @@ Midi_stream::operator <<( String str )
 {
     // still debugging...
     if ( check_debug )
-       str = StringConversion::bin2hex_str( str );
+       str = String_convert::bin2hex_str( str );
     // string now 1.0.26-2 handles binary streaming
     *os_p_ << str;
     return *this;
@@ -51,7 +52,7 @@ Midi_stream&
 Midi_stream::operator <<( int i )
 {
     // output binary string ourselves
-    *this << Midi_item::int2varlength_str( i );
+    *this << Midi_item::i2varint_str( i );
     return *this;
 }
 
@@ -71,7 +72,7 @@ Midi_stream::header()
 //                00 60   96 per quarter-note
 
 //    char const ch_c_l = "0000" "0006" "0001" "0001" "0060";
-//    str += StringConversion::hex2bin_str( ch_c_l );
+//    str += String_convert::hex2bin_str( ch_c_l );
 //    *os_p_ << str;
 
 //      *this << Midi_header( 1, 1, tempo_i_ );
index a070992f534f0dfab6435eaa178e8d8ecd610b21..c261e5c503c9d7c1d4f2815752cbbf05c4c5fd4b 100644 (file)
@@ -57,7 +57,7 @@ My_midi_lexer::here_ch_c_l()
 }
 
 int
-My_midi_lexer::varint2int_i( String str )
+My_midi_lexer::varint2_i( String str )
 {
         int var_i = 0;
 
@@ -68,7 +68,7 @@ My_midi_lexer::varint2int_i( String str )
                if ( ! ( byte & 0x80 ) )
                        return var_i;
        }
-       cout << "\nvarint2int:" << StringConversion::bin2hex_str( str ) << endl;
+       cout << "\nvarint2_i:" << String_convert::bin2hex_str( str ) << endl;
        assert( 0 ); // illegal varint
        return 0;
 }
index cd12082239c7e3bdb33b0751eb756b9c2e0044fa..62f4d499c888d0b973b0d518a923933b03eb0edf 100644 (file)
 
 #include "my-midi-lexer.hh"
 #include "my-midi-parser.hh"
+#include "duration.hh"
 #include "midi-event.hh"
+#include "lily-stream.hh"
+#include "track-column.hh"
+#include "midi-track.hh"
+#include "midi-score.hh"
 #include "my-midi-lexer.hh"
 #include "my-midi-parser.hh"
 
@@ -30,21 +35,32 @@ My_midi_parser::My_midi_parser( String filename_str )
 {
        midi_lexer_p_ = new My_midi_lexer( filename_str );
        midi_parser_l_g = this;
+       defined_ch_c_l_ = 0;
+       fatal_error_i_ = 0;
+       midi_key_p_ = 0;
+       midi_score_p_ = 0;
+       midi_tempo_p_ = 0;
+       midi_time_p_ = 0;
+       reset();
+}
 
+void
+My_midi_parser::reset()
+{
+       delete midi_key_p_;
        midi_key_p_ = new Midi_key( 0, 0 );
-//     midi_tempo_p_ = new Midi_tempo( 384 ); // wiellie dunno!
-       // 07A120 == 500000
-       midi_tempo_p_ = new Midi_tempo( 0x07a120 ); // wiellie dunno!
-       midi_time_p_ = new Midi_time( 4, 4, 0x24, 8 );
+       // useconds per 4: 250000 === 60 4 per minute
+       delete midi_tempo_p_;
+       midi_tempo_p_ = new Midi_tempo( 250000 );
+       delete midi_time_p_;
+       midi_time_p_ = new Midi_time( 4, 4, 384, 8 );
 
-       defined_ch_c_l_ = 0;
-       fatal_error_i_ = 0;
-       now_f_ = 0;
-       step_f_ = 0;
+       now_i64_ = 0;
 
        for ( int i = 0; i < CHANNELS_i; i++ )
                for ( int j = 0; j < PITCHES_i; j++ )
-                       running_f_f_a_[ i ][ j ] = 0;
+//                     running_i64_i64_a_[ i ][ j ] = -1;
+                       running_i64_i64_a_[ i ][ j ] = 0;
 }
 
 My_midi_parser::~My_midi_parser()
@@ -54,13 +70,14 @@ My_midi_parser::~My_midi_parser()
        delete midi_key_p_;
        delete midi_tempo_p_;
        delete midi_time_p_;
+       delete midi_score_p_;
 }
 
 void
 My_midi_parser::add_score( Midi_score* midi_score_p )
 {
-       midi_score_p_array_.push( midi_score_p );
-       cout << endl;
+       assert( !midi_score_p_ );
+       midi_score_p_ = midi_score_p;
 }
 
 void
@@ -73,36 +90,41 @@ My_midi_parser::error( char const* sz_l )
 }
 
 void
-My_midi_parser::forward( Real f )
+My_midi_parser::forward( int i )
+{
+       now_i64_ += i;
+}
+
+Moment
+My_midi_parser::mom()
 {
-       // ugh
-       if ( f )
-               step_f_ = f;
-       now_f_ += step_f_;
+       return Duration_convert::i2_mom( now_i64_, division_1_i_ );
 }
 
 void
 My_midi_parser::note_begin( int channel_i, int pitch_i, int dyn_i )
 {
        // one pitch a channel at time!
-       //  heu, what if start at t = 0?
-//     assert( !running_f_f_a_[ channel_i ][ pitch_i ] );
-       running_f_f_a_[ channel_i ][ pitch_i ] = now_f_;
+       // heu, what about { < c2 >  < c4 d4 > }
+//     assert( running_i64_i64_a_[ channel_i ][ pitch_i ]  == -1 );
+       running_i64_i64_a_[ channel_i ][ pitch_i ] = now_i64_;
 }
 
 Midi_event*
 My_midi_parser::note_end_midi_event_p( int channel_i, int pitch_i, int dyn_i )
 {
-       Real start_f = running_f_f_a_[ channel_i ] [ pitch_i ];
-       // did we start? -> heu, don-t know: what if start at t = 0?
-//     assert( start_f ); 
-       return new Midi_note( midi_key_p_, midi_time_p_, clocks_per_whole_i_, pitch_i, now_f_ - start_f );
+       Int64 start_i64 = running_i64_i64_a_[ channel_i ][ pitch_i ];
+//     running_i64_i64_a_[ channel_i ][ pitch_i ] = -1;
+       // did we start?
+//     assert( start_i64 != -1 ); 
+       return new Midi_note( midi_key_p_, midi_time_p_, division_1_i_, pitch_i, now_i64_ - start_i64 );
 }
 
 int
-My_midi_parser::output( String filename_str )
+My_midi_parser::output_mudela( String filename_str )
 {
-       return 0;
+       assert( midi_score_p_ );
+       return midi_score_p_->output_mudela( filename_str );
 }
 
 int
@@ -112,10 +134,10 @@ My_midi_parser::parse()
 }
 
 void
-My_midi_parser::set_division( int clocks_per_4_i )
+My_midi_parser::set_division_4( int division_4_i )
 {
-       clocks_per_whole_i_ = clocks_per_4_i * 4;
-       if ( clocks_per_4_i < 0 )
+       division_1_i_ = division_4_i * 4;
+       if ( division_4_i < 0 )
                warning( "seconds iso metrical time" , 0 );
 }
 
index a02c323ea35bb7288ecd06c61d6b90e337000278..10c395759c321aca3a14b76270134301641eb4b3 100644 (file)
@@ -60,7 +60,7 @@ static Keyword_ent the_key_tab[]={
 int
 My_flex_lexer::ret_notename(int *p, String text, int octave_mod)
 {
-    text.lower();
+    text = text.lower_str();
     char const* ch_c_l = here_ch_c_l();
     if ( ch_c_l ) {
        ch_c_l--;
index 95a7d8313d5a6fc831479e2790426bd81ecc4945..0f7eb8e85fb70e14b760bf0585bc9cf1871ab63e 100644 (file)
@@ -25,7 +25,7 @@ bool last_duration_mode = false;
 void
 set_duration_mode(String s)
 {
-    s.upper();
+    s = s.upper_str();
     last_duration_mode = (s== "LAST");
 }
 
index bce34a85756606da6c08552b54c9fb55b7a94190..991be88550463031a76447cc13eae7a34daba4c9 100644 (file)
@@ -101,12 +101,12 @@ Melodic_req::height() const
 /*
  should be settable from input to allow "viola"-mode
  */
-static Byte pitch_by_a[ 7 ] = { 0, 2, 4, 5, 7, 9, 11 };        
+static Byte pitch_byte_a[ 7 ] = { 0, 2, 4, 5, 7, 9, 11 };      
 
 int
 Melodic_req::pitch() const
 {
-    return  pitch_by_a[ notename_i_ % 7 ] + accidental_i_ + octave_i_ * 12;
+    return  pitch_byte_a[ notename_i_ % 7 ] + accidental_i_ + octave_i_ * 12;
 }
 
 Plet_req::Plet_req()
index db87b6baf1d6583cca20c0e46e2b53a0537a8134..a98a8a9926850cbac6cd8fbb5b529b13767eb575 100644 (file)
@@ -57,7 +57,7 @@ Script::support_height() const return r;
 }
 
 void
-Script::set_default_pos()
+Script::set_default_index()
 {
     Real inter_f= paper()->internote();
     Interval dy = symbol().dim.y;
@@ -115,7 +115,7 @@ Script::do_pre_processing()
 void
 Script::do_post_processing()
 {
-    set_default_pos();
+    set_default_index();
 }
 
 Molecule*
index eac2b1f84a6454385608c7c65be96c356e9d06f2..5caa8545fa3ed86d8a4a678745e2de7f125a03da 100644 (file)
@@ -104,10 +104,10 @@ Source_file::error_str( char const* pos_ch_c_l )
        else
            error_col_i++;
 
-    String str = line_str.left( pos_ch_c_l - begin_ch_c_l ) 
+    String str = line_str.left_str( pos_ch_c_l - begin_ch_c_l ) 
        + String( '\n' )
        + String( ' ', error_col_i ) 
-       + line_str.mid( pos_ch_c_l - begin_ch_c_l + 1, INT_MAX ); // String::mid should take 0 arg..
+       + line_str.mid_str( pos_ch_c_l - begin_ch_c_l + 1, INT_MAX ); // String::mid should take 0 arg..
     return str;
 }
 
index 22123356c682a3fda6b912dc36aec5b4ca1c0316..e9a4f943bf43140bbc785befb810365711b6368e 100644 (file)
@@ -186,7 +186,7 @@ Stem::brew_molecule_p()const return out;
 }
 
 Real
-Stem::hpos()const
+Stem::hindex()const
 {
     return pcol_l_->hpos + stem_xoffset; // hmm.  + offset_.x;
 }
index 1a5c4a08c57d7b815e327edc08216129834e7942..d7f1162d29bb2a871a209acc904eb89b83f77887 100644 (file)
@@ -14,10 +14,10 @@ vstrut(Real h)
 static void
 substitute_arg(String& r, String arg)
 {
-    int p = r.pos('%');
+    int p = r.index_i('%');
     if (!p ) return ;
     else p--;
-    r = r.left(p) + arg + r.right(r.len() - p -1);
+    r = r.left_str(p) + arg + r.right_str(r.length_i() - p -1);
 }
 
 
@@ -27,7 +27,7 @@ substitute_args(String source, Array<String> args)
     String retval (source);
     for (int i = 0 ; i < args.size(); i++)
         substitute_arg(retval, args[i]);
-    while (retval.pos('%'))
+    while (retval.index_i('%'))
         substitute_arg(retval, "");
     return retval;
 }
index 110e95e3bfe166488c9d84f0f91044be5375cac7..56fb8e054b80d74c21590ed23a439abe0d491c37 100644 (file)
@@ -17,7 +17,7 @@ Text_item::Text_item(Text_req* treq_l, int staffsize_i)
 }
 
 void
-Text_item::set_default_pos()
+Text_item::set_default_index()
 {
     pos_i_  = (dir_i_ > 0) ? staffsize_i_ + 2: -4;
 }
@@ -25,7 +25,7 @@ Text_item::set_default_pos()
 void
 Text_item::do_pre_processing()
 {
-    set_default_pos();
+    set_default_index();
 }
 
     
diff --git a/src/track-column.cc b/src/track-column.cc
new file mode 100644 (file)
index 0000000..22a8283
--- /dev/null
@@ -0,0 +1,35 @@
+//
+// track-column.cc -- implement Track_column
+//
+// copyright 1997 Jan Nieuwenhuizen <jan@digicash.com>
+
+#include "proto.hh"
+#include "plist.hh"
+#include "string.hh"
+#include "moment.hh"
+#include "duration.hh"
+#include "midi-event.hh"
+#include "lily-stream.hh"
+#include "track-column.hh"
+#include "midi-track.hh"
+
+Track_column::Track_column( Moment mom )
+{
+       mom_ = mom;
+}
+
+Track_column::~Track_column()
+{
+}
+
+void 
+Track_column::add_event( Midi_event* midi_event_p )
+{
+       midi_event_p_list_.bottom().add( midi_event_p );
+}
+
+Moment
+Track_column::mom()
+{
+       return mom_;
+}