From: fred Date: Tue, 15 Sep 1998 17:22:43 +0000 (+0000) Subject: lilypond-1.1.55 X-Git-Tag: release/1.5.59~5825 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=8a6e4339298d4839f833f362ce8d61d86e9ca431;p=lilypond.git lilypond-1.1.55 --- diff --git a/midi2ly/TODO b/midi2ly/TODO new file mode 100644 index 0000000000..2f0b77f11e --- /dev/null +++ b/midi2ly/TODO @@ -0,0 +1,84 @@ +# mi2mu/TODO + +Most of the items are marked in the code as well, with full explanation. +grep for TODO and ugh/ugr + + +IMPORTANT + + * if multiple channels per track: output each to separate voice + + * get rid of (last few?) midi-specifics in mudela-* + + * find / remove trend (tempo) of mudela columns + + * get rid of Duration_* statics + + * junk one in list vs. array + + * add mi2mu example output (.midi.ly and .gif) to website + + * important? lily is important, go work on lily! + + * faq about mi2mu midi t1. ? + +PROJECTS + + * write something interesting in mi2mu manual page + + * check/use type 0 / 1 / 2 of midi file + + * create Indentable_stream (see Tex_stream) as base for Lily_stream + + * use dynamic info + + * use aftertouch info (to guess slurs/ties, scripts (staccato?)) + + * lyric events + + * parse all midi events + + * handle time based midi files + + * use dstream feature from lily + + * midi esp.: use I32 iso int where 32 bits are needed (or assumed...) + + * read unsigned words as U16 (not as I16) + + * check use of integral and unsigned in lexer + + * get rid of ugly statics in Duration_convert + + * change option double-dots to max-dots + + * set Key, Meter, ... command line options + +BUGS + + * output of 0 duration c'0 + + * array memleaks(?): use Link_array / create Pointer_array? + + * fix "#undef MEVENT_LIST" source tree: Array + + * split notes that cross bar limit + +FUTURE + + * guess plets (i.e.: only use plet-duration *2/3 if there's a + whole plet) + + * merge midi-events with lily's midi-items? + + * guess beams + + * guess / follow tempo changes + + * check out NIFF / analogies? + + * steal good ideas of other gpl midi parsers + + * lily: add mudela info into midi as specials + mi2mu: use special info + diff --git a/midi2ly/include/GNUmakefile b/midi2ly/include/GNUmakefile new file mode 100644 index 0000000000..1a19230204 --- /dev/null +++ b/midi2ly/include/GNUmakefile @@ -0,0 +1,6 @@ +# lib/include/Makefile + +depth = ../.. +STEPMAKE_TEMPLATES=c++ +include $(depth)/make/stepmake.make + diff --git a/midi2ly/include/dummy.icc b/midi2ly/include/dummy.icc new file mode 100644 index 0000000000..e69de29bb2 diff --git a/midi2ly/include/dummy.tcc b/midi2ly/include/dummy.tcc new file mode 100644 index 0000000000..e69de29bb2 diff --git a/midi2ly/include/mi2mu-global.hh b/midi2ly/include/mi2mu-global.hh new file mode 100644 index 0000000000..4ed873fb54 --- /dev/null +++ b/midi2ly/include/mi2mu-global.hh @@ -0,0 +1,33 @@ +// +// mi2mu-global.hh -- declare global (sic) stuff for mi2mu +// +// copyright 1997 Jan Nieuwenhuizen + +#ifndef MI2MU_GLOBAL_HH +#define MI2MU_GLOBAL_HH + +#include "string.hh" +#include "proto.hh" + +#define monitor_p_g &cout +enum Verbose { QUIET_ver, BRIEF_ver, NORMAL_ver, VERBOSE_ver, DEBUG_ver }; +extern Verbose level_ver; +#if 0 // NPRINT + // not what i want, all output goes through tors. + // set verbosity level. + #define LOGOUT(threshold) if (0) *monitor_p_g +#else + #define LOGOUT(threshold) if (level_ver >= threshold) *monitor_p_g +#endif + +extern Sources* source_l_g; +// huh? +void message (String message_str); //, char const* context_ch_C); +void warning (String message_str); //, char const* context_ch_C); +void error (String message_str); //, char const* context_ch_C); + +String mi2mu_version_str(); +extern bool no_timestamps_b_g;; + +#endif // MI2MU_GLOBAL_HH + diff --git a/midi2ly/include/mi2mu-proto.hh b/midi2ly/include/mi2mu-proto.hh new file mode 100644 index 0000000000..d8ad1368e4 --- /dev/null +++ b/midi2ly/include/mi2mu-proto.hh @@ -0,0 +1,29 @@ +/* + mi2mu-proto.hh -- declare type names in mi2mu + + source file of mi2mu, part of the GNU LilyPond package, + + (c) 1997--1998 Han-Wen Nienhuys +*/ + + +#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_time_signature; +class Mudela_note; +class Mudela_tempo; +class Mudela_text; +class Mudela_score; +class Mudela_staff; +class Mudela_voice; +class Mudela_column; + +#endif // MI2MU_PROTO_HH diff --git a/midi2ly/include/midi-score-parser.hh b/midi2ly/include/midi-score-parser.hh new file mode 100644 index 0000000000..0dc9823705 --- /dev/null +++ b/midi2ly/include/midi-score-parser.hh @@ -0,0 +1,33 @@ +/* + midi-score-parser.hh -- declare + + source file of the GNU LilyPond music typesetter + + (c) 1997--1998 Jan Nieuwenhuizen +*/ + + +#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& tracks); + int find_earliest_i (Link_array& tracks); + Mudela_score* parse_score (); +}; + +#endif // MIDI_SCORE_PARSER_HH diff --git a/midi2ly/include/mudela-stream.hh b/midi2ly/include/mudela-stream.hh new file mode 100644 index 0000000000..6953a961cd --- /dev/null +++ b/midi2ly/include/mudela-stream.hh @@ -0,0 +1,41 @@ +// +// mudela-stream.hh -- part of LilyPond +// +// copyright 1997 Jan Nieuwenhuizen + +// should i be named Mudela_stream? + +#ifndef MUDELA_STREAM_HH +#define MUDELA_STREAM_HH + +#include "mi2mu-proto.hh" +#include "string.hh" +#include "scalar.hh" + +/// Lily output +class Mudela_stream { +public: + Mudela_stream (String filename_str); + ~Mudela_stream(); + + Mudela_stream& operator << (Scalar s); + Mudela_stream& operator << (Mudela_item& mudela_item_r); + +private: + void handle_pending_indent(); + void header(); + void open(); + void output (String str); + void output_wrapped (String str); + + ostream* os_p_; + String filename_str_; + int indent_i_; + int column_i_; + int pending_indent_i_; + int wrap_column_i_; + bool comment_mode_b_; +}; + +#endif // MUDELA_STREAM_HH + diff --git a/midi2ly/mi2mu-version.cc b/midi2ly/mi2mu-version.cc new file mode 100644 index 0000000000..113512d363 --- /dev/null +++ b/midi2ly/mi2mu-version.cc @@ -0,0 +1,20 @@ +// +// version.cc -- implement inexpensive versioning +// +// copyright 1997 Jan Nieuwenhuizen + +#include +#include "config.hh" +#include "version.hh" + +#define VERSION_SZ MAJOR_VERSION "." MINOR_VERSION "." PATCH_LEVEL "." MY_PATCH_LEVEL + +static char *s = "mi2mu " VERSION_SZ; + + +const char * +mi2mu_version_sz() +{ + return s; +} + diff --git a/midi2ly/midi-parser.cc b/midi2ly/midi-parser.cc new file mode 100644 index 0000000000..eafd50c004 --- /dev/null +++ b/midi2ly/midi-parser.cc @@ -0,0 +1,101 @@ +/* + midi-parser.cc -- implement Midi_parser[_info] + + source file of the GNU LilyPond music typesetter + + (c) 1997--1998 Jan Nieuwenhuizen +*/ + +#include +#include "string-convert.hh" +#include "source-file.hh" +#include "mi2mu-global.hh" +#include "midi-parser.hh" + +Midi_parser_info::Midi_parser_info () +{ + division_1_i_ = 0; + format_i_ = 0; + tracks_i_ = 0; + errorlevel_i_ = 0; + byte_L_ = 0; + end_byte_L_ = 0; + score_l_ = 0; +} + +Midi_parser::Midi_parser () +{ + info_l_ = 0; +} + +int +Midi_parser::exit (String str) +{ + error (str); + ::exit (1); + return 0; +} + +void +Midi_parser::error (String str) +{ + ::message (message (str)); +} + +int +Midi_parser::get_i (int n) +{ + assert (n <= (int)sizeof(int)); + return String_convert::bin2_i (get_str (n)); +} + +unsigned +Midi_parser::get_u (int n) +{ + assert (n <= (int)sizeof(int)); + return String_convert::bin2_i (get_str (n)); +} + +String +Midi_parser::get_str (int n) +{ + assert (n >= 0); + if (!n) + warning (_ ("zero length string encountered")); + + Byte const* p = forward_byte_L (n); + return String (p, n); +} + +int +Midi_parser::get_var_i () +{ + int var_i = 0; + + while (1) + { + Byte byte = next_byte (); + var_i <<= 7; + var_i += byte & 0x7f; + if (!(byte & 0x80)) + return var_i; + } + exit ("get_var_i:"); + return 0; +} + +String +Midi_parser::message (String str) +{ + return String ("mi2mu: ") + + info_l_->source_l_->name_str () + ": " + + String_convert::i2dec_str (info_l_->source_l_->line_i ((char const*)info_l_->byte_L_), 0, 0) + ": " + + str + "\n" + + info_l_->source_l_->error_str ((char const*)info_l_->byte_L_); +} + +void +Midi_parser::warning (String str) +{ + ::message (message (String (_ ("warning: ")) + str)); +} diff --git a/midi2ly/version.cc b/midi2ly/version.cc new file mode 100644 index 0000000000..e9f2ed4e69 --- /dev/null +++ b/midi2ly/version.cc @@ -0,0 +1,13 @@ +#include "proto.hh" +#include "string.hh" + +const char * mi2mu_version_sz(); + +// should simply have Root class... +String +mi2mu_version_str() +{ + return String (mi2mu_version_sz ()) + + " " + _("of") + " " + __DATE__ + " " + __TIME__; +} +