From f374663d1f993ba98c784afc6df1c9b50ba8fcc7 Mon Sep 17 00:00:00 2001 From: Jan Nieuwenhuizen Date: Wed, 19 Sep 2001 21:38:44 +0200 Subject: [PATCH] patch::: 1.5.10.jcn2 1.5.10.jcn2 --- CHANGES | 4 +- Documentation/windows/cygwin-installer.patch | 178 ++++++++------- VERSION | 2 +- flower/rational.cc | 6 + midi2ly/duration-convert.cc | 85 +++---- midi2ly/duration-iter.cc | 107 --------- midi2ly/include/duration-iter.hh | 39 ---- midi2ly/include/lilypond-column.hh | 2 +- midi2ly/include/lilypond-item.hh | 2 +- midi2ly/include/lilypond-score.hh | 2 +- midi2ly/include/lilypond-staff.hh | 2 +- midi2ly/include/lilypond-stream.hh | 2 +- midi2ly/include/lilypond-voice.hh | 13 +- midi2ly/include/midi2ly-global.hh | 2 +- midi2ly/lilypond-column.cc | 2 +- midi2ly/lilypond-item.cc | 59 +++-- midi2ly/lilypond-score.cc | 4 +- midi2ly/lilypond-staff.cc | 221 +++---------------- midi2ly/lilypond-voice.cc | 74 +++++-- midi2ly/main.cc | 2 +- midi2ly/midi2ly-version.cc | 2 +- 21 files changed, 297 insertions(+), 513 deletions(-) diff --git a/CHANGES b/CHANGES index 6e009fd549..224fb6764e 100644 --- a/CHANGES +++ b/CHANGES @@ -1,6 +1,8 @@ -1.5.10.jcn1 +1.5.10.jcn2 ========== +* midi2ly: support chords, duration conversion rewrite. + * parser.yy: Guile > 1.4 compilation fix; scm_unprotect_object is deprecated. 1.5.10 diff --git a/Documentation/windows/cygwin-installer.patch b/Documentation/windows/cygwin-installer.patch index 91fd1871fc..ffc7613c74 100644 --- a/Documentation/windows/cygwin-installer.patch +++ b/Documentation/windows/cygwin-installer.patch @@ -1,29 +1,23 @@ -diff -urN ../cinstall/Makefile.in ./Makefile.in ---- ../cinstall/Makefile.in Thu Feb 8 05:55:22 2001 -+++ ./Makefile.in Thu Apr 12 11:41:37 2001 -@@ -130,11 +130,15 @@ - @chmod a-x $@ - - clean: -- rm -f *.o *.rc $(PROGS) -- $(MAKE) -C zlib clean -+ rm -f *.o $(PROGS) -+ $(MAKE) -C zlib $@ +Binary files ../cinstall/LilyPond.ico and ./LilyPond.ico differ +diff -purN ../cinstall/Makefile.in ./Makefile.in +--- ../cinstall/Makefile.in Fri Jun 1 05:56:01 2001 ++++ ./Makefile.in Thu Sep 13 21:38:27 2001 +@@ -135,8 +135,9 @@ clean: + $(MAKE) -C zlib clean realclean: clean - rm -f Makefile config.cache +- + rm -f Makefile *.d + rm -f config.cache config.log config.status -+ rm -f inilex.c iniparse.c iniparse.h version.c -+ -+distclean: realclean - ++ install: all $(SHELL) $(updir1)/mkinstalldirs $(bindir) $(etcdir) -diff -urN ../cinstall/desktop.cc ./desktop.cc ---- ../cinstall/desktop.cc Sat Nov 11 05:55:16 2000 -+++ ./desktop.cc Thu Apr 12 11:39:52 2001 -@@ -79,9 +79,7 @@ + for i in $(PROGS) ; do \ +diff -purN ../cinstall/desktop.cc ./desktop.cc +--- ../cinstall/desktop.cc Tue Aug 14 05:55:37 2001 ++++ ./desktop.cc Thu Sep 13 21:37:38 2001 +@@ -76,9 +76,7 @@ static char *etc_profile[] = { "done", "", "export MAKE_MODE=unix", @@ -34,7 +28,7 @@ diff -urN ../cinstall/desktop.cc ./desktop.cc "", "cd \"$HOME\"", "", -@@ -197,6 +195,30 @@ +@@ -194,6 +192,30 @@ make_cygwin_bat () } static void @@ -64,23 +58,20 @@ diff -urN ../cinstall/desktop.cc ./desktop.cc +static void make_etc_profile () { - char *fname = concat (get_root_dir (), "/etc/profile", 0); -@@ -299,11 +321,11 @@ + char *fname = cygpath ("/etc/profile", 0); +@@ -290,9 +312,9 @@ make_passwd_group () } static void -save_icon () +save_icon (char* iconfile, char* iconres) { -- iconname = backslash (concat (get_root_dir (), "/cygwin.ico", 0)); +- iconname = backslash (cygpath ("/cygwin.ico", 0)); + iconname = backslash (concat (get_root_dir (), iconfile, 0)); -- HRSRC rsrc = FindResource (NULL, "CYGWIN.ICON", "FILE"); -+ HRSRC rsrc = FindResource (NULL, iconres, "FILE"); + HRSRC rsrc = FindResource (NULL, "CYGWIN.ICON", "FILE"); if (rsrc == NULL) - { - fatal ("FindResource failed"); -@@ -323,7 +345,7 @@ +@@ -314,7 +336,7 @@ save_icon () static void do_desktop_setup() { @@ -89,7 +80,7 @@ diff -urN ../cinstall/desktop.cc ./desktop.cc make_cygwin_bat (); make_etc_profile (); -@@ -335,6 +357,17 @@ +@@ -326,6 +348,17 @@ do_desktop_setup() if (root_desktop) { desktop_icon ("Cygwin", batname); @@ -107,10 +98,10 @@ diff -urN ../cinstall/desktop.cc ./desktop.cc } } -diff -urN ../cinstall/ini.cc ./ini.cc ---- ../cinstall/ini.cc Thu Oct 5 05:55:27 2000 -+++ ./ini.cc Thu Apr 12 11:39:52 2001 -@@ -174,7 +174,7 @@ +diff -purN ../cinstall/ini.cc ./ini.cc +--- ../cinstall/ini.cc Thu Jun 14 05:55:26 2001 ++++ ./ini.cc Thu Sep 13 21:27:48 2001 +@@ -175,7 +175,7 @@ fprintf (FILE *f, const char *fmt, ...) { *nl = 0; /*OutputDebugString (stderrbuf);*/ @@ -118,11 +109,11 @@ diff -urN ../cinstall/ini.cc ./ini.cc + MessageBox (0, buf, "GNU LilyPond Cygwin Setup", 0); stderrbuf[0] = 0; } - -diff -urN ../cinstall/msg.cc ./msg.cc + +diff -purN ../cinstall/msg.cc ./msg.cc --- ../cinstall/msg.cc Sat Aug 26 05:55:14 2000 -+++ ./msg.cc Thu Apr 12 11:39:52 2001 -@@ -44,7 +44,7 @@ ++++ ./msg.cc Thu Sep 13 21:27:48 2001 +@@ -44,7 +44,7 @@ mbox (char *name, int type, int id, va_l vsprintf (buf, fmt, args); log (0, "mbox %s: %s", name, buf); @@ -131,10 +122,10 @@ diff -urN ../cinstall/msg.cc ./msg.cc } void -diff -urN ../cinstall/res.rc ./res.rc ---- ../cinstall/res.rc Wed Mar 7 18:13:31 2001 -+++ ./res.rc Fri Apr 13 16:06:40 2001 -@@ -30,10 +30,10 @@ +diff -purN ../cinstall/res.rc ./res.rc +--- ../cinstall/res.rc Thu Jul 5 05:55:22 2001 ++++ ./res.rc Thu Sep 13 21:36:25 2001 +@@ -30,10 +30,10 @@ LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_U IDD_SOURCE DIALOG DISCARDABLE 0, 0, 215, 95 STYLE DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU @@ -144,11 +135,15 @@ diff -urN ../cinstall/res.rc ./res.rc BEGIN - ICON IDI_CYGWIN,-1,5,5,20,20 + ICON IDI_LILYPOND,-1,5,5,20,20 - CONTROL "&Download from Internet",IDC_SOURCE_DOWNLOAD,"Button", - BS_AUTORADIOBUTTON,55,15,152,10 CONTROL "&Install from Internet",IDC_SOURCE_NETINST,"Button", -@@ -49,7 +49,7 @@ - CAPTION "Local package directory" + BS_AUTORADIOBUTTON,55,15,75,10 + CONTROL "&Download from Internet",IDC_SOURCE_DOWNLOAD,"Button", +@@ -46,10 +46,10 @@ END + + IDD_LOCAL_DIR DIALOG DISCARDABLE 0, 0, 215, 95 + STYLE DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU +-CAPTION "Cygwin Setup" ++CAPTION "GNU LilyPond Setup" FONT 8, "MS Sans Serif" BEGIN - ICON IDI_CYGWIN,IDC_STATIC,5,5,20,20 @@ -156,7 +151,7 @@ diff -urN ../cinstall/res.rc ./res.rc PUSHBUTTON "B&rowse...",IDC_LOCAL_DIR_BROWSE,150,10,34,14 LTEXT "Local Package &Directory",IDC_STATIC,55,15,85,11 EDITTEXT IDC_LOCAL_DIR,55,25,127,12,ES_AUTOHSCROLL -@@ -60,10 +60,10 @@ +@@ -60,10 +60,10 @@ END IDD_ROOT DIALOG DISCARDABLE 0, 0, 215, 95 STYLE DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU @@ -169,7 +164,7 @@ diff -urN ../cinstall/res.rc ./res.rc PUSHBUTTON "B&rowse...",IDC_ROOT_BROWSE,150,10,34,14 LTEXT "Select install root &directory",IDC_STATIC,55,15,85,11 EDITTEXT IDC_ROOT_DIR,55,25,127,12,ES_AUTOHSCROLL -@@ -84,10 +84,10 @@ +@@ -84,10 +84,10 @@ END IDD_SITE DIALOG DISCARDABLE 0, 0, 222, 206 STYLE DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU @@ -182,7 +177,7 @@ diff -urN ../cinstall/res.rc ./res.rc LTEXT "Select Download &Site",IDC_STATIC,55,5,135,11 LISTBOX IDC_URL_LIST,55,20,160,155,LBS_NOINTEGRALHEIGHT | WS_VSCROLL | WS_HSCROLL | WS_TABSTOP -@@ -98,10 +98,10 @@ +@@ -98,10 +98,10 @@ END IDD_OTHER_URL DIALOG DISCARDABLE 0, 0, 215, 95 STYLE DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU @@ -195,9 +190,9 @@ diff -urN ../cinstall/res.rc ./res.rc LTEXT "Select &URL to download from",IDC_STATIC,55,15,135,11 EDITTEXT IDC_OTHER_URL,55,25,127,12,ES_AUTOHSCROLL DEFPUSHBUTTON "&Next -->",IDOK,100,75,45,15 -@@ -111,10 +111,10 @@ +@@ -111,10 +111,10 @@ END - IDD_NET DIALOG DISCARDABLE 0, 0, 215, 95 + IDD_NET DIALOGEX 0, 0, 215, 95 STYLE DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION "Cygwin Setup" +CAPTION "GNU LilyPond Setup" @@ -205,10 +200,10 @@ diff -urN ../cinstall/res.rc ./res.rc BEGIN - ICON IDI_CYGWIN,IDC_STATIC,5,5,20,20 + ICON IDI_LILYPOND,IDC_STATIC,5,5,20,20 - CONTROL "Use &IE5 Settings",IDC_NET_IE5,"Button", - BS_AUTORADIOBUTTON,55,10,69,10 CONTROL "&Direct Connection",IDC_NET_DIRECT,"Button", -@@ -135,10 +135,10 @@ + BS_AUTORADIOBUTTON,55,10,73,10 + CONTROL "Use &IE5 Settings",IDC_NET_IE5,"Button", +@@ -135,10 +135,10 @@ END IDD_DLSTATUS DIALOG DISCARDABLE 0, 0, 215, 95 STYLE DS_MODALFRAME | DS_SETFOREGROUND | DS_CENTER | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU @@ -221,7 +216,7 @@ diff -urN ../cinstall/res.rc ./res.rc PUSHBUTTON "Cancel",IDCANCEL,165,75,45,15 LTEXT "Downloading...",IDC_STATIC,55,5,135,8 LTEXT "(URL)",IDC_DLS_URL,55,15,150,8 -@@ -157,10 +157,10 @@ +@@ -157,10 +157,10 @@ END IDD_INSTATUS DIALOG DISCARDABLE 0, 0, 215, 95 STYLE DS_MODALFRAME | DS_SETFOREGROUND | DS_CENTER | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU @@ -234,7 +229,7 @@ diff -urN ../cinstall/res.rc ./res.rc PUSHBUTTON "Cancel",IDCANCEL,165,75,45,15 LTEXT "Installing...",IDC_INS_ACTION,55,5,135,8 LTEXT "(PKG)",IDC_INS_PKG,55,15,150,8 -@@ -178,10 +178,10 @@ +@@ -178,10 +178,10 @@ END IDD_PROXY_AUTH DIALOG DISCARDABLE 0, 0, 215, 95 STYLE DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU @@ -247,7 +242,7 @@ diff -urN ../cinstall/res.rc ./res.rc LTEXT "Proxy &User ID",IDC_STATIC,5,28,55,15,SS_CENTERIMAGE, WS_EX_RIGHT EDITTEXT IDC_NET_USER,65,28,145,12,ES_AUTOHSCROLL -@@ -195,10 +195,10 @@ +@@ -195,10 +195,10 @@ END IDD_NET_AUTH DIALOG DISCARDABLE 0, 0, 215, 95 STYLE DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU @@ -260,7 +255,7 @@ diff -urN ../cinstall/res.rc ./res.rc LTEXT "&User ID",IDC_STATIC,5,28,55,15,SS_CENTERIMAGE, WS_EX_RIGHT EDITTEXT IDC_NET_USER,65,28,145,12,ES_AUTOHSCROLL -@@ -212,26 +212,25 @@ +@@ -212,27 +212,25 @@ END IDD_SPLASH DIALOG DISCARDABLE 0, 0, 215, 95 STYLE DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU @@ -270,32 +265,33 @@ diff -urN ../cinstall/res.rc ./res.rc BEGIN - ICON IDI_CYGWIN,IDC_STATIC,5,5,20,20 - LTEXT "Cygwin Net Release Setup Program",IDC_STATIC,55,10,114, +- 8 +- LTEXT "Version (unknown)",IDC_VERSION,55,25,120,10 +- LTEXT "Copyright 2000, 2001 Red Hat Inc.",IDC_STATIC,55,35, +- 120,8 +- LTEXT "http://sources.redhat.com/cygwin/",IDC_STATIC,55,50,112, + ICON IDI_LILYPOND,IDC_STATIC,5,5,20,20 + LTEXT "GNU LilyPond GNU LilyPond Setup Program",IDC_STATIC,55,10,114, 8 -- LTEXT "Version (unknown)",IDC_VERSION,55,25,120,10 -- LTEXT "Copyright (C) 2000 Red Hat Inc",IDC_STATIC,55,35,135,8 -- LTEXT "http://sources.redhat.com/cygwin/",IDC_STATIC,55,50,150, -- 10 -+ LTEXT "Version (1.4pre)",IDC_VERSION,55,25,120,10 ++ LTEXT "Version (1.5)",IDC_VERSION,55,25,120,10 + LTEXT "Copyright (C) 2000-2001 Red Hat Inc",IDC_STATIC,55,35,135,8 + LTEXT " (C) 2001 Jan Nieuwenhuizen ",IDC_STATIC,55,45,135,8 DEFPUSHBUTTON "&Next -->",IDOK,100,75,45,15 PUSHBUTTON "Cancel",IDCANCEL,165,75,45,15 END - IDD_CHOOSE DIALOG DISCARDABLE 0, 0, 292, 206 + IDD_CHOOSE DIALOG DISCARDABLE 0, 0, 430, 207 STYLE DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION "Cygwin Setup" +CAPTION "GNU LilyPond Setup" FONT 8, "MS Sans Serif" BEGIN -- ICON IDI_CYGWIN,IDC_STATIC,5,5,20,20 -+ ICON IDI_LILYPOND,IDC_STATIC,5,5,20,20 - LTEXT "Select packages to install",IDC_STATIC,55,5,85,8 +- ICON IDI_CYGWIN,IDC_STATIC,5,5,21,20 ++ ICON IDI_LILYPOND,IDC_STATIC,5,5,21,20 + LTEXT "Select packages to install",IDC_CHOOSE_INST_TEXT,55,5, + 99,8 CONTROL "",IDC_LISTVIEW_POS,"Static",SS_BLACKFRAME | NOT - WS_VISIBLE,55,15,230,155 -@@ -249,10 +248,10 @@ +@@ -255,10 +253,10 @@ END IDD_DESKTOP DIALOG DISCARDABLE 0, 0, 215, 95 STYLE DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU @@ -308,7 +304,16 @@ diff -urN ../cinstall/res.rc ./res.rc CONTROL "Create Desktop &Icon",IDC_ROOT_DESKTOP,"Button", BS_AUTOCHECKBOX,55,25,100,8 CONTROL "Add to &Start Menu",IDC_ROOT_MENU,"Button", -@@ -298,6 +297,7 @@ +@@ -273,7 +271,7 @@ STYLE DS_MODALFRAME | DS_CENTER | WS_POP + CAPTION "Cygwin Setup" + FONT 8, "MS Sans Serif" + BEGIN +- ICON IDI_CYGWIN,IDC_STATIC,5,5,20,20 ++ ICON IDI_LILYPOND,IDC_STATIC,5,5,20,20 + LTEXT "&User ID",IDC_STATIC,5,28,55,15,SS_CENTERIMAGE, + WS_EX_RIGHT + EDITTEXT IDC_NET_USER,65,28,145,12,ES_AUTOHSCROLL +@@ -322,6 +320,7 @@ END // Icon with lowest ID value placed first to ensure application icon // remains consistent on all systems. @@ -316,7 +321,7 @@ diff -urN ../cinstall/res.rc ./res.rc IDI_CYGWIN ICON DISCARDABLE "cygwin.ico" ///////////////////////////////////////////////////////////////////////////// -@@ -305,6 +305,7 @@ +@@ -329,6 +328,7 @@ IDI_CYGWIN ICON DISCARDA // FILE // @@ -324,7 +329,7 @@ diff -urN ../cinstall/res.rc ./res.rc CYGWIN.ICON FILE DISCARDABLE "cygwin.ico" ///////////////////////////////////////////////////////////////////////////// -@@ -354,7 +355,8 @@ +@@ -383,7 +383,8 @@ STRINGTABLE DISCARDABLE BEGIN IDS_ROOT_SLASH "Warning: we recommend you do NOT use the root of your hard drive as the cygwin root. Proceed anyway?" IDS_ROOT_SPACE "You should not choose a root path that include spaces in directory names. Proceed anyway?" @@ -334,10 +339,10 @@ diff -urN ../cinstall/res.rc ./res.rc IDS_DIALOG_FAILED "Unable to create Dialog Box" IDS_CYGWIN_FUNC_MISSING "Error: unable to find function `%s' in %s" IDS_DOWNLOAD_SHORT "Download error: %s too short (%d, wanted %d)" -diff -urN ../cinstall/resource.h ./resource.h ---- ../cinstall/resource.h Thu Mar 1 05:55:20 2001 -+++ ./resource.h Thu Apr 12 11:39:52 2001 -@@ -47,11 +47,12 @@ +diff -purN ../cinstall/resource.h ./resource.h +--- ../cinstall/resource.h Mon Jul 2 05:55:40 2001 ++++ ./resource.h Thu Sep 13 21:29:51 2001 +@@ -47,12 +47,13 @@ #define IDB_SPIN 118 #define IDB_RTARROW 119 #define IDI_SPIN 120 @@ -347,21 +352,14 @@ diff -urN ../cinstall/resource.h ./resource.h #define IDB_CHECK_YES 123 #define IDB_CHECK_NO 124 #define IDB_CHECK_NA 125 -+#define IDI_CYGWIN 126 + #define IDD_FTP_AUTH 126 ++#define IDI_CYGWIN 127 #define IDC_SOURCE_DOWNLOAD 1000 #define IDC_SOURCE_NETINST 1001 #define IDC_SOURCE_CWD 1002 -diff -urN ../cinstall/zlib/Makefile.in ./zlib/Makefile.in ---- ../cinstall/zlib/Makefile.in Tue Aug 8 05:55:18 2000 -+++ ./zlib/Makefile.in Thu Apr 12 11:42:10 2001 -@@ -299,6 +299,10 @@ - - clean: clean-am - -+realclean: clean -+ rm -f Makefile *.d -+ rm -f config.cache config.log config.status -+ - distclean-am: distclean-noinstLIBRARIES distclean-compile \ - distclean-tags distclean-generic clean-am - +diff -purN ../cinstall/version.c ./version.c +--- ../cinstall/version.c Thu Jan 1 01:00:00 1970 ++++ ./version.c Mon Sep 17 18:44:46 2001 +@@ -0,0 +1,2 @@ ++char *version = "2.96.jcn1"; ++static char *id = "\n%%% setup-version 2.96.jcn1\n"; diff --git a/VERSION b/VERSION index 66c84c6b8f..7a347816fa 100644 --- a/VERSION +++ b/VERSION @@ -2,7 +2,7 @@ PACKAGE_NAME=LilyPond MAJOR_VERSION=1 MINOR_VERSION=5 PATCH_LEVEL=10 -MY_PATCH_LEVEL=jcn1 +MY_PATCH_LEVEL=jcn2 # use the above to send patches: MY_PATCH_LEVEL is always empty for a # released version. diff --git a/flower/rational.cc b/flower/rational.cc index 3b0b3d0928..11aaf1e23b 100644 --- a/flower/rational.cc +++ b/flower/rational.cc @@ -300,6 +300,12 @@ Rational::str () const return s; } +int +Rational::to_int () const +{ + return num () / den (); +} + int sign (Rational r) { diff --git a/midi2ly/duration-convert.cc b/midi2ly/duration-convert.cc index b915c87727..ee53cf47c4 100644 --- a/midi2ly/duration-convert.cc +++ b/midi2ly/duration-convert.cc @@ -8,7 +8,6 @@ */ #include #include "duration-convert.hh" -#include "duration-iter.hh" #include "warn.hh" // statics Duration_convert @@ -39,8 +38,11 @@ Duration_convert::dur2_str (Duration dur) } str += to_str ('.', dur.dots_i_); if (dur.plet_b ()) - str += String ("*") + to_str (dur.plet_.iso_i_) - + String ("/") + to_str (dur.plet_.type_i_); + { + str += String ("*") + to_str (dur.plet_.iso_i_); + if (dur.plet_.type_i_ != 1) + str += String ("/") + to_str (dur.plet_.type_i_); + } return str; } @@ -110,49 +112,58 @@ Duration_convert::mom2_dur (Rational mom) return mom2standardised_dur (mom); } + Duration Duration_convert::mom2standardised_dur (Rational mom) { - // if (!dur_array_s.length_i ()) - if (!dur_array_s.size ()) - set_array (); - assert (dur_array_s.size ()); - for (int i = 0; i < dur_array_s.size () - 1; i++) + Duration dur; + + if (mom == Rational (0)) + return dur; + + int d = no_smaller_than_i_s ? no_smaller_than_i_s : 7; + int i = type2_i (d); + int n = (mom / Rational (1, i)).to_int (); + + int tuplet = 1; + if (!no_tuplets_b_s) { - Rational lower_mom = dur2_mom (dur_array_s[ i ]); - if (mom <= lower_mom) + // ugh: 8 + int m = n; + int tup = 1; + while (tup < 8 && + mom != Rational (m, i * tup)) { - // all arbitrary, but 3/4 will get rid of the noise... - // kinda ok - if (i || (mom / lower_mom > Rational (3, 4))) - return dur_array_s[ i ]; - else - { - Duration d; - d.durlog_i_ = -100; - return d; - } + tup += 2; + m = (mom / Rational (1, i * tup)).to_int (); } - Rational upper_mom = dur2_mom (dur_array_s[ i + 1 ]); - if ((mom < upper_mom) - && ((mom - lower_mom) / lower_mom - < (upper_mom - mom) / upper_mom)) - return dur_array_s[ i ]; - } - return dur_array_s[ dur_array_s.size () - 1 ]; -} - -void -Duration_convert::set_array () -{ - dur_array_s.clear (); - Duration_iterator i; - while (i.ok ()) - dur_array_s.push (i.forward_dur ()); + if (tuplet < 8) + { + n = m; + tuplet = tup; + } + } + + if (!n) + return dur; + + if (mom - Rational (n, i) + > Rational (1, i * 2 * tuplet)) + n++; + + while (!(n & 1)) + { + n >>= 1; + d--; + } + + dur.durlog_i_ = d; + dur.plet_.iso_i_ = n; + dur.plet_.type_i_ = tuplet; + return dur; } - Rational Duration_convert::plet_factor_mom (Duration dur) { diff --git a/midi2ly/duration-iter.cc b/midi2ly/duration-iter.cc index 12c2fa832b..e69de29bb2 100644 --- a/midi2ly/duration-iter.cc +++ b/midi2ly/duration-iter.cc @@ -1,107 +0,0 @@ -/* - duration-convert.cc -- implement Duration_convert - - source file of the LilyPond music typesetter - - (c) 1997--2001 Han-Wen Nienhuys - Jan Nieuwenhuizen -*/ -#include -#include "duration-convert.hh" -#include "warn.hh" -#include "duration-iter.hh" - -Duration_iterator::Duration_iterator () -{ - cursor_dur_.durlog_i_ = 7; - if (Duration_convert::no_smaller_than_i_s) - cursor_dur_.durlog_i_ = Duration_convert::no_smaller_than_i_s; -} - -Duration -Duration_iterator::operator ++(int) -{ - return forward_dur (); -} - -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 = this->dur (); - - if (!cursor_dur_.dots_i_ && !cursor_dur_.plet_b ()) - { - cursor_dur_.durlog_i_ += 1; - cursor_dur_.dots_i_ = 2; - } - else if (cursor_dur_.dots_i_ == 2) - { - assert (!cursor_dur_.plet_b ()); - cursor_dur_.dots_i_ = 0; - cursor_dur_.durlog_i_ -=2; - cursor_dur_.set_plet (2, 3); - } - else if (cursor_dur_.plet_b () - && (cursor_dur_.plet_.iso_i_ == 2) - && (cursor_dur_.plet_.type_i_ == 3)) - { - assert (!cursor_dur_.dots_i_); - cursor_dur_.set_plet (1, 1); - cursor_dur_.durlog_i_ += 1; - cursor_dur_.dots_i_ = 1; - } - else if (cursor_dur_.dots_i_ == 1) - { - assert (!cursor_dur_.plet_b ()); - cursor_dur_.dots_i_ = 0; - cursor_dur_.durlog_i_ -= 1; - } - - if (Duration_convert::no_tuplets_b_s - && cursor_dur_.plet_b () && ok ()) - forward_dur (); - if (Duration_convert::no_double_dots_b_s - && (cursor_dur_.dots_i_ == 2) && ok ()) - forward_dur (); - if (Duration_convert::no_smaller_than_i_s - && (cursor_dur_.durlog_i_ > Duration_convert::no_smaller_than_i_s) && ok ()) - forward_dur (); - if (Duration_convert::no_smaller_than_i_s - && cursor_dur_.dots_i_ - && (cursor_dur_.durlog_i_ >= Duration_convert::no_smaller_than_i_s) - && ok ()) - forward_dur (); - if (Duration_convert::no_smaller_than_i_s - && (cursor_dur_.dots_i_ == 2) - && (cursor_dur_.durlog_i_ >= Duration_convert::no_smaller_than_i_s / 2) - && ok ()) - forward_dur (); - - return dur; -} - -bool -Duration_iterator::ok () -{ - return cursor_dur_.length_mom () <= Rational (4); -} diff --git a/midi2ly/include/duration-iter.hh b/midi2ly/include/duration-iter.hh index d3320c3317..e69de29bb2 100644 --- a/midi2ly/include/duration-iter.hh +++ b/midi2ly/include/duration-iter.hh @@ -1,39 +0,0 @@ -/* - duration-iter.hh -- declare Duration_iterator - - source file of the GNU LilyPond music typesetter - - (c) 1998--2001 Han-Wen Nienhuys - - */ - -#ifndef DURATION_ITER_HH -#define DURATION_ITER_HH - -/// (iter_dur) -struct Duration_iterator { - - /// start at shortest: 128:2/3 - Duration_iterator (); - - /// return forward_dur (); - Duration operator ++(int); - - /// return current dur - Duration dur (); - - /// return dur (), step to next - Duration forward_dur (); - - /// durations left? - bool ok (); - -private: - - Duration cursor_dur_; -}; - - - -#endif /* DURATION_ITER_HH */ - diff --git a/midi2ly/include/lilypond-column.hh b/midi2ly/include/lilypond-column.hh index 15a9097e9d..b7422c2c67 100644 --- a/midi2ly/include/lilypond-column.hh +++ b/midi2ly/include/lilypond-column.hh @@ -1,7 +1,7 @@ // // lilypond-column.hh -- declare Lilypond_column // -// copyright 1997 Jan Nieuwenhuizen +// (c) 1997--2001 Jan Nieuwenhuizen #ifndef LILYPOND_COLUMN_HH #define LILYPOND_COLUMN_HH diff --git a/midi2ly/include/lilypond-item.hh b/midi2ly/include/lilypond-item.hh index 039280c91e..5855725d2a 100644 --- a/midi2ly/include/lilypond-item.hh +++ b/midi2ly/include/lilypond-item.hh @@ -1,7 +1,7 @@ // // lilypond-item.hh -- declare lilypond_item // -// copyright 1997 Jan Nieuwenhuizen +// (c) 1997--2001 Jan Nieuwenhuizen #ifndef LILYPOND_ITEM_HH #define LILYPOND_ITEM_HH diff --git a/midi2ly/include/lilypond-score.hh b/midi2ly/include/lilypond-score.hh index 9076384ac5..d8996e82f0 100644 --- a/midi2ly/include/lilypond-score.hh +++ b/midi2ly/include/lilypond-score.hh @@ -1,7 +1,7 @@ // // lilypond-score.hh -- declare Lilypond_score // -// copyright 1997 Jan Nieuwenhuizen +// (c) 1997--2001 Jan Nieuwenhuizen #ifndef LILYPOND_SCORE_HH #define LILYPOND_SCORE_HH diff --git a/midi2ly/include/lilypond-staff.hh b/midi2ly/include/lilypond-staff.hh index ceba267b4b..d9e4580c29 100644 --- a/midi2ly/include/lilypond-staff.hh +++ b/midi2ly/include/lilypond-staff.hh @@ -1,7 +1,7 @@ // // lilypond-staff.hh -- declare lilypond_staff // -// copyright 1997 Jan Nieuwenhuizen +// (c) 1997--2001 Jan Nieuwenhuizen #ifndef LILYPOND_STAFF_HH #define LILYPOND_STAFF_HH diff --git a/midi2ly/include/lilypond-stream.hh b/midi2ly/include/lilypond-stream.hh index 29c1c8cf3a..2e6429907f 100644 --- a/midi2ly/include/lilypond-stream.hh +++ b/midi2ly/include/lilypond-stream.hh @@ -1,7 +1,7 @@ // // lilypond-stream.hh -- part of LilyPond // -// copyright 1997 Jan Nieuwenhuizen +// (c) 1997--2001 Jan Nieuwenhuizen // should i be named Lilypond_stream? diff --git a/midi2ly/include/lilypond-voice.hh b/midi2ly/include/lilypond-voice.hh index b64882f6fb..dff2528881 100644 --- a/midi2ly/include/lilypond-voice.hh +++ b/midi2ly/include/lilypond-voice.hh @@ -1,12 +1,14 @@ // // lilypond-voice.hh -- declare Lilypond_voice // -// copyright 1997 Jan Nieuwenhuizen +// (c) 1997--2001 Jan Nieuwenhuizen #ifndef LILYPOND_VOICE_HH #define LILYPOND_VOICE_HH #include "midi2ly-proto.hh" +//#include "flower-proto.hh" +#include "parray.hh" #include "cons.hh" /// (lilypond_voice) @@ -14,15 +16,14 @@ class Lilypond_voice { public: Lilypond_voice (Lilypond_staff* lilypond_staff_l); - void add_item (Lilypond_item* lilypond_item_l); + void add_items (Link_array& items); void output (Lilypond_stream& lilypond_stream_r); String get_clef () const; - Lilypond_item * last_item_l_; - Lilypond_note * last_note_l_; + private: Lilypond_staff* lilypond_staff_l_; - Cons_list lilypond_item_l_list_; - + Link_array < Cons_list > threads_; + Rational mom_; }; #endif // LILYPOND_VOICE_HH diff --git a/midi2ly/include/midi2ly-global.hh b/midi2ly/include/midi2ly-global.hh index 4e5c54922b..2b06890921 100644 --- a/midi2ly/include/midi2ly-global.hh +++ b/midi2ly/include/midi2ly-global.hh @@ -1,7 +1,7 @@ // // midi2ly-global.hh -- declare global stuff for midi2ly // -// copyright 1997 Jan Nieuwenhuizen +// (c) 1997--2001 Jan Nieuwenhuizen #ifndef MIDI2LY_GLOBAL_HH #define MIDI2LY_GLOBAL_HH diff --git a/midi2ly/lilypond-column.cc b/midi2ly/lilypond-column.cc index 136f10a06d..3fde791a66 100644 --- a/midi2ly/lilypond-column.cc +++ b/midi2ly/lilypond-column.cc @@ -1,7 +1,7 @@ // // lilypond-column.cc -- implement Lilypond_column // -// copyright 1997 Jan Nieuwenhuizen +// (c) 1997--2001 Jan Nieuwenhuizen #include "lilypond-column.hh" diff --git a/midi2ly/lilypond-item.cc b/midi2ly/lilypond-item.cc index 977f44e70e..9d796ad7ac 100644 --- a/midi2ly/lilypond-item.cc +++ b/midi2ly/lilypond-item.cc @@ -1,7 +1,7 @@ // // lilypond-item.cc -- implement Lilypond_item // -// copyright 1997 Jan Nieuwenhuizen +// (c) 1997--2001 Jan Nieuwenhuizen #include #include @@ -255,14 +255,17 @@ Lilypond_note::str () String str; //ugh - if (dur.plet_b ()) - str += String ("\\times ") - + String_convert::i2dec_str (dur.plet_.iso_i_, 0, 0) - + "/" - + String_convert::i2dec_str (dur.plet_.type_i_, 0, 0) - + " { "; + if (dur.plet_b () && dur.plet_.type_i_ != 1) + { + { + str += String ("\\times ") + + String_convert::i2dec_str (dur.plet_.iso_i_, 0, 0) + + "/" + + String_convert::i2dec_str (dur.plet_.type_i_, 0, 0) + + " { "; + } + } - str += name_str; Duration tmp = dur; @@ -270,8 +273,13 @@ Lilypond_note::str () str += Duration_convert::dur2_str (tmp); if (dur.plet_b ()) - str += String (" }"); - + { + if (dur.plet_.type_i_ != 1) + str += String (" }"); + else + str += String ("*") + to_str (dur.plet_.iso_i_); + } + /* note of zero duration is nonsense, but let's output anyway for convenient debugging @@ -303,16 +311,29 @@ Lilypond_skip::duration_mom () String Lilypond_skip::str () { - if (!mom_) - return String (""); - - Duration dur = duration (); - if (dur.durlog_i_<-10) - return ""; - - String str = "\\skip "; - str += Duration_convert::dur2_str (dur); + String str; + Rational m = mom_; + if (m.to_int () >= 1) + { + int n = m.to_int (); + str += "\\skip 1"; + if (n > 1) + { + str += "*"; + str += to_str (n); + } + str += " "; + m -= n; + } + if (m > Rational (0)) + { + + Duration dur = Duration_convert::mom2_dur (m); + str += "\\skip "; + str += Duration_convert::dur2_str (dur); + str += " "; + } return str; } diff --git a/midi2ly/lilypond-score.cc b/midi2ly/lilypond-score.cc index d0b05bb02b..363a0e7bf7 100644 --- a/midi2ly/lilypond-score.cc +++ b/midi2ly/lilypond-score.cc @@ -1,7 +1,7 @@ // // lilypond-score.cc -- implement Lilypond_score // -// copyright 1997 Jan Nieuwenhuizen +// (c) 1997--2001 Jan Nieuwenhuizen #include #include "rational.hh" @@ -192,7 +192,7 @@ Lilypond_score::quantify_columns () int current_bar_i = 0; Rational bar_mom = lilypond_time_signature_l_->bar_mom (); - int n = 5 >? Duration_convert::no_smaller_than_i_s; + int n = 7 >? Duration_convert::no_smaller_than_i_s; n = Duration_convert::type2_i (n); Rational s = Rational (1, n); for (int i = 0; i < column_l_array_.size (); i++) diff --git a/midi2ly/lilypond-staff.cc b/midi2ly/lilypond-staff.cc index 0e79b7f4e2..481bc38417 100644 --- a/midi2ly/lilypond-staff.cc +++ b/midi2ly/lilypond-staff.cc @@ -1,7 +1,7 @@ // // lilypond-staff.cc -- implement Lilypond_staff // -// copyright 1997 Jan Nieuwenhuizen +// (c) 1997--2001 Jan Nieuwenhuizen #include #include @@ -55,109 +55,40 @@ Lilypond_staff::eat_voice (Cons_list& items) Lilypond_voice* voice_p = new Lilypond_voice (this); lilypond_voice_p_list_.append (new Killing_cons (voice_p, 0)); - // Rational mom = items.top ()->at_mom (); Rational mom = 0; - for (Cons** pp = &items.head_; *pp;) + Link_array now_items; + for (Cons** i = &items.head_; *i;) { - Cons* i = *pp; - if (i->car_->at_mom () > mom) - { - if (no_rests_b_g && voice_p->last_note_l_) - { - voice_p->last_note_l_->end_column_l_ = i->car_->lilypond_column_l_; - } - else - { - /* uh, what about quantisation? This should probably - use mom2standardised_dur () - arg, urg: skip should get duration from start/end columns! - */ - - Rational r = i->car_->at_mom () - mom; - // ugh, need score - Lilypond_column* start = lilypond_score_l_g->find_column_l (mom); - voice_p->add_item (new Lilypond_skip (start, r)); - } - - mom = i->car_->at_mom (); - continue; // unnecessary - } + while (*i && (*i)->car_->at_mom () < mom) + i = &(*i)->next_; + Lilypond_note* last_note = 0; Link_array now_items; - for (Cons *cp = i; cp && cp->car_->at_mom () == mom; cp = cp->next_) - now_items.push (i->car_); - -#if 0 - /* - Why don't we use , if voice has: - - - - we'd get last_item == key_change -> last_note == 0; - */ - Lilypond_note * last_note = dynamic_cast (voice_p->last_item_l_); -#else - /* - Not sure, is this better? - */ - Lilypond_note * last_note = voice_p->last_note_l_; -#endif - - Link_array candidates; - - for (int i=0; last_note && i < now_items.size (); i++) - { - Lilypond_note * now_note = dynamic_cast (now_items[i]); - if (now_note && last_note->channel_i_ != now_note->channel_i_) - candidates.push (now_note); - } - - if (candidates.size()) - { - now_items = candidates; - } - - Lilypond_item * which = 0; - if (now_items.size () > 1) + if (*i) + mom = (*i)->car_->at_mom (); + while (*i && (*i)->car_->at_mom () == mom) { - int mindiff = 100000; // ugh - for (int i=0; last_note && i < now_items.size (); i++) - { - Lilypond_note *nt = dynamic_cast (now_items[i]); - if (!nt) - continue; - int diff = abs (last_note->pitch_i_ - nt->pitch_i_ ); - if(diff < mindiff) - { - mindiff = diff; - which = now_items [i]; - } - } - - if (which && mindiff > 18) // more than 1.5 octaves apart. Don't put in same voice. - { - which =0; - } - } - else if (now_items.size () == 1) - which = now_items[0]; - - if (which) - { - while ((*pp)->car_ != which) - pp = &(*pp)->next_; - - mom += (*pp)->car_->duration_mom (); - Cons* c = items.remove_cons (pp); - voice_p->add_item (c->car_); + Lilypond_note* note = dynamic_cast ((*i)->car_); + if (note && last_note + /* ugh, should sort out (whether to) channel before */ + && (note->channel_i_ != last_note->channel_i_ + || (note->duration_mom () + != last_note->duration_mom ()))) + break; + Cons* c = items.remove_cons (i); + now_items.push (c->car_); + if (note) + last_note = note; delete c; } - else - { - pp = &(*pp)->next_; - continue; - } + + if (now_items.size ()) + mom = now_items.top ()->at_mom (); + if (last_note) + mom += last_note->duration_mom (); + + voice_p->add_items (now_items); } } @@ -199,17 +130,18 @@ Lilypond_staff::output (Lilypond_stream& lilypond_stream_r) lilypond_stream_r << voicename << " = \\notes "; - trackbody += "\\" + voicename + "\n"; - + trackbody += "\\context Voice = " + voicename + " \\" + voicename + "\n"; lilypond_stream_r << '\n'; i->car_->output (lilypond_stream_r); c++; + lilypond_stream_r << '\n'; } + lilypond_stream_r << '\n'; lilypond_stream_r << _ ("% MIDI copyright:") << copyright_str_ << '\n'; lilypond_stream_r << _ ("% MIDI instrument:") << instrument_str_ << '\n'; lilypond_stream_r << id_str () << " = "; - lilypond_stream_r << "<\n " << trackbody << " >\n"; + lilypond_stream_r << "<\n" << trackbody << ">\n"; lilypond_stream_r << " % " << name_str () << '\n'; } @@ -231,99 +163,12 @@ Lilypond_staff::output_lilypond_begin_bar (Lilypond_stream& lilypond_stream_r, R } -#if 0 // not used for now -void -Lilypond_staff::output_lilypond_rest (Lilypond_stream& lilypond_stream_r, Rational begin_mom, Rational end_mom) -{ - Rational bar_mom = lilypond_time_signature_l_->bar_mom (); - Rational now_mom = begin_mom; - - int begin_bar_i = (int) (now_mom / bar_mom) + 1; - int end_bar_i = (int) (end_mom / bar_mom) + 1; - - if (end_bar_i == begin_bar_i) - { - output_lilypond_rest_remain (lilypond_stream_r, end_mom - begin_mom); - return; - } - - // multiple bars involved - int bar_i = (int) (now_mom / bar_mom) + 1; - - //fill current bar - Rational begin_bar_mom = Rational (begin_bar_i - 1) * bar_mom; - if (now_mom > begin_bar_mom) - { - int next_bar_i = (int) (now_mom / bar_mom) + 2; - Rational next_bar_mom = Rational (next_bar_i - 1) * bar_mom; - assert (next_bar_mom <= end_mom); - - Rational remain_mom = next_bar_mom - now_mom; - if (remain_mom > Rational (0)) - { - output_lilypond_rest_remain (lilypond_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_lilypond_begin_bar (lilypond_stream_r, now_mom, begin_bar_i); - lilypond_stream_r << "r1 "; - // *lilypond_stream_r.os_p_ << flush; - if (begin_bar_i) - LOGOUT (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_lilypond_begin_bar (lilypond_stream_r, now_mom, ii); - - // bar_i = check_end_bar_i (now_mom, bar_i); - - Rational remain_mom = end_mom - Rational (end_bar_i - 1) * bar_mom; - if (remain_mom > Rational (0)) - { - output_lilypond_rest_remain (lilypond_stream_r, remain_mom); - now_mom += remain_mom; - } - assert (now_mom == end_mom); -} - -void -Lilypond_staff::output_lilypond_rest_remain (Lilypond_stream& lilypond_stream_r, Rational mom) -{ - if (Duration_convert::no_quantify_b_s) - { - Duration dur = Duration_convert::mom2_dur (mom); - lilypond_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_>-10) - lilypond_stream_r << "r" << dur.str () << " "; -} -#endif - - void Lilypond_staff::process () { /* - group items into voices - */ + group items into voices + */ assert (lilypond_score_l_g); lilypond_key_l_ = lilypond_score_l_g->lilypond_key_l_; diff --git a/midi2ly/lilypond-voice.cc b/midi2ly/lilypond-voice.cc index d7676b2634..a19eec0378 100644 --- a/midi2ly/lilypond-voice.cc +++ b/midi2ly/lilypond-voice.cc @@ -1,7 +1,7 @@ // // lilypond-voice.cc -- implement Lilypond_voice // -// copyright 1997 Jan Nieuwenhuizen +// (c) 1997--2001 Jan Nieuwenhuizen #include "string-convert.hh" #include "midi2ly-global.hh" @@ -17,19 +17,40 @@ extern Lilypond_score* lilypond_score_l_g; Lilypond_voice::Lilypond_voice (Lilypond_staff* lilypond_staff_l) { lilypond_staff_l_ = lilypond_staff_l; - last_item_l_ =0; - last_note_l_ =0; + threads_.push (new Cons_list); + mom_ = 0; } - + void -Lilypond_voice::add_item (Lilypond_item* lilypond_item_l) +Lilypond_voice::add_items (Link_array& items) { - last_item_l_ = lilypond_item_l; - if (Lilypond_note* n = dynamic_cast (lilypond_item_l)) + int thread = 0; + for (int i = 0; i < items.size (); i++) { - last_note_l_ = n; + Lilypond_item* item = items[i]; + + int to_thread; + if (Lilypond_note* n = dynamic_cast (item)) + to_thread = thread++; + else + to_thread = 0; + + if (to_thread >= threads_.size ()) + threads_.push (new Cons_list); + + if (to_thread == 0 && item->at_mom () > mom_) + { + /* urg: skip should use refer to end-colum, not separate moment */ + Rational r = item->at_mom () - mom_; + Lilypond_column* start = lilypond_score_l_g->find_column_l (mom_); + threads_[to_thread]->append (new Cons (new Lilypond_skip (start, r), 0)); + mom_ = item->at_mom (); + } + + threads_[to_thread]->append (new Cons (item, 0)); + if (to_thread == 0) + mom_ += item->duration_mom (); } - lilypond_item_l_list_.append (new Cons (lilypond_item_l, 0)); } /** @@ -40,7 +61,7 @@ Lilypond_voice::get_clef () const { Lilypond_note * n =0; - for (Cons *cp = lilypond_item_l_list_.head_; !n && cp; cp = cp->next_) + for (Cons *cp = threads_[0]->head_; !n && cp; cp = cp->next_) { n = dynamic_cast (cp->car_); } @@ -64,7 +85,7 @@ void Lilypond_voice::output (Lilypond_stream& lilypond_stream_r) { lilypond_stream_r << "{ "; - if (lilypond_item_l_list_.size_i () > FAIRLY_LONG_VOICE_i) + if (threads_[0]->size_i () > FAIRLY_LONG_VOICE_i) lilypond_stream_r << '\n'; @@ -73,7 +94,10 @@ Lilypond_voice::output (Lilypond_stream& lilypond_stream_r) int current_bar_i = 0; Rational bar_mom = lilypond_staff_l_->lilypond_time_signature_l_->bar_mom (); - for (Cons* i = lilypond_item_l_list_.head_; i; i = i->next_) + Link_array > heads; + for (int i = 1; i < threads_.size (); i++) + heads.push (threads_[i]->head_); + for (Cons* i = threads_[0]->head_; i; i = i->next_) { Rational at_mom = i->car_->lilypond_column_l_->at_mom (); int bar_i = (int) (at_mom / bar_mom) + 1; @@ -91,12 +115,34 @@ Lilypond_voice::output (Lilypond_stream& lilypond_stream_r) current_bar_i = bar_i; } - lilypond_stream_r << *i->car_; + if (dynamic_cast (i->car_) + && heads.size () + && heads[0] + && heads[0]->car_->at_mom () == at_mom) + { + lilypond_stream_r << '<'; + + lilypond_stream_r << *i->car_; + + for (int h = 0; + h < heads.size () + && heads[h] + && heads[h]->car_->at_mom () == at_mom; + h++) + { + lilypond_stream_r << *heads[h]->car_; + heads[h] = heads[h]->next_; + } + lilypond_stream_r << '>'; + } + else + lilypond_stream_r << *i->car_; + if (Lilypond_key* k = dynamic_cast (i->car_)) lilypond_staff_l_->lilypond_key_l_ = lilypond_score_l_g->lilypond_key_l_ = k; } - if (lilypond_item_l_list_.size_i () > FAIRLY_LONG_VOICE_i) + if (threads_[0]->size_i () > FAIRLY_LONG_VOICE_i) lilypond_stream_r << '\n'; lilypond_stream_r << "} "; diff --git a/midi2ly/main.cc b/midi2ly/main.cc index 9cc78171d8..a1a0665539 100644 --- a/midi2ly/main.cc +++ b/midi2ly/main.cc @@ -1,7 +1,7 @@ // // main.cc -- implement main () entry point // -// copyright 1997 Jan Nieuwenhuizen +// (c) 1997--2001 Jan Nieuwenhuizen #include #include diff --git a/midi2ly/midi2ly-version.cc b/midi2ly/midi2ly-version.cc index 08cb163723..73efc5a42b 100644 --- a/midi2ly/midi2ly-version.cc +++ b/midi2ly/midi2ly-version.cc @@ -1,7 +1,7 @@ // // version.cc -- implement inexpensive versioning // -// copyright 1997 Jan Nieuwenhuizen +// (c) 1997--2001 Jan Nieuwenhuizen #include #include "config.h" -- 2.39.5