lilypond-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

lily/stem-engraver.cc: Improve error message for incompatible durations


From: dak
Subject: lily/stem-engraver.cc: Improve error message for incompatible durations while stemming (issue4390042)
Date: Wed, 13 Apr 2011 10:33:58 +0000

Reviewers: ,

Message:
Pushed since there does not seem much point in jumping through more
hoops because nobody can be interested in the bug report.

Description:
lily/stem-engraver.cc: Improve error message for incompatible durations
while stemming

The error messages for incompatible durations go down the drain when
the stem duration log is negative.  This changes the warnings to
fractions.  Possibly it would be smarter to use Lilypond lengths, but
there does not seem to be an easily accessible printer from C++.

Please review this at http://codereview.appspot.com/4390042/

Affected files:
  A input/regression/incompatible-stem-warning.ly
  M lily/stem-engraver.cc


Index: input/regression/incompatible-stem-warning.ly
diff --git a/input/regression/incompatible-stem-warning.ly b/input/regression/incompatible-stem-warning.ly
new file mode 100644
index 0000000000000000000000000000000000000000..95dc1c1d2cf9b16a1028417257b725fa9a229169
--- /dev/null
+++ b/input/regression/incompatible-stem-warning.ly
@@ -0,0 +1,22 @@
+\version "2.13.59"
+
+\header {
+
+  texidoc = "
+Combine several kinds of stems in parallel voices.
+"
+
+}
+
+\new Voice { \time 4/1
+            << c'\breve e'8 >>
+            << c'8 e'\breve >> |
+            << c'\longa e'1 >> |
+            << c'1 e'\longa >> |
+            << c'2 e'1 >>
+            << c'1 e'2 >>
+            << c'2 e'4 >>
+            << c'4 e'2 >>
+            << c'2 e'8 >>
+            << c'8 e'2 >>
+}
Index: lily/stem-engraver.cc
diff --git a/lily/stem-engraver.cc b/lily/stem-engraver.cc
index 137040766a5f6a1c710595b350f1a6dd039c4691..e21d796765ccd1cc1de4daf188b18be068e82d48 100644
--- a/lily/stem-engraver.cc
+++ b/lily/stem-engraver.cc
@@ -134,11 +134,13 @@ Stem_engraver::acknowledge_rhythmic_head (Grob_info gi)
   if (!stem_)
     make_stem (gi);

-  if (Stem::duration_log (stem_) != d->duration_log ())
+  int ds = Stem::duration_log (stem_);
+
+  if (ds != d->duration_log ())
     {
-      // FIXME:
- gi.event_cause ()->origin ()->warning (_f ("adding note head to incompatible stem (type = %d)",
-                                                1 << Stem::duration_log 
(stem_)));
+ gi.event_cause ()->origin ()->warning (_f ("adding note head to incompatible stem (type = %d/%d)",
+                                                ds < 0 ? 1 << -ds : 1,
+                                                ds > 0 ? 1 << ds : 1));
gi.event_cause ()->origin ()->warning (_ ("maybe input should specify polyphonic voices"));
     }






reply via email to

[Prev in Thread] Current Thread [Next in Thread]