sub
do_init
{
- $MAILADRESS=$ENV{MAILADRESS};
+ $MAILADDRESS=$ENV{MAILADDRESS};
@pw=(getpwuid($<));
$username=$pw[6];
source file of $PROJECT
- (c) 1997 $username <$MAILADRESS>
+ (c) 1997 $username <$MAILADDRESS>
*/\n";
print $headstr;
}
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);
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
}
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 ) )
}
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;
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 //
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 );
{
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
{
#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)
{
return f_p;
}
-Sources::Sources()
-{
- path_C_= 0;
- binary_b_ = false;
-}
-
void
Sources::add( Source_file* sourcefile_p )
{
return 0;
}
-Sources::~Sources()
-{}
public:
REQUESTMETHODS(Timing_req, timing);
virtual Tempo_req * tempo(){return 0; }
- Tempo_req();
};
-include /dev/null $(DEPFILES)
#
localclean:
- rm -f $(outdir)/{midi-parser,midi-lexer}.*
+# obsoliet
+# rm -f $(outdir)/{midi-parser,midi-lexer}.*
localinstall: installexe
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
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*>
MAJOR_VERSION = 0
MINOR_VERSION = 0
-PATCH_LEVEL = 19
+PATCH_LEVEL = 20
# use to send patches, always empty for released version:
MY_PATCH_LEVEL =
#
#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;
class Mudela_score;
class Mudela_staff;
class Mudela_voice;
-class My_midi_lexer;
-class My_midi_parser;
class Mudela_column;
#endif // MI2MU_PROTO_HH
--- /dev/null
+/*
+ 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
--- /dev/null
+/*
+ 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
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();
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
//
// copyright 1997 Jan Nieuwenhuizen <jan@digicash.com>
+#include <assert.h>
#include <ctype.h>
#include "moment.hh"
#include "duration-convert.hh"
#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)
{
{
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();
}