From: Han-Wen Nienhuys Date: Wed, 14 May 1997 12:36:06 +0000 (+0200) Subject: release: 0.0.62 X-Git-Tag: release/0.0.62 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=b1b266aea01796334695b6d3bc27f849d47f2110;p=lilypond.git release: 0.0.62 --- diff --git a/.version b/.version index 6ede8d6ba5..15ce19b5db 100644 --- a/.version +++ b/.version @@ -1,6 +1,6 @@ TOPLEVEL_MAJOR_VERSION = 0 TOPLEVEL_MINOR_VERSION = 0 -TOPLEVEL_PATCH_LEVEL = 61 +TOPLEVEL_PATCH_LEVEL = 62 # use to send patches, always empty for released version: # include separator: ".postfix", "-pl" makes rpm barf diff --git a/AUTHORS.text b/AUTHORS.text index e409a65d23..f1f13beaa9 100644 --- a/AUTHORS.text +++ b/AUTHORS.text @@ -61,6 +61,6 @@ DDDDEEEESSSSCCCCRRRRIIIIPPPPTTTTIIIIOOOONNNN -6/May/97 LilyPond 0.0.60 1 +6/May/97 LilyPond 0.0.62 1 diff --git a/Documentation/MANIFESTO.pod b/Documentation/MANIFESTO.pod index 2ceaf525c1..35568361c1 100644 --- a/Documentation/MANIFESTO.pod +++ b/Documentation/MANIFESTO.pod @@ -10,6 +10,8 @@ GNU LilyPond was written with some considerations in mind: =over 4 +=item * + Describing a well-defined language for defining music. We call this language (rather arrogantly) The Musical Definition Language (mudela for short). GNU LilyPond reads a mudela sourcefile and outputs a diff --git a/Documentation/faq.pod b/Documentation/faq.pod index 01445ded16..d632d7e79e 100644 --- a/Documentation/faq.pod +++ b/Documentation/faq.pod @@ -11,8 +11,10 @@ Some questions that have been answered before. Q: I get all kinds of errors while compiling parser.cc A: LilyPond uses features of bison version 1.25. Please confirm that -you are using a version 1.25 or better. If the problem persists, then -please mail me. +you are using a version 1.25 or better. Don't forget to do "make +clean" after installing it + +If the problem persists, then please mail me. =head2 Language: mudela @@ -107,6 +109,11 @@ to associate one Request with one Item or Spanner. =head2 Miscellaneous +Q: How do I change the staff-dividers? + +A: See lilyponddefs.tex + + Q: Why GPL? A: Yes. diff --git a/Documentation/index.pod b/Documentation/index.pod index 7a09c8d1d2..12a1e83139 100644 --- a/Documentation/index.pod +++ b/Documentation/index.pod @@ -106,12 +106,6 @@ examples: MIDI, PS, GIF and input. -=item * - -info on examples - =item * (default: F) =item B<--include, -I>=F + add F to the search path for input files. =back @@ -181,10 +182,27 @@ Check out the input files, some of them have comments =head1 PROBLEMS -If GNU LilyPond bombs out, then please recompile using with debugging info -turned on, and send a copy of the input which causes the error and a -gdb stacktrace of the crash. It also helps if you can print the values -of the objects. So if your trace is + +There is an extensive list of todoes and bugs. See F. In +general, try to find out + +=over 4 + +=item * + +if the bug has been fixed in a newer release. + +=item * + +if the bug has been found earlier, consult F + +=item * + +where the bug comes from: if GNU LilyPond bombs out, then please +recompile using with debugging info turned on, and send a copy of the +input which causes the error and a gdb stacktrace of the crash. It +also helps if you can print the values of the objects. So if your +trace is (gdb) backtrace 12 #0 Interval::operator+= (this=0x11fffec60..) @@ -197,11 +215,12 @@ of the objects. So if your trace is Than it would help if you send a dump of the Interval and the Item (use: C or use GNU LilyPond C methods). -This is a beta version of GNU LilyPond. Please send your helpful comments -and patches to me (see AUTHORS section) +=back -GNU LilyPond is updated very frequently, the latest version is always available at: -ftp://pcnov095.win.tue.nl/pub/lilypond. +Bug reports should be directed to +bug-gnu-music@vuse.vanderbilt.edu. In any case, they should contain a +description of the problem, an small input file which reproduces it +(if applicable), lilypond version and a description of the platform. =head1 FILES @@ -219,6 +238,8 @@ includes files from the directory F. B an (one) additional directory for finding lilypond data. +=head1 BUGS + =head1 SEE ALSO =over 4 @@ -235,21 +256,62 @@ On the input format Goals of the GNU LilyPond project. -=item The GNU LilyPond FAQ list +=item FAQ -=back +The GNU LilyPond FAQ list + + + +=item http://? + +The GNU Music project. GNU LilyPond is part of the GNU Music +project. For more information on the GNU Music project, + +=item http://www.stack.nl/~hanwen/lilypond/index.html GNU LilyPond has her own webpage at -http://www.stack.nl/~hanwen/lilypond/index.html. This webpage contains +This webpage contains the MIDI, GIF and PS files for some standard music files. It also has the complete LilyPond documentation -A mailing list for GNU LilyPond has been setup, it's at -lilypond@gnu.ai.mit.edu. To subscribe, send mail to -lilypond-request@gnu.ai.mit.edu. -For discussions concerning the GNU Music project, -gnu-music-discuss@vanderbilt. .edu +=back + +GNU LilyPond is +updated very frequently, the latest version is always available at: +ftp://pcnov095.win.tue.nl/pub/lilypond. + +For programs which part of the GNU music project, the following mailing list +have been setup: + + +=over 4 + +=item info-gnu-music@vuse.vanderbilt.edu + +For information on the GNU Music project, to subscribe: send mail with +subject "subscribe" to info-gnu-music-request@vuse.vanderbilt.edu + +=item help-gnu-music@vuse.vanderbilt.edu + +For help with programs from the GNU music project. To subscribe: send +mail with subject "subscribe" to +help-gnu-music-request@vuse.vanderbilt.edu + +=item bug-gnu-music@vuse.vanderbilt.edu + +If you have bugreports, you should send them to this list. If you want +to read all bugreports, you should subscribe to this list. To +subscribe: send mail with subject "subscribe" to +bug-gnu-music-request@vuse.vanderbilt.edu + +=item gnu-music-discuss@vuse.vanderbilt.edu, + +For discussions concerning the GNU Music project, to subscribe: send +mail with subject "subscribe" to +gnu-music-discuss-request@vuse.vanderbilt.edu, + +=back =head1 REMARKS diff --git a/INSTALL.text b/INSTALL.text index ac5a76790a..67ad8cdd50 100644 --- a/INSTALL.text +++ b/INSTALL.text @@ -61,7 +61,7 @@ CCCCOOOONNNNFFFFIIIIGGGGUUUURRRRIIIINNNNGGGG a -2/May/97 LilyPond 0.0.60 1 +2/May/97 LilyPond 0.0.62 1 @@ -127,7 +127,7 @@ INSTALL(1) LilyPond documentation INSTALL(1) -2/May/97 LilyPond 0.0.60 2 +2/May/97 LilyPond 0.0.62 2 @@ -193,7 +193,7 @@ RRRRUUUUNNNNNNNNIIIINNNNGGGG -2/May/97 LilyPond 0.0.60 3 +2/May/97 LilyPond 0.0.62 3 @@ -259,6 +259,6 @@ AAAAUUUUTTTTHHHHOOOORRRRSSSS -2/May/97 LilyPond 0.0.60 4 +2/May/97 LilyPond 0.0.62 4 diff --git a/NEWS b/NEWS index f21cc70d03..aafcdc5d14 100644 --- a/NEWS +++ b/NEWS @@ -1,5 +1,22 @@ +pl 61.jnc1 + - smarter + faster duration-convert using Array + - bf: mi2mu compilation/duration-conversions + - lots faster mi2mu, hopefully does type 1 too... +pl 60.jnc1 + - mi2mu handles non-quantified rests, try mi2mu -b wtk-i/fugue2.midi + + +pl 62 + - make clean bf: remove lex & yacc files too + - added kludge in case measure too long + - added kludge in case of unconnected columns. + - kludged columns get error marker + - kludged lines get error marker + +********** +may 14 pl 61 - - scales.ly bugfix: dimensions default to ((0,0),(0,0)) + - scales.ly bugfix: dimensions default to ((0,0), (0,0)) - naming: PointerList->Pointer_list - tied notes don't get accidental - bf: crescendo size @@ -11,14 +28,19 @@ pl 60.mb - set_flower_debug: Warning if -d is used when NPRINT is defined. - Fixed several TeX details. vcenter renamed since it interfered with LaTeX. Position of accents changed. - - New example; scriptS.ly + - New example; scripts.ly - table_sixteen: added scriptdefinition (Lilypond breaks if a script is defined without dimensions). - bf: ifndef typos in p-score.cc, choleski.cc - bf: Slur::do_post_processing(), whole notes caused SIGSEGV. - +(ascension break :-) ******* +pl 57.jcn4 + - mi2mu handles rests (quantified only) + - fixed configure buglet + - "!date" Fri May 2 02:18:12 MET DST 1997 + pl 60 - Request_register::get_feature(), tie direction, Slur direction - lilypond output is now directly texable. diff --git a/README b/README index 416108902b..1dc3546a4c 100644 --- a/README +++ b/README @@ -27,9 +27,17 @@ NOTE: LilyPond is a long way from finished and polished. I do appreciate criticism, comments, bugreports, patches, etc. Please send e-mail to -me, +the mailing lists - hanwen@stack.nl + info-gnu-music-request@vuse.vanderbilt.edu + help-gnu-music-request@vuse.vanderbilt.edu + bug-gnu-music-request@vuse.vanderbilt.edu + gnu-music-discuss-request@vuse.vanderbilt.edu, + +(or directly to us: hanwen@stack.nl, jan@digicash.com) + + + Have fun! diff --git a/TODO b/TODO index e4b56d2381..75162b7604 100644 --- a/TODO +++ b/TODO @@ -1,4 +1,3 @@ - This is an assorted collection of stuff that will be done, might be done, or is an idea that I want to think about @@ -8,11 +7,14 @@ grep for TODO and ugh/ugr IMPORTANT + * faq about mi2mu midi t1. + * update 20 pt table * use Hungarian throughout code * rename mf fonts to avoid conflicts with musixtex + check (c) issues * decent TeX page layout @@ -26,8 +28,9 @@ IMPORTANT PROJECTS - * Output class, handles + * Output class, handles : (smallish) - help text /(c) notice? + - version line - warning /errors/progress - abort on error/warning; exit status - quiet/ignore-version options @@ -39,25 +42,32 @@ PROJECTS - slur start/end * Output an output format independent (ofi) typeset file; and - make ofi2 TeX, MusixTex, PostScript, Ascii... interpreters. + make ofi2 TeX, MusixTex, PostScript, Ascii... interpreters. (difficult) - poor man's ascii output possible? - MusixTeX output possible? (would have to be done before break calc.) - NIFF ? - PostScript output (esp. Beams, Slurs, etc) - * TeX spanners , use texbeam.cc as an example + * TeX spanners , use texbeam.cc as an example (smallish) - Glissando - trill - bracket - * Rewrite Beam and Rhythmic_grouping + * Rewrite Beam and Rhythmic_grouping (hairy) - [c8. c32 c32] - - interbeam height + - interbeam height - general shaving - use plet grouping - abbreviations [c2 c2]1/2 - separate visual from rhythmic info + * Redo MIDI output to use Registers: (Difficult) + - remember more horizontal info than melodics: + - tempo change + - repeat + - slurs + - dynamics etc. + PARSER * Duration -> Musical_duration, typedef Rational Duration? @@ -69,10 +79,6 @@ ruimte van een hele maat erachter (bij unmatching staffs) Hele rusten ook in andere maatsoort dan 4/4 (en centreren in de maat) -------------------------\ -barcheck failed in lyric mode -> assert (zie barcheck.ly) (0.0.57) -------------------------/ - noten staan vaak te dicht aan de rechterkant van de maatstreep. optie om nummers/markers boven maatstrepen te zetten @@ -88,10 +94,6 @@ verplichte regels implementeren versieringen door duration *0 ofzo? (geeft nu assertion, zie duration0.ly) -midi: instrumenten definieren? -midi: tempo halverwege het stuk wijzigen? -midi: gebonden noten niet herhalen? - Triolen enzo: het zou handig zijn als je het cijfer "3" ook _tussen_ twee noten kon plaatsen. Dat is bijvoorbeeld nodig in c4*2/3 c8*2/3 @@ -103,8 +105,6 @@ gedrukt. BUGS - * detect -pipe - * staccato dot positions. * stacked scripts. @@ -122,7 +122,6 @@ BUGS * standchen triool beam up/down - SEVERELY LACKING: * SPEED! @@ -145,7 +144,6 @@ INPUTLANGUAGE * \duration 8; e*2/3 - * configure pitch_byte * special key. @@ -160,6 +158,8 @@ INPUTLANGUAGE SMALLISH PROJECTS + * --fast/--draft: leave out constraints + * write Dynamic_line (to group dynamics horizontally) * write Rest_collision @@ -177,7 +177,7 @@ SMALLISH PROJECTS * key undo - * unix style paths for LILYINCLUDE EN + * unix style paths for LILYINCLUDE env * indentable stream as baseclass for TeX stream, lily stream, Dstream. @@ -191,7 +191,7 @@ SMALLISH PROJECTS * qtor, btor, mtor-> tor( QUIET_ver ), tor( DEBUG_ver ), etc. - - declare notenametab? + * declare notenametab? * use tors feature in lily @@ -228,10 +228,11 @@ SMALLISH PROJECTS * configure idealspacing: arithmetic spacing - * midi output: eat-up dynamic, key/meter/tempo changes, and -write them neatly - * LilyPond .deb + * LilyPond .deb. Other packaging methods? + + * detect -pipe + DOC @@ -243,6 +244,8 @@ DOC FUTURE + * auxilliary file for caching info. + * Reg_configure_request * bring Collision::do_pre_processing to haircutter @@ -257,8 +260,6 @@ FUTURE * Junk Staff_column, and find the requests while walking the Voices.? - * MIDI repeat: make lily understand repeats - * better beamslope calculation: QLP for beams? * implement better breaking algorithm @@ -283,22 +284,20 @@ IDEAS ID '=' EXPR; - * integrate Register/Midi stuff - * create libmudela, or liblily_frontend * move MIDI stuff (including Quantization) to a ANSI C libmidi library. - * use an embedded language: Python, Scheme? + * use an embedded language: Python for : - Items/Spanners - Registers - - Complex mudela + - Complex mudela? * y -dims in internote? * hack up mf sources for decent spacing info (and then - read TFM directly, for text too) + read AFM/TFM directly, for text too) * merge Atom and Symbol? diff --git a/bin/release b/bin/release index 4f38a8883e..a52951ec32 100755 --- a/bin/release +++ b/bin/release @@ -46,7 +46,7 @@ mv $patch ../patches/ RPMS=`find ~/rpms/ -name lilypond-$NEWVER'*'rpm` rm *.rpm {lilypond,patch}-*.gz -if [ ! -z $RPMS ]; then +if [ ! -z "$RPMS" ]; then ln $RPMS . fi @@ -54,8 +54,8 @@ ln ../releases/$tarball . ln ../patches/$patch . -if [ ! -z $RPMS ]; then - RPMS=lilypond-$LILYVER-1.i386.rpm lilypond-$LILYVER-1.src.rpm +if [ ! -z "$RPMS" ]; then + RPMS="lilypond-$LILYVER-1.i386.rpm lilypond-$LILYVER-1.src.rpm" fi tar cf updeet $tarball $patch $RPMS tar tfv updeet diff --git a/configure b/configure index 9e35706c4f..a803ba3e29 100755 --- a/configure +++ b/configure @@ -1152,7 +1152,12 @@ fi if test $BISON = "error" then - echo "configure: warning: can't find bison. Please install Bison (1.24 or better)" 1>&2 + echo "configure: warning: can't find bison. Please install Bison (1.25 or better)" 1>&2 +else + bison_version=`$BISON --version| sed 's/^.*version 1.//g' ` + if test $bison_version -lt 25; then + echo "configure: warning: Your bison is too old (1.$bison_version). Please install 1.25" 1>&2 + fi fi if test $PODMAN = "error" @@ -1173,7 +1178,7 @@ else fi echo $ac_n "checking how to run the C++ preprocessor""... $ac_c" 1>&6 -echo "configure:1177: checking how to run the C++ preprocessor" >&5 +echo "configure:1182: checking how to run the C++ preprocessor" >&5 if test -z "$CXXCPP"; then if eval "test \"`echo '$''{'ac_cv_prog_CXXCPP'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -1186,12 +1191,12 @@ ac_link='${CXX-g++} -o conftest $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $L cross_compiling=$ac_cv_prog_cxx_cross CXXCPP="${CXX-g++} -E" cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1195: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1200: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out` if test -z "$ac_err"; then : @@ -1211,17 +1216,17 @@ echo "$ac_t""$CXXCPP" 1>&6 ac_safe=`echo "FlexLexer.h" | sed 'y%./+-%__p_%'` echo $ac_n "checking for FlexLexer.h""... $ac_c" 1>&6 -echo "configure:1215: checking for FlexLexer.h" >&5 +echo "configure:1220: checking for FlexLexer.h" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1225: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1230: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out` if test -z "$ac_err"; then rm -rf conftest* @@ -1625,7 +1630,7 @@ fi eval "DIR_DATADIR=$datadir" DIR_DATADIR="$DIR_DATADIR/lilypond" echo $ac_n "checking ""... $ac_c" 1>&6 -echo "configure:1629: checking " >&5 +echo "configure:1634: checking " >&5 cat << EOF > lib/out/config.hh diff --git a/configure.in b/configure.in index fbf2c3d8d8..f8f095502d 100644 --- a/configure.in +++ b/configure.in @@ -196,7 +196,12 @@ fi if test $BISON = "error" then - AC_MSG_WARN(can't find bison. Please install Bison (1.24 or better)) + AC_MSG_WARN(can't find bison. Please install Bison (1.25 or better)) +else + bison_version=`$BISON --version| sed 's/^.*version 1.//g' ` + if test $bison_version -lt 25; then + AC_MSG_WARN(Your bison is too old (1.$bison_version). Please install 1.25) + fi fi if test $PODMAN = "error" diff --git a/flower/.version b/flower/.version index 0801c617c1..10b5619315 100644 --- a/flower/.version +++ b/flower/.version @@ -1,6 +1,6 @@ MAJOR_VERSION = 1 MINOR_VERSION = 1 -PATCH_LEVEL = 15 +PATCH_LEVEL = 16 # use to send patches, always empty for released version: MY_PATCH_LEVEL = # include separator: "-1" or ".a" # diff --git a/flower/NEWS b/flower/NEWS index 2da3968aa2..727d9e2487 100644 --- a/flower/NEWS +++ b/flower/NEWS @@ -1,63 +1,69 @@ -pl 1.1.15 +version 1.1: + +pl 16 + - Array::get() + - P< > doco. + +pl 15 - #ifndef fixes (MB) - Dstream::clear () -pl 1.1.14 +pl 14 - interval methods -pl 1.1.13 +pl 13 - better test-bed - Heap PQueue implementation -pl 1.1.12 +pl 12 - No path search for "" and "-" -pl 1.1.11 +pl 11 - template<> class P - assoc elem() methods -pl 1.1.10 +pl 10 - Matrix_storage naming - Matrix_storage::try_right_multiply to help speed up matrix multiply routines. -pl 1.1.9 +pl 9 - _C iso _c_l - flower-debug. -pl 1.1.8 +pl 8 -pl 1.1.7 +pl 7 - PQueue blondification. - String_convert::i2hex_str fix, unsigned eqvs introduced - long long depreciated, now named I64 - type I32 introduced. should be used iso int where 32 bits are needed(or, brr, assumed...) -pl 1.1.6-2 +pl 6-2 Bugfix - silly String( int... ) -> String( (char)... ) fix really should junk ambiguous constructor overload -pl 1.1.6-1 +pl 6-1 Bugfix - small but nasty include/fversion.hh fixed -pl 1.1.6 - - all of 1.1.4-1 and 1.1.5 +pl 6 + - all of 4-1 and 5 Bugfix - null_terminated -> is_binary test -pl 1.1.5 +pl 5 - memmem interface, conditional compilation - snprintf -pl 1.1.4-1 +pl 4-1 - included in new make structure, as a library of lilypond; for compiling you-ll need ../make and ../bin dirs from lilypond... -pl 1.1.4 +pl 4 - great file-renaming. - String cleanup (binary <-> null terminate), several bugfixes - great renaming of String and String_convert interfaces @@ -65,19 +71,19 @@ pl 1.1.4 - String indexing now all base = 0, not found = -1 - renamed by to byte -pl 1.1.3 +pl 3 - String::mid - memmove test code -pl 1.1.2 +pl 2 - StringConversio::bin2int_i - dumb prioq -pl 1.1.1 +pl 1 - separated StringHandle and StringData - String::compare -1.1.0: +0: ------------------ diff --git a/flower/include/pointer.hh b/flower/include/pointer.hh index e29a298ace..58f8e198b0 100644 --- a/flower/include/pointer.hh +++ b/flower/include/pointer.hh @@ -20,19 +20,42 @@ Sorry for the silly naming */ template class P { - - void copy(T*); + /** + Set contents to a copy of #t_l# + */ + void copy(T const*t_l); T* t_p; + + /** + junk contents and set to 0 + */ void junk(); public: P(P const &src); + /** + Remove the pointer, and return it. + */ T *get_p() { T*p = t_p; t_p=0; return p; } - T *get_l() { return t_p; } + /** + return the pointer + */ + T *get_l() { return t_p; } + + T const *get_C() const { return t_p; } + /** + copy the contents of pointer, and return it + */ T *copy_p() const; + /** + swallow new_p, and set contents t new_p + */ void set_p (T *new_p); - void set_l (T *t_l); + /** + junk contents, and copy contents of t_l + */ + void set_l (T const *t_C); P &operator =(P const &); ~P(); @@ -42,6 +65,8 @@ public: T *operator ->() { return t_p; } operator T * () { return t_p; } const T *operator ->() const { return t_p ; } + T &operator *() { return *t_p; } + T const &operator *() const { return *t_p; } operator const T *() const { return t_p; } }; #endif // POINTER_HH diff --git a/flower/include/pointer.tcc b/flower/include/pointer.tcc index d595f2bcfe..80cadfd23a 100644 --- a/flower/include/pointer.tcc +++ b/flower/include/pointer.tcc @@ -21,9 +21,9 @@ P::copy_p()const template inline void -P::copy(T *l) +P::copy(T const *l_C) { - t_p = l ? new T(*l) : 0; + t_p = l_C ? new T(*l_C) : 0; } template @@ -74,13 +74,13 @@ P::set_p(T * np) template inline void -P::set_l(T * l) +P::set_l(T const * l_C) { - if (t_p == l) + if (t_p == l_C) return; junk(); - copy(l); + copy(l_C); } diff --git a/flower/include/pqueue.hh b/flower/include/pqueue.hh index 034fa3d3ef..846b870089 100644 --- a/flower/include/pqueue.hh +++ b/flower/include/pqueue.hh @@ -74,7 +74,7 @@ public: OK(); } T max() const { - int first_leaf_i = size(); + //int first_leaf_i = size(); T max_t; return max_t; } diff --git a/flower/include/varray.hh b/flower/include/varray.hh index b9b1a24b6b..4f67d3aac4 100644 --- a/flower/include/varray.hh +++ b/flower/include/varray.hh @@ -156,6 +156,14 @@ public: thearray[i] = thearray[i-1]; thearray[j] = k; } + /** + remove i-th element, and return it. + */ + T get(int i) { + T t = elem(i); + del (i); + return t; + } void del(int i) { assert(i >=0&& i < size_); arrcpy(thearray+i, thearray+i+1, size_-i-1); diff --git a/init/table_sixteen.ini b/init/table_sixteen.ini index a1beff522b..b9670bb8fd 100644 --- a/init/table_sixteen.ini +++ b/init/table_sixteen.ini @@ -114,6 +114,8 @@ table_sixteen= "8" "\eighthrest" 0\pt 5\pt 0\pt 8\pt "16" "\sixteenthrest" 0\pt 6\pt 0\pt 12\pt "32" "\thirtysecondrest" 0\pt 6\pt 0\pt 16\pt + "64" "\sixtyfourthrest" 0\pt 6\pt 0\pt 16\pt + "128" "\hundredtwentyeighthrest" 0\pt 6\pt 0\pt 16\pt } "meters" = \table { @@ -139,12 +141,16 @@ table_sixteen= } "flags" = \table { - "8" "\eigthflag" 0\pt 4\pt 0\pt 0\pt + "8" "\eighthflag" 0\pt 4\pt 0\pt 0\pt "16" "\sixteenthflag" 0\pt 4\pt 0\pt 0\pt "32" "\thirtysecondflag" 0\pt 4\pt 0\pt 0\pt - "-8" "\deigthflag" 0\pt 4\pt 0\pt 0\pt + "64" "\sixtyfourthflag" 0\pt 4\pt 0\pt 0\pt + "128" "\hundredtwentyeighthflag" 0\pt 4\pt 0\pt 0\pt + "-8" "\deighthflag" 0\pt 4\pt 0\pt 0\pt "-16" "\dsixteenthflag" 0\pt 4\pt 0\pt 0\pt "-32" "\dthirtysecondflag" 0\pt 4\pt 0\pt 0\pt + "-64" "\dsixtyfourthflag" 0\pt 4\pt 0\pt 0\pt + "-128" "\dhundredtwentyeighthflag" 0\pt 4\pt 0\pt 0\pt } "beamslopes" = \table { diff --git a/input/error.ly b/input/error.ly index 351ba8725a..c68205f0be 100644 --- a/input/error.ly +++ b/input/error.ly @@ -32,10 +32,6 @@ bla = \lyric{ } -% Setting up music ...lilypond: ../flower/include/cursor.inl:98: class Cursor Cursor::operator ++(int): Assertion 'pointer_' failed. -%IOT trap/Abort -% als geen music in staff - \include "this-is-hopefully-a-nonexisting-file" \score{ \staff{ bla } diff --git a/input/rhythm.ly b/input/rhythm.ly index 24f134baef..068a30de4e 100644 --- a/input/rhythm.ly +++ b/input/rhythm.ly @@ -3,7 +3,7 @@ filename:rhythm.ly title: description: - composers:HWN + composers: entered-by:HWN copyright:public domain diff --git a/lib/duration-convert.cc b/lib/duration-convert.cc index ad2e245ba4..882d275b3c 100644 --- a/lib/duration-convert.cc +++ b/lib/duration-convert.cc @@ -15,6 +15,7 @@ bool Duration_convert::no_quantify_b_s = false; bool Duration_convert::no_double_dots_b_s = false; bool Duration_convert::no_triplets_b_s = false; int Duration_convert::no_smaller_than_i_s = 0; +Array Duration_convert::dur_array_s; String Duration_convert::dur2_str( Duration dur ) @@ -84,53 +85,66 @@ Duration_convert::i2_mom( int time_i, int division_1_i ) 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 dur = iter_dur++; - if ( mom == dur2_mom( dur ) ) - return dur; - } - if ( midi_as_plet_b_s ) { - Moment mom_4 = mom / Moment( 4 ); - long num = mom_4.numerator().as_long(); - long den = mom_4.denominator().as_long(); - Duration dur( 4, 0 ); - dur.set_plet( num, den ); + if (!mom) { + Duration dur; + dur.set_plet(0,1); + return dur; + } + + + Duration dur = mom2standardised_dur( mom ); +// if ( dur.mom() == mom ) + if ( dur.length() == mom ) return dur; - } - assert( 0 ); - // no can do - Duration dur( 0 ); + assert( midi_as_plet_b_s ); + +// dur.set_plet( type_mom, Duration::division_1_i_s / 4 ); + +// Moment as_plet_mom = mom / dur.mom(); + Moment as_plet_mom = mom / dur.length(); + as_plet_mom *= dur.plet_.mom(); + long num = as_plet_mom.numerator().as_long(); + long den = as_plet_mom.denominator().as_long(); + dur.set_plet( num, den ); return dur; } Duration Duration_convert::mom2standardised_dur( Moment mom ) { - /* this is cute, - but filling an array using Duration_iterator - might speed things up, a little - */ +// if ( !dur_array_s.length_i() ) + if ( !dur_array_s.size() ) + set_array(); +// assert( dur_array_s.length_i() ); + assert( dur_array_s.size() ); +// for ( int i = 0; i < dur_array_s.length_i() - 1; i++ ) { + for ( int i = 0; i < dur_array_s.size() - 1; i++ ) { + Moment lower_mom = dur2_mom( dur_array_s[ i ] ); + if ( mom <= lower_mom ) { + if ( i || ( mom / lower_mom > Moment( 3, 4 ) ) ) + return dur_array_s[ i ]; + else + return Duration( 0 ); + } + Moment upper_mom = dur2_mom( dur_array_s[ i + 1 ] ); + if ( ( mom < upper_mom ) + && ( ( mom - lower_mom ) / mom + < ( upper_mom - mom ) / mom ) ) + return dur_array_s[ i ]; + } +// return dur_array_s[ dur_array_s.length_i() ]; + return dur_array_s[ dur_array_s.size() - 1 ]; +} + +void +Duration_convert::set_array() +{ + dur_array_s.clear(); + 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 == lower_mom ) - return lower_dur; - } - return iter_dur(); + while ( iter_dur ) + dur_array_s.push( iter_dur++ ); } @@ -149,64 +163,40 @@ Duration_convert::sync_f( Duration dur, Moment mom ) Duration Duration_convert::ticks2_dur( int ticks_i ) { - /* this is cute, - but filling an array using Duration_iterator - might speed things up, a little - */ - // should use mom2_dur +// Duration dur( 4, 0 ); +// dur.set_plet( ticks_i, Duration::division_1_i_s / 4 ); + Moment mom( ticks_i, Duration::division_1_i_s ); - Duration_iterator iter_dur; - assert( iter_dur ); - while ( iter_dur ) { - Duration dur = iter_dur++; - if ( mom == dur2_mom( dur ) ) - return dur; - } - if ( midi_as_plet_b_s ) { - Duration dur( 4, 0 ); - dur.set_plet( ticks_i, Duration::division_1_i_s / 4 ); + if ( midi_as_plet_b_s ) + return mom2_dur( mom ); + + Duration dur = mom2standardised_dur( mom ); + +// if ( dur.mom() == mom ) + if ( dur.length() == mom ) return dur; - } - Duration dur( 0 ); + +// huh? +#if 0 + dur.type_i_ = 0; + dur.dots_i_ = 0; dur.set_ticks( ticks_i ); return dur; +#else + return mom2_dur( mom ); +#endif } Duration Duration_convert::ticks2standardised_dur( int ticks_i ) { - /* this is cute, - but filling an array using Duration_iterator - might speed things up, a little - */ - // should use mom2standardised_dur Moment mom( ticks_i, Duration::division_1_i_s ); - Duration_iterator iter_dur; - assert( iter_dur ); - while ( iter_dur ) { - Duration lower_dur = iter_dur++; -// Duration upper_dur( 0 ); - Duration upper_dur( 1, 1 ); - 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 == 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 ) ); - if ( abs( mom - lower_mom ) < abs( mom - upper_mom ) ) - return lower_dur; - else - return upper_dur; - } - lower_dur = upper_dur; - } - return iter_dur(); + Duration dur = mom2standardised_dur( mom ); + +// if ( dur.mom() != mom ) + if ( dur.length() != mom ) + warning( String( "duration not exact: " ) + String( (Real)mom ) ); + return dur; } Duration_iterator::Duration_iterator() diff --git a/lib/duration.cc b/lib/duration.cc index 1b529ccc58..64902fa73c 100644 --- a/lib/duration.cc +++ b/lib/duration.cc @@ -43,6 +43,8 @@ Duration::duration_type_b(int t) return bit_i == 1; } +// ugh, what's this? +// i should be called "mom()", ... or at least "length_mom()" Moment Duration::length() const { diff --git a/lib/include/duration-convert.hh b/lib/include/duration-convert.hh index ef80462f78..3f34a7650b 100644 --- a/lib/include/duration-convert.hh +++ b/lib/include/duration-convert.hh @@ -12,6 +12,8 @@ #define DURATION_CONVERT_HH #include "duration.hh" #include "string.hh" +//#include "array.hh" +#include "varray.hh" /** Duration_convert handles all conversions to -n fro Duration (dur). @@ -24,6 +26,10 @@ SUGGESTION: currently a moment in time is called moment too; let-s typedef Rational When too, so that we get When Staff_column::when(), Moment Voice_element::mom(). + + [todo] + move all statics to real members, instantiate Duration_convert + object(s). */ struct Duration_convert { @@ -34,6 +40,7 @@ struct Duration_convert { static bool no_double_dots_b_s; static bool no_triplets_b_s; static int no_smaller_than_i_s; + static Array dur_array_s; // /// Most used division in MIDI, all fine with me. // static int const division_1_c_i = 384; @@ -65,6 +72,8 @@ struct Duration_convert { /// Return plet factor (not a Moment: should use Rational?). static Moment plet_factor_mom( Duration dur ); + static void set_array(); + /** Return synchronisation factor for mom, so that mom2_dur( mom / sync_f ) will return the duration dur. */ diff --git a/lily/.version b/lily/.version index cc03f17df4..2438befc54 100644 --- a/lily/.version +++ b/lily/.version @@ -1,6 +1,6 @@ MAJOR_VERSION = 0 MINOR_VERSION = 0 -PATCH_LEVEL = 61 +PATCH_LEVEL = 62 # use to send patches, always empty for released version: # include separator: ".postfix", "-pl" makes rpm barf diff --git a/lily/Makefile b/lily/Makefile index 9d63dbc469..01503659df 100644 --- a/lily/Makefile +++ b/lily/Makefile @@ -73,3 +73,6 @@ DEPFILES = $(wildcard $(depdir)/*.dep) -include /dev/null $(DEPFILES) # + +localclean: + rm -f $(outdir)/parser.* $(outdir)/lexer.cc diff --git a/lily/break.cc b/lily/break.cc index 8a07b02344..8a9a426657 100644 --- a/lily/break.cc +++ b/lily/break.cc @@ -27,6 +27,23 @@ Break_algorithm::find_breaks() const return retval; } + +Col_hpositions +Break_algorithm::stupid_solution(Line_of_cols curline)const +{ + Spacing_problem sp; + sp.add_column(curline[0], true, 0.0); + for (int i=1; i< curline.size()-1; i++) + sp.add_column(curline[i]); + sp.add_column(curline.top(), true, linelength); + Col_hpositions colhpos; + colhpos.cols = curline; + colhpos.energy = INFTY; + colhpos.ugh_b_ = true; + colhpos.config = sp.try_initial_solution(); + return colhpos; +} + /// construct an appropriate Spacing_problem and solve it. Col_hpositions Break_algorithm::solve_line(Line_of_cols curline) const @@ -42,11 +59,14 @@ Break_algorithm::solve_line(Line_of_cols curline) const for (iter_top(pscore_.suz,i); i.ok(); i++) { sp.add_ideal(i); } + sp.prepare(); + Array the_sol=sp.solve(); Col_hpositions col_hpos; col_hpos.cols = curline; col_hpos.energy = the_sol.pop(); col_hpos.config = the_sol; + col_hpos.error_col_l_arr_ = sp.error_pcol_l_arr(); col_hpos.OK(); return col_hpos; } diff --git a/lily/calcideal.cc b/lily/calcideal.cc index fa015012b3..af654d15bd 100644 --- a/lily/calcideal.cc +++ b/lily/calcideal.cc @@ -1,3 +1,11 @@ +/* + calcideal.cc -- implement Score::calc_idealspacing() + + source file of the LilyPond music typesetter + + (c) 1997 Han-Wen Nienhuys +*/ + #include "idealspacing.hh" #include "score.hh" #include "p-score.hh" @@ -13,7 +21,7 @@ effects into account, should be local (measure wide), should check smallest divisions. - + plus, calc_idealspacing() should be called per line. */ void Score::calc_idealspacing() diff --git a/lily/colhpos.cc b/lily/colhpos.cc index 530e4d4483..e96b3f99ad 100644 --- a/lily/colhpos.cc +++ b/lily/colhpos.cc @@ -7,6 +7,7 @@ Col_hpositions::Col_hpositions() { energy = INFTY; + ugh_b_ = false; } void diff --git a/lily/include/break.hh b/lily/include/break.hh index 72f0edf39b..343903313f 100644 --- a/lily/include/break.hh +++ b/lily/include/break.hh @@ -41,6 +41,10 @@ struct Break_algorithm { bool feasible(Line_of_cols)const; virtual Array solve()=0; + + /** generate a solution with no regard to idealspacings or + constraints. should always work */ + Col_hpositions stupid_solution(Line_of_cols) const; }; /// wordwrap type algorithm: move to next line if current is optimal. diff --git a/lily/include/colhpos.hh b/lily/include/colhpos.hh index 5398417ab1..c62b70e654 100644 --- a/lily/include/colhpos.hh +++ b/lily/include/colhpos.hh @@ -12,6 +12,8 @@ typedef Array Line_of_cols; struct Col_hpositions { + bool ugh_b_; + Line_of_cols error_col_l_arr_; Line_of_cols cols; Array config; Real energy; diff --git a/lily/include/linespace.hh b/lily/include/linespace.hh index 28e2abc01c..bd8685383a 100644 --- a/lily/include/linespace.hh +++ b/lily/include/linespace.hh @@ -1,27 +1,36 @@ -#ifndef PROBLEM_HH -#define PROBLEM_HH +/* + linespace.hh -- declare Colinfo, Spacing_problem + source file of the LilyPond music typesetter + + (c) 1996,1997 Han-Wen Nienhuys +*/ + + +#ifndef LINESPACE_HH +#define LINESPACE_HH #include "glob.hh" #include "plist.hh" #include "varray.hh" #include "vector.hh" #include "interval.hh" +#include "pointer.hh" /// helper struct for #Spacing_problem# struct Colinfo { - PCol const *pcol_; - Real const * fixpos; + PCol *pcol_l_; + P fixpos_p_; Interval width; - + int rank_i_; + /// did some tricks to make this column come out. + bool ugh_b_; /* *************** */ Colinfo(); - void operator=(Colinfo const&); - Colinfo(Colinfo const&); - ~Colinfo(); - Colinfo(PCol const *,Real const *); + Colinfo(PCol *,Real const *); + void print() const; - bool fixed() const { return fixpos;} - Real fixed_position()const { return *fixpos; } + bool fixed() const { return fixpos_p_.get_C();} + Real fixed_position()const { return *fixpos_p_; } Real minright() const { return width.right; } Real minleft() const { return -width.left; } }; @@ -52,7 +61,10 @@ struct Colinfo { class Spacing_problem { Array ideals; Array cols; - + Array loose_col_arr_; + + /// mark column #i# as being loose. + void loosen_column(int i); /// the index of #c# in #cols# int col_id(PCol const *c) const; @@ -71,7 +83,12 @@ class Spacing_problem { /// generate the LP constraints void make_constraints(Mixed_qp& lp) const; + + void handle_loose_cols(); + void position_loose_cols(Vector &) const; public: + Array error_pcol_l_arr() const; + /** solve the spacing problem @return the column positions, and the energy (last element) @@ -93,7 +110,7 @@ public: /** add a col to the problem. columns have to be added left to right. The column contains info on it's minimum width. */ - void add_column(PCol const *, bool fixed=false, Real fixpos=0.0); + void add_column(PCol *, bool fixed=false, Real fixpos=0.0); @@ -103,6 +120,7 @@ public: void OK() const; void print() const; void print_ideal(Idealspacing const *)const; + void prepare(); }; diff --git a/lily/include/p-col.hh b/lily/include/p-col.hh index 58206b4306..4a4264a006 100644 --- a/lily/include/p-col.hh +++ b/lily/include/p-col.hh @@ -46,6 +46,8 @@ public: Real hpos; // should use ptr? + bool error_mark_b_; + PScore * pscore_l_; /* *************** */ diff --git a/lily/include/p-score.hh b/lily/include/p-score.hh index 0cc7a2bc15..15c123fdb6 100644 --- a/lily/include/p-score.hh +++ b/lily/include/p-score.hh @@ -1,7 +1,14 @@ -// the breaking problem for a score. +/* + p-score.hh -- declare PScore -#ifndef PSCORE_HH -#define PSCORE_HH + source file of the LilyPond music typesetter + + (c) 1996,1997 Han-Wen Nienhuys +*/ + + +#ifndef P_SCORE_HH +#define P_SCORE_HH #include "colhpos.hh" #include "varray.hh" @@ -43,7 +50,7 @@ struct PScore { PScore(Paper_def*); /// add a line to the broken stuff. Positions given in #config# - void set_breaking(Array); + void set_breaking(Array const &); void add(PStaff *); diff --git a/lily/include/scoreline.hh b/lily/include/scoreline.hh index 33bbc4a2d8..814cb7e8c2 100644 --- a/lily/include/scoreline.hh +++ b/lily/include/scoreline.hh @@ -15,6 +15,7 @@ struct Line_of_score { Pointer_list cols; + bool error_mark_b_; // need to store height of each staff. IPointer_list staffs; PScore * pscore_l_; // needed to generate staffs diff --git a/lily/linespace.cc b/lily/linespace.cc index aed6c407eb..c2fec09918 100644 --- a/lily/linespace.cc +++ b/lily/linespace.cc @@ -5,15 +5,16 @@ #include "qlp.hh" #include "unionfind.hh" #include "idealspacing.hh" +#include "pointer.tcc" const Real COLFUDGE=1e-3; - +template class P; // ugh. bool Spacing_problem::contains(PCol const *w) { for (int i=0; i< cols.size(); i++) - if (cols[i].pcol_ == w) + if (cols[i].pcol_l_ == w) return true; return false; } @@ -22,7 +23,7 @@ int Spacing_problem::col_id(PCol const *w)const { for (int i=0; i< cols.size(); i++) - if (cols[i].pcol_ == w) + if (cols[i].pcol_l_ == w) return i; assert(false); return -1; @@ -32,6 +33,19 @@ void Spacing_problem::OK() const { #ifndef NDEBUG + for (int i = 1; i < cols.size(); i++) + assert(cols[i].rank_i_ > cols[i-1].rank_i_); + for (int i = 1; i < loose_col_arr_.size(); i++) + assert(loose_col_arr_[i].rank_i_ > loose_col_arr_[i-1].rank_i_); +#endif +} + +/** + Make sure no unconnected columns happen. + */ +void +Spacing_problem::handle_loose_cols() +{ Union_find connected(cols.size()); Array fixed; for (int i=0; i < ideals.size(); i++) { @@ -43,23 +57,73 @@ Spacing_problem::OK() const for (int i = 0; i < cols.size(); i++) if (cols[i].fixed()) fixed.push(i); - for (int i = 0; i < cols.size(); i++) { - bool c=false; - for (int j =0; j fix_b_arr; + fix_b_arr.set_size(cols.size() + loose_col_arr_.size()); + Real utter_right_f=-INFTY; + Real utter_left_f =INFTY; + for (int i=0; i < loose_col_arr_.size(); i++) { + fix_b_arr[loose_col_arr_[i].rank_i_] = false; + } + for (int i=0; i < cols.size(); i++) { + int r= cols[i].rank_i_; + fix_b_arr[r] = true; + utter_right_f = utter_right_f >? sol_vec(i); + utter_left_f = utter_left_f 0) ?sol_vec(j-1) : utter_left_f; + Real right_pos_f = + (j < sol_vec.dim()) ? sol_vec(j) : utter_right_f; + int left_rank = (j>0) ? cols[j-1].rank_i_ : 0; + int right_rank = (j left_rank && r < right_rank); + + v(i) = (r - left_rank)*left_pos_f/ d_r + + (right_rank - r) *right_pos_f /d_r; + } + } + sol_vec = v; +} + bool Spacing_problem::check_constraints(Vector v) const { int dim=v.dim(); + assert(dim == cols.size()); + for (int i=0; i < dim; i++) { if (cols[i].fixed()&& @@ -84,6 +148,12 @@ Spacing_problem::check_constraints(Vector v) const return true; } +void +Spacing_problem::prepare() +{ + handle_loose_cols(); +} + bool Spacing_problem::check_feasible() const { @@ -91,7 +161,7 @@ Spacing_problem::check_feasible() const return check_constraints(sol); } -// generate a solution which obeys the min distances and fixed positions +/// generate a solution which obeys the min distances and fixed positions Vector Spacing_problem::try_initial_solution() const { @@ -99,21 +169,30 @@ Spacing_problem::try_initial_solution() const Vector initsol(dim); for (int i=0; i < dim; i++) { if (cols[i].fixed()) { - initsol(i)=cols[i].fixed_position(); + initsol(i)=cols[i].fixed_position(); + + if (i > 0) { + Real r =initsol(i-1) + cols[i-1].minright(); + if (initsol(i) < r ) { + warning("overriding fixed position"); + initsol(i) =r; + } + } + } else { Real mindist=cols[i-1].minright() +cols[i].minleft(); - assert(mindist >= 0.0); + if (mindist < 0.0) + warning("Excentric column"); initsol(i)=initsol(i-1)+mindist; - - //nog niet - //if (i>0) - // assert(initsol(i) > initsol(i-1)); } } return initsol; } + + + Vector Spacing_problem::find_initial_solution() const { @@ -170,9 +249,8 @@ Spacing_problem::make_constraints(Mixed_qp& lp) const Array Spacing_problem::solve() const { - print(); - OK(); assert(check_feasible()); + print(); Mixed_qp lp(cols.size()); make_matrices(lp.quad,lp.lin, lp.const_term); @@ -182,10 +260,12 @@ Spacing_problem::solve() const if (!check_constraints(sol)) { WARN << "solution doesn't satisfy constraints.\n" ; } - + Real energy_f =lp.eval(sol); + position_loose_cols(sol); Array posns(sol); - posns.push(lp.eval(sol)); + + posns.push(energy_f); return posns; } @@ -193,12 +273,50 @@ Spacing_problem::solve() const add one column to the problem. */ void -Spacing_problem::add_column(PCol const *col, bool fixed, Real fixpos) +Spacing_problem::add_column(PCol *col, bool fixed, Real fixpos) { Colinfo c(col,(fixed)? &fixpos : 0); + if (cols.size()) + c.rank_i_ = cols.top().rank_i_+1; + else + c.rank_i_ = 0; cols.push(c); } +Array +Spacing_problem::error_pcol_l_arr()const +{ + Array retval; + for (int i=0; i< cols.size(); i++) + if (cols[i].ugh_b_) + retval.push(cols[i].pcol_l_); + for (int i=0; i < loose_col_arr_.size(); i++) { + retval.push(loose_col_arr_[i].pcol_l_); + } + return retval; +} + +void +Spacing_problem::loosen_column(int i) +{ + Colinfo c=cols.get(i); + for (int i=0; i < ideals.size(); ) { + Idealspacing const *i_l =ideals[i]; + if (i_l->left == c.pcol_l_ || i_l->right == c.pcol_l_) + ideals.del(i); + else + i++; + } + c.ugh_b_ = true; + + int i=0; + for (; i < loose_col_arr_.size(); i++) { + if (loose_col_arr_[i].rank_i_ > c.rank_i_) + break; + } + loose_col_arr_.insert(c,i); +} + void Spacing_problem::add_ideal(Idealspacing const *i) { @@ -247,41 +365,24 @@ Colinfo::print() const mtor << "column { "; if (fixed()) mtor << "fixed at " << fixed_position()<<", "; - assert(pcol_); + assert(pcol_l_); mtor << "[" << minleft() << ", " << minright() << "]"; mtor <<"}\n"; #endif } -Colinfo::Colinfo(Colinfo const&c) +Colinfo::Colinfo(PCol *col_l, Real const *fixed_C) { - fixpos = (c.fixpos)?new Real(*c.fixpos):0; - pcol_ = c.pcol_; - width = c.width; + if (fixed_C) + fixpos_p_.set_l(fixed_C); + ugh_b_ = false; + pcol_l_ = col_l; + width = pcol_l_->width(); } -Colinfo::Colinfo(PCol const *col_p, Real const *fixed_r_p ) -{ - fixpos = (fixed_r_p)? new Real(*fixed_r_p) : 0; - pcol_ = col_p; - width = pcol_->width(); -} - -Colinfo::~Colinfo() -{ - delete fixpos; -} Colinfo::Colinfo() { - pcol_=0; - fixpos = 0; -} -void -Colinfo::operator=(Colinfo const&c ) -{ - delete fixpos; - fixpos = (c.fixpos)?new Real(*c.fixpos):0; - pcol_ = c.pcol_; - width = c.width; + ugh_b_ = false; + pcol_l_ =0; } diff --git a/lily/p-col.cc b/lily/p-col.cc index e1c286da70..ae39bdda9a 100644 --- a/lily/p-col.cc +++ b/lily/p-col.cc @@ -101,6 +101,7 @@ PCol::breakable_b() const PCol::PCol(PCol *parent) { + error_mark_b_ = false; daddy_l_ = parent; prebreak_p_=0; postbreak_p_=0; diff --git a/lily/p-score.cc b/lily/p-score.cc index 184e90db3f..24421334ab 100644 --- a/lily/p-score.cc +++ b/lily/p-score.cc @@ -228,17 +228,21 @@ PScore::add_broken(Spanner*s) } void -PScore::set_breaking(Array breaking) +PScore::set_breaking(Array const &breaking) { for (int j=0; j < breaking.size(); j++) { - Array &curline(breaking[j].cols); - Array &config(breaking[j].config); + const Array &curline(breaking[j].cols); + const Array &errors(breaking[j].error_col_l_arr_); + const Array &config(breaking[j].config); Line_of_score *s_p = new Line_of_score(curline,this); + s_p->error_mark_b_ = breaking[j].ugh_b_; lines.bottom().add(s_p); for (int i=0; i < curline.size(); i++){ curline[i]->hpos = config[i]; } + for (int i=0; i < errors.size(); i++) + errors[i]->error_mark_b_ = true; } } diff --git a/lily/scoreline.cc b/lily/scoreline.cc index 65c6546b5a..d1837b4a67 100644 --- a/lily/scoreline.cc +++ b/lily/scoreline.cc @@ -1,3 +1,11 @@ +/* + scoreline.cc -- implement Line_of_score + + source file of the LilyPond music typesetter + + (c) 1996, 1997 Han-Wen Nienhuys +*/ + #include "scoreline.hh" #include "staffline.hh" #include "dimen.hh" @@ -12,6 +20,8 @@ String Line_of_score::TeXstring() const { String s("\\vbox{%<- line of score\n"); + if (error_mark_b_) + s+= "\\scorelineerrormark"; for (iter_top(staffs,sc); sc.ok(); sc++){ s += sc->TeXstring(); if ((sc+1).ok()) @@ -25,6 +35,7 @@ Line_of_score::TeXstring() const Line_of_score::Line_of_score(Array sv, PScore *ps) { + error_mark_b_ = 0; pscore_l_ = ps; for (int i=0; i< sv.size(); i++) { PCol *p=(PCol *) sv[i]; diff --git a/lily/staffline.cc b/lily/staffline.cc index 742cee60c2..c5e17bc7fc 100644 --- a/lily/staffline.cc +++ b/lily/staffline.cc @@ -41,7 +41,9 @@ Line_of_staff::TeXstring() const // moveover if (delta) s +=String( "\\kern ") + print_dimen(delta); - + if (cc->error_mark_b_) { + s += String("\\columnerrormark"); + } // now output the items. for (iter_top(cc->its,i); i.ok(); i++) { if (i->pstaff_l_ == pstaff_l_) diff --git a/lily/stem.cc b/lily/stem.cc index da00ece26e..7fb36e3005 100644 --- a/lily/stem.cc +++ b/lily/stem.cc @@ -202,9 +202,6 @@ Molecule* Stem::brew_molecule_p()const { Molecule *out =0; - if (invisible_b() && ! rest_l_arr_.size()) - warning("Empty stem. Ugh!"); - if ( invisible_b() ) return Staff_elem::brew_molecule_p(); diff --git a/lily/wordwrap.cc b/lily/wordwrap.cc index 3738235df9..2fd2fc4e94 100644 --- a/lily/wordwrap.cc +++ b/lily/wordwrap.cc @@ -39,17 +39,21 @@ Word_wrap::solve() // try to solve if (!feasible(current.cols)) { - if (!minimum.cols.size()) - error("sorry, this measure is too long, breakpoint: " - + String(break_idx_i) ); - current.energy = INFTY; // make sure we go back + if (!minimum.cols.size()) { + warning("Ugh, this measure is too long, breakpoint: " + + String(break_idx_i) + + " (generating stupido solution)"); + current = stupid_solution(current.cols); + current.energy = - 1; // make sure we break out. + } else + current.energy = INFTY; // make sure we go back } else { current = solve_line(current.cols); current.print(); } // update minimum, or backup. - if (current.energy < minimum.energy) { + if (current.energy < minimum.energy || current.energy < 0) { minimum = current; } else { // we're one col too far. break_idx_i--; diff --git a/make/Targets.make b/make/Targets.make index 8037be5e85..52f0f96e6a 100644 --- a/make/Targets.make +++ b/make/Targets.make @@ -71,6 +71,7 @@ endif ifdef alldeps rm -f $(alldeps) endif + rm -f core ifdef SUBDIRS set -e; for i in $(SUBDIRS); do $(MAKE) -C $$i clean; done endif diff --git a/make/lilypond.lsm b/make/lilypond.lsm index 00c79bcf92..ad7b4d70e2 100644 --- a/make/lilypond.lsm +++ b/make/lilypond.lsm @@ -2,8 +2,8 @@ Begin3 Title: LilyPond -Version: 0.0.61 -Entered-date: 05/12/97 +Version: 0.0.62 +Entered-date: 05/14/97 Description: LilyPond is a program which converts a music-script (mudela) into TeX output, or MIDI to produce multi-staff scores. Features include multiple meters, clefs, keys, lyrics, versatile input-language, cadenzas @@ -13,7 +13,7 @@ Author: hanwen@stack.nl (Han-Wen Nienhuys) jan@digicash.com (Jan Nieuwenhuizen) Maintained-by: hanwen@stack.nl (Han-Wen Nienhuys) Primary-site: pcnov095.win.tue.nl /pub/lilypond/ - 300k lilypond-0.0.61.tar.gz + 300k lilypond-0.0.62.tar.gz Alternate-site: Original-site: Platform: unix/win32, GNU C++ diff --git a/make/lilypond.spec b/make/lilypond.spec index 5e8fa68686..0d27a4884c 100644 --- a/make/lilypond.spec +++ b/make/lilypond.spec @@ -1,9 +1,9 @@ Name: lilypond -Version: 0.0.61 +Version: 0.0.62 Release: 1 Copyright: GPL Group: Applications/Publishing -Source0: pcnov095.win.tue.nl:/pub/lilypond/lilypond-0.0.61.tar.gz +Source0: pcnov095.win.tue.nl:/pub/lilypond/lilypond-0.0.62.tar.gz Summary: A preprocessor to make TeX typeset music. URL: http://www.stack.nl/~hanwen/lilypond Packager: Han-Wen Nienhuys @@ -11,10 +11,11 @@ Icon: lelie_icon.gif Buildroot: /tmp/lilypond_build %description -LilyPond is a program which converts a music-script (mudela) into -TeX output, or MIDI to produce multi-staff scores. Features include multiple -meters, clefs, keys, lyrics, versatile input-language, cadenzas -beams, slurs, triplets, multiple voices. +GNU LilyPond is a program which converts a music-script +(mudela) into TeX output, or MIDI to produce multi-staff +scores. Features include multiple meters, clefs, keys, lyrics, +versatile input-language, cadenzas beams, slurs, triplets, multiple +voices. %prep %setup @@ -22,10 +23,11 @@ beams, slurs, triplets, multiple voices. configure --enable-checking --disable-debugging --enable-printing --prefix=/usr --enable-optimise --enable-shared make all %install +rm -rf $RPM_BUILD_ROOT strip bin/lilypond bin/mi2mu make prefix="$RPM_BUILD_ROOT/usr" install %files -%doc Documentation/out/AUTHORS.text Documentation/out/CodingStyle.text Documentation/out/INSTALL.text Documentation/out/MANIFESTO.text Documentation/out/convert-mudela.text Documentation/out/error.text Documentation/out/examples.text Documentation/out/faq.text Documentation/out/index.text Documentation/out/language.text Documentation/out/lilygut.text Documentation/out/lilypond.text Documentation/out/mi2mu.text Documentation/out/mudela.text input/cadenza.ly input/collisions.ly input/coriolan-alto.ly input/error.ly input/header.ly input/kortjakje.ly input/pedal.ly input/rhythm.ly input/scales.ly input/scripts.ly input/scsii-menuetto.ly input/scsii-menuetto.tex input/slurs.ly input/standchen.ly input/standchen.tex input/toccata-fuga-E.ly input/twinkle.ly input/wohltemperirt.ly Documentation/lelie_logo.gif +%doc Documentation/out/AUTHORS.text Documentation/out/CodingStyle.text Documentation/out/INSTALL.text Documentation/out/MANIFESTO.text Documentation/out/convert-mudela.text Documentation/out/error.text Documentation/out/faq.text Documentation/out/index.text Documentation/out/language.text Documentation/out/lilygut.text Documentation/out/lilypond.text Documentation/out/mi2mu.text Documentation/out/mudela.text input/cadenza.ly input/collisions.ly input/coriolan-alto.ly input/error.ly input/header.ly input/keys.ly input/kortjakje.ly input/pedal.ly input/rhythm.ly input/scales.ly input/scripts.ly input/scsii-menuetto.ly input/scsii-menuetto.tex input/slurs.ly input/standchen.ly input/standchen.tex input/toccata-fuga-E.ly input/twinkle.ly input/wohltemperirt.ly Documentation/lelie_logo.gif /usr/bin/convert-mudela /usr/bin/lilypond /usr/lib/libflower.so diff --git a/make/lilypond.spec.in b/make/lilypond.spec.in index a30e634fbd..d4445a3906 100644 --- a/make/lilypond.spec.in +++ b/make/lilypond.spec.in @@ -11,10 +11,11 @@ Icon: lelie_icon.gif Buildroot: /tmp/lilypond_build %description -LilyPond is a program which converts a music-script (mudela) into -TeX output, or MIDI to produce multi-staff scores. Features include multiple -meters, clefs, keys, lyrics, versatile input-language, cadenzas -beams, slurs, triplets, multiple voices. +GNU LilyPond is a program which converts a music-script +(mudela) into TeX output, or MIDI to produce multi-staff +scores. Features include multiple meters, clefs, keys, lyrics, +versatile input-language, cadenzas beams, slurs, triplets, multiple +voices. %prep %setup @@ -22,6 +23,7 @@ beams, slurs, triplets, multiple voices. configure --enable-checking --disable-debugging --enable-printing --prefix=/usr --enable-optimise --enable-shared make all %install +rm -rf $RPM_BUILD_ROOT strip bin/lilypond bin/mi2mu make prefix="$RPM_BUILD_ROOT/usr" install %files diff --git a/mi2mu/.version b/mi2mu/.version index 8ebe023f19..af965a51c4 100644 --- a/mi2mu/.version +++ b/mi2mu/.version @@ -1,6 +1,6 @@ MAJOR_VERSION = 0 MINOR_VERSION = 0 -PATCH_LEVEL = 14 +PATCH_LEVEL = 15 # use to send patches, always empty for released version: -MY_PATCH_LEVEL = # include separator: "-1" or ".a" +MY_PATCH_LEVEL = # diff --git a/mi2mu/Makefile b/mi2mu/Makefile index 901111dd24..1009a20bc4 100644 --- a/mi2mu/Makefile +++ b/mi2mu/Makefile @@ -79,4 +79,6 @@ DEPFILES = $(wildcard $(depdir)/*.dep) # -include /dev/null $(DEPFILES) # +localclean: + rm -f $(outdir)/{midi-parser,midi-lexer}.* diff --git a/mi2mu/include/midi-event.hh b/mi2mu/include/midi-event.hh index 2d57aa8336..928851e808 100644 --- a/mi2mu/include/midi-event.hh +++ b/mi2mu/include/midi-event.hh @@ -38,7 +38,8 @@ private: class Midi_note : public Midi_event { public: - int const c0_pitch_i_c_ = 60; +// int const c0_pitch_i_c_ = 60; // huh? + int const c0_pitch_i_c_ = 48; Midi_note( String name_str, Duration dur ); virtual Moment mom(); diff --git a/mi2mu/include/midi-score.hh b/mi2mu/include/midi-score.hh index 08cd69b845..8c9d38bca7 100644 --- a/mi2mu/include/midi-score.hh +++ b/mi2mu/include/midi-score.hh @@ -18,7 +18,7 @@ public: void process(); private: - IPointerList midi_track_p_list_; + IPointer_list midi_track_p_list_; int format_i_; int tracks_i_; int tempo_i_; diff --git a/mi2mu/include/midi-track.hh b/mi2mu/include/midi-track.hh index 5173c93532..5e3394da35 100644 --- a/mi2mu/include/midi-track.hh +++ b/mi2mu/include/midi-track.hh @@ -28,21 +28,20 @@ public: String name_str_; Midi_tempo* midi_tempo_p_; Midi_time* midi_time_p_; + int number_i_; private: - void add_begin_at( PointerList& open_voices_r, Moment mom ); + void add_begin_at( Pointer_list& open_voices_r, Moment mom ); int check_begin_bar_i( Moment now_mom, int open_bar_i ); int check_end_bar_i( Moment now_mom, int open_bar_i ); Midi_voice* get_free_midi_voice_l( Moment mom ); - void remove_end_at( PointerList& open_voices_r, Moment mom ); + void remove_end_at( Pointer_list& open_voices_r, Moment mom ); void output_mudela_begin_bar( Lily_stream& lily_stream_r, Moment now_mom, int bar_i ); void output_mudela_rest( Lily_stream& lily_stream_r, Moment begin_mom, Moment end_mom ); void output_mudela_rest_remain( Lily_stream& lily_stream_r, Moment mom ); - IPointerList tcol_p_list_; - IPointerList midi_voice_p_list_; - int number_i_; - + IPointer_list tcol_p_list_; + IPointer_list midi_voice_p_list_; }; #endif // MIDI_TRACK_HH diff --git a/mi2mu/include/midi-voice.hh b/mi2mu/include/midi-voice.hh index cf3df84171..6cadebfccb 100644 --- a/mi2mu/include/midi-voice.hh +++ b/mi2mu/include/midi-voice.hh @@ -3,10 +3,10 @@ // // copyright 1997 Jan Nieuwenhuizen -/// (midi_voice) #ifndef MIDI_VOICE_HH #define MIDI_VOICE_HH +/// (midi_voice) class Midi_voice { public: Midi_voice( Moment begin_mom ); @@ -15,11 +15,14 @@ public: Moment begin_mom(); Moment end_mom(); - String mudela_str( Moment from_mom, Moment to_mom, bool multiple_bo ); + String mudela_str( Moment to_mom, Moment to_mom, bool multiple_bo ); + // ARE you sure? ^^ ^^ private: - Moment begin_mom_; - IPointerList midi_event_p_list_; + int events_i_; + Moment end_mom_; + Moment begin_mom_; + IPointer_list midi_event_p_list_; }; #endif // MIDI_VOICE_HH diff --git a/mi2mu/include/track-column.hh b/mi2mu/include/track-column.hh index 0ed0323a97..c1126437e6 100644 --- a/mi2mu/include/track-column.hh +++ b/mi2mu/include/track-column.hh @@ -15,7 +15,7 @@ public: Moment mom(); //private: - IPointerList midi_event_p_list_; + IPointer_list midi_event_p_list_; Moment mom_; }; diff --git a/mi2mu/lily-stream.cc b/mi2mu/lily-stream.cc index 8e6806564b..5bae914fec 100644 --- a/mi2mu/lily-stream.cc +++ b/mi2mu/lily-stream.cc @@ -107,7 +107,7 @@ Lily_stream::header() *os_p_ << "% from input file: "; *os_p_ << midi_parser_l_g->filename_str_; *os_p_ << "\n\n"; - *os_p_ << "\\version \"0.0.58\";\n"; + *os_p_ << "\\version \"0.0.57\";\n"; } /* snapnie: dit kan toch automaties? Zie ook dstream. diff --git a/mi2mu/main.cc b/mi2mu/main.cc index 33fab2906f..06589c7891 100644 --- a/mi2mu/main.cc +++ b/mi2mu/main.cc @@ -30,7 +30,7 @@ usage() " -d, --debug print lots of debugging stuff\n" " -h, --help this help\n" " -I, --include=DIR add DIR to search path\n" - " -n, --no-silly assume no plets or double dots, smallest is 16\n" + " -n, --no-silly assume no plets or double dots, smallest is 32\n" " -o, --output=FILE set FILE as default output\n" " -p, --no-plets assume no plets\n" " -q, --quiet be quiet\n" @@ -54,9 +54,8 @@ notice() "\n" "Mi2mu, translate midi to mudela.\n" "Copyright (C) 1997 by\n" - " Han-Wen Nienhuys \n" -// "Contributors\n" " Jan Nieuwenhuizen \n" + " Han-Wen Nienhuys \n" "\n" " This program is free software; you can redistribute it and/or\n" "modify it under the terms of the GNU General Public License version 2\n" @@ -112,7 +111,7 @@ main( int argc_i, char* argv_sz_a[] ) case 'n': Duration_convert::no_double_dots_b_s = true; Duration_convert::no_triplets_b_s = true; - Duration_convert::no_smaller_than_i_s = 16; + Duration_convert::no_smaller_than_i_s = 32; break; case 'o': output_str = getopt_long.optarg; diff --git a/mi2mu/midi-event.cc b/mi2mu/midi-event.cc index d0715208ef..028730acac 100644 --- a/mi2mu/midi-event.cc +++ b/mi2mu/midi-event.cc @@ -80,7 +80,13 @@ Midi_key::notename_str( int pitch_i ) } // statics Midi_note -bool const Midi_note::simple_plet_b_s = false; +/* + this switch can be used to write simple plets like + c4*2/3 + as + \plet{ 2/3 } c4 \plet{ 1/1 } + */ +bool const Midi_note::simple_plet_b_s = true; Midi_note::Midi_note( String name_str, Duration dur ) { diff --git a/mi2mu/midi-score.cc b/mi2mu/midi-score.cc index d8bc7bb276..28cb7dae55 100644 --- a/mi2mu/midi-score.cc +++ b/mi2mu/midi-score.cc @@ -26,6 +26,10 @@ int Midi_score::output_mudela( String filename_str ) { tor( NORMAL_ver ) << "Lily output to " << filename_str << " ..." << endl; + + // ugh, ugly midi type 1 fix + if ( ( midi_track_p_list_.size() == 1 ) && !midi_track_p_list_.top()->number_i_ ) + midi_track_p_list_.top()->number_i_ = 1; int track_i = 0; Lily_stream lily_stream( filename_str ); diff --git a/mi2mu/midi-track.cc b/mi2mu/midi-track.cc index 436bec8aa3..07f57c0a67 100644 --- a/mi2mu/midi-track.cc +++ b/mi2mu/midi-track.cc @@ -10,10 +10,7 @@ Midi_track::Midi_track( int number_i, String copyright_str, String track_name_st number_i_ = number_i; copyright_str_ = copyright_str; instrument_str_ = instrument_str; - if ( track_name_str.length_i() ) - name_str_ = track_name_str; - else - name_str_ = String( "track" ) + String( number_i_ ); + name_str_ = track_name_str; midi_time_p_ = new Midi_time( 4, 2, 24, 8 ); midi_tempo_p_ = new Midi_tempo( 1000000 ); tcol_p_list_.bottom().add( new Track_column( Moment( 0 ) ) ); @@ -26,7 +23,7 @@ Midi_track::~Midi_track() } void -Midi_track::add_begin_at( PointerList& open_voices_r, Moment mom ) +Midi_track::add_begin_at( Pointer_list& open_voices_r, Moment mom ) { for ( PCursor i( midi_voice_p_list_.top() ); i.ok(); i++ ) if ( i->begin_mom() == mom ) { @@ -90,11 +87,12 @@ Midi_track::get_free_midi_voice_l( Moment mom ) return midi_voice_l; } -// too much red tape? String Midi_track::name_str() { - return name_str_; + if ( name_str_.length_i() ) + return name_str_; + return String( "track" ) + String( number_i_ ); } Moment @@ -122,6 +120,9 @@ Midi_track::next_end_mom( Moment now_mom ) void Midi_track::process() { + /* + columns to voices + */ int bar_i = 1; for ( PCursor i( tcol_p_list_.top() ); i.ok(); i++ ) { int begin_bar_i = check_begin_bar_i( i->mom(), bar_i ); @@ -143,7 +144,7 @@ Midi_track::process() void Midi_track::output_mudela( Lily_stream& lily_stream_r ) { - lily_stream_r << name_str_ << " = \\melodic{"; + lily_stream_r << name_str() << " = \\melodic{"; lily_stream_r.indent(); lily_stream_r << "% midi copyright:" << copyright_str_; lily_stream_r.newline(); @@ -152,9 +153,28 @@ Midi_track::output_mudela( Lily_stream& lily_stream_r ) int bar_i = 0; - PointerList open_voices; + Pointer_list open_voices; Moment now_mom = 0.0; - /// ugh, avoid status track 0... + Real now_f = now_mom; + Real begin_f = 0; + Real end_f = end_mom(); + Real then_f; + + /* + now we step through time while writing all voices + + we can only output time slices that have a constant + number of open voices; each begin or end of a voice + starts or ends a chord or multivoice + + [todo] + voice defragmentation/concatenation could make this + lost blonder + */ + + bool start_of_track_bo = true; + + /// ugh, avoid status track 0 full of rests... while ( number_i_ && ( now_mom < end_mom() ) ) { int begin_bar_i = check_begin_bar_i( now_mom, bar_i ); if ( begin_bar_i ) @@ -176,19 +196,33 @@ Midi_track::output_mudela( Lily_stream& lily_stream_r ) tor( DEBUG_ver ) << "begin: " << begin_mom << " end: " << end_mom << endl; tor( DEBUG_ver ) << "slice: " << now_mom << ", " << then_mom << endl; -// rests, ugh - String str; -// if ( !open_voices.size() ) -// output_mudela_rest( lily_stream_r, now_mom, then_mom ); + now_f = now_mom; + begin_f = begin_mom; + end_f = end_mom; + then_f = then_mom; + +// ugh, rests +// checking for no open voice does not work for initial rests. +// for some reason the voice is open, but does not procuce notes? if ( open_voices.size() > 1 ) lily_stream_r << "< "; - for ( PCursor i( open_voices.top() ); i.ok(); i++ ) -// lily_stream_r << i->mudela_str( now_mom, then_mom, open_voices.size() - 1 ); - str += i->mudela_str( now_mom, then_mom, open_voices.size() - 1 ); - if ( str.length_i() ) - lily_stream_r << str; - else - output_mudela_rest( lily_stream_r, now_mom, then_mom ); + if ( start_of_track_bo ) { + start_of_track_bo = false; + String str; + for ( PCursor i( open_voices.top() ); i.ok(); i++ ) + lily_stream_r << i->mudela_str( now_mom, then_mom, open_voices.size() - 1 ); + if ( str.length_i() ) + lily_stream_r << str; + else + output_mudela_rest( lily_stream_r, now_mom, then_mom ); + } + else { + for ( PCursor i( open_voices.top() ); i.ok(); i++ ) + lily_stream_r << i->mudela_str( now_mom, then_mom, open_voices.size() - 1 ); + if ( !open_voices.size() ) + output_mudela_rest( lily_stream_r, now_mom, then_mom ); + } +// *lily_stream_r.os_p_ << flush; if ( open_voices.size() > 1 ) lily_stream_r << "> "; @@ -202,7 +236,7 @@ Midi_track::output_mudela( Lily_stream& lily_stream_r ) tor( NORMAL_ver ) << '[' << bar_i << ']' << flush; lily_stream_r.tnedni(); - lily_stream_r << "} % " << name_str_; + lily_stream_r << "} % " << name_str(); lily_stream_r.newline(); } @@ -229,58 +263,80 @@ Midi_track::output_mudela_rest( Lily_stream& lily_stream_r, Moment begin_mom, Mo { Moment bar_mom = midi_time_p_->bar_mom(); Moment now_mom = begin_mom; - int begin_bar_i =(int)( now_mom / bar_mom ) + 1; - Moment remain_mom = now_mom - Moment( begin_bar_i - 1 ) * bar_mom; - if ( remain_mom > Moment( 0 ) ) - output_mudela_rest_remain( lily_stream_r, remain_mom ); + int begin_bar_i = (int)( now_mom / bar_mom ) + 1; int end_bar_i = (int)( end_mom / bar_mom ) + 1; - now_mom += remain_mom; + if ( end_bar_i == begin_bar_i ) { + output_mudela_rest_remain( lily_stream_r, end_mom - begin_mom ); + return; + } + + // multiple bars involved int bar_i = (int)( now_mom / bar_mom ) + 1; - bar_i = check_end_bar_i( now_mom, bar_i ); - for ( int i = 0; i < end_bar_i - begin_bar_i; i++ ) { + + //fill current bar + Moment begin_bar_mom = Moment( begin_bar_i - 1 ) * bar_mom; + if ( now_mom > begin_bar_mom ) { + int next_bar_i = (int)( now_mom / bar_mom ) + 2; + Moment next_bar_mom = Moment( next_bar_i - 1 ) * bar_mom; + assert( next_bar_mom <= end_mom ); + + Moment remain_mom = next_bar_mom - now_mom; + if ( remain_mom > Moment( 0 ) ) { + output_mudela_rest_remain( lily_stream_r, remain_mom ); + now_mom += remain_mom; + } + + bar_i = check_end_bar_i( now_mom, bar_i ); + } + + // fill whole bars + int count_i = end_bar_i - bar_i; + for ( int i = 0; i < count_i; i++ ) { int begin_bar_i = check_begin_bar_i( now_mom, bar_i ); if ( begin_bar_i ) output_mudela_begin_bar( lily_stream_r, now_mom, begin_bar_i ); lily_stream_r << "r1 "; +// *lily_stream_r.os_p_ << flush; tor( NORMAL_ver ) << begin_bar_i << flush; bar_i = check_end_bar_i( now_mom, bar_i ); now_mom += bar_mom; } + // use "int i" here, and gcc 2.7.2 hits internal compiler error int ii = check_begin_bar_i( now_mom, bar_i ); if ( ii ) output_mudela_begin_bar( lily_stream_r, now_mom, ii ); - bar_i = check_end_bar_i( now_mom, bar_i ); - remain_mom = end_mom - Moment( end_bar_i - 1 ) * bar_mom; - if ( remain_mom > Moment( 0 ) ) +// bar_i = check_end_bar_i( now_mom, bar_i ); + + Moment remain_mom = end_mom - Moment( end_bar_i - 1 ) * bar_mom; + if ( remain_mom > Moment( 0 ) ) { output_mudela_rest_remain( lily_stream_r, remain_mom ); + now_mom += remain_mom; + } + assert( now_mom == end_mom ); } - void Midi_track::output_mudela_rest_remain( Lily_stream& lily_stream_r, Moment mom ) { - int type_i = 2; - while ( mom > Moment( 0 ) ) { - Duration dur( type_i ); - Moment type_mom = Duration_convert::dur2_mom( dur ); - int count_i = (int)( mom / type_mom ); - for( int i = 0; i < count_i; i++ ) - lily_stream_r << "r" << dur.str() << " "; - type_i *= 2; - mom -= Moment( count_i ) * type_mom; - if ( Duration_convert::no_smaller_than_i_s - && ( type_i > Duration_convert::no_smaller_than_i_s ) ) - break; + if ( Duration_convert::no_quantify_b_s ) { + Duration dur = Duration_convert::mom2_dur( mom ); + lily_stream_r << "r" << dur.str() << " "; +// assert( mom == dur.mom() ); + assert( mom == dur.length() ); + return; } - + + Duration dur = Duration_convert::mom2standardised_dur( mom ); + if ( dur.type_i_ ) + lily_stream_r << "r" << dur.str() << " "; } void -Midi_track::remove_end_at( PointerList& open_voices_r, Moment mom ) +Midi_track::remove_end_at( Pointer_list& open_voices_r, Moment mom ) { for ( PCursor i( open_voices_r.top() ); i.ok(); i++ ) // if ( i->end_mom() == mom ) { } diff --git a/mi2mu/midi-voice.cc b/mi2mu/midi-voice.cc index 5d476ddcc5..21cac0482c 100644 --- a/mi2mu/midi-voice.cc +++ b/mi2mu/midi-voice.cc @@ -8,6 +8,8 @@ Midi_voice::Midi_voice( Moment begin_mom ) { begin_mom_ = begin_mom; + end_mom_ = begin_mom; + events_i_ = 0; } void @@ -25,6 +27,9 @@ Midi_voice::begin_mom() Moment Midi_voice::end_mom() { +// if ( events_i_ == midi_event_p_list_.length_i() ) + if ( events_i_ == midi_event_p_list_.size() ) + return end_mom_; Moment now_mom = begin_mom_; tor( DEBUG_ver ) << now_mom << ", "; for ( PCursor i( midi_event_p_list_.top() ); i.ok(); i++ ) { @@ -32,7 +37,10 @@ Midi_voice::end_mom() now_mom += i->mom(); } tor( DEBUG_ver ) << endl; - return now_mom; + end_mom_ = now_mom; +// events_i_ = midi_event_p_list_.length_i(); + events_i_ = midi_event_p_list_.size(); + return end_mom_; } String diff --git a/mi2mu/version.cc b/mi2mu/version.cc index 3eb7e4d25c..03b78e14eb 100644 --- a/mi2mu/version.cc +++ b/mi2mu/version.cc @@ -6,7 +6,7 @@ const char * mi2mu_version_sz(); String mi2mu_version_str() { - return String ( "This is " ) + mi2mu_version_sz() + return String( mi2mu_version_sz()) + "/" + flower_version_sz() + " of " + __DATE__ + " " + __TIME__; } diff --git a/tex/lilyponddefs.tex b/tex/lilyponddefs.tex index ca18e61502..d602bb3a14 100644 --- a/tex/lilyponddefs.tex +++ b/tex/lilyponddefs.tex @@ -136,6 +136,8 @@ \mdef\eighthrest{63} \mdef\sixteenthrest{64} \mdef\thirtysecondrest{65} +\mdef\sixtyfourthrest{66} +\mdef\hundredtwentyeighthrest{67} \mdef\sharp{52} \mdef\flat{50} \mdef\natural{54} @@ -154,14 +156,18 @@ \mdef\cbassclef{74} \mdef\caltoclef{76} -\mdef\deigthflag{45} +\mdef\deighthflag{45} \mdef\dsixteenthflag{46} \mdef\dthirtysecondflag{47} +\mdef\dsixtyfourthflag{48} +\mdef\dhundredtwentyeighthflag{49} % pointing up -\mdef\ueigthflag{40} +\mdef\ueighthflag{40} \mdef\usixteenthflag{41} \mdef\uthirtysecondflag{42} +\mdef\usixtyfourthflag{43} +\mdef\uhundredtwentyeighthflag{44} \maccentdef\repeatcolon{55}{2/1} \def\emptybar{} @@ -222,14 +228,18 @@ % bottom at baseline \def\linestafsym#1#2{\leftalign{\botalign{\lines{#1}{#2}}}} -\def\eigthflag{\topalign{\ueigthflag}} +\def\eighthflag{\topalign{\ueighthflag}} \def\sixteenthflag{\topalign{\usixteenthflag}} \def\thirtysecondflag{\topalign{\uthirtysecondflag}} +\def\sixtyfourthflag{\topalign{\usixtyfourthflag}} +\def\hundredtwentyeighthflag{\topalign{\uhundredtwentyeighthflag}} \def\cquartrest{\vertcenter\quartrest} \def\ceighthrest{\vertcenter\eighthrest} \def\csixteenthrest{\vertcenter\sixteenthrest} \def\cthirtysecondrest{\vertcenter\thirtysecondrest} +\def\csixtyfourthrest{\vertcenter\sixtyfourthrest} +\def\chundredtwentyeighthrest{\vertcenter\hundredtwentyeighthrest} \def\lsingledot{\kern-\notewidth\singledot} \def\ldoubledot{\kern-\notewidth\doubledot} @@ -292,3 +302,5 @@ +\def\columnerrormark{\placebox{-5pt}{0pt}{\bf C!}} +\def\linescoreerrormark{\placebox{0pt}{-10pt}{\bf L!}}