* scripts/convert-ly.py (FatalConversionError.conv): add cluster rule.
* lily/cluster.cc (brew_molecule): examine ClusterSpannerBeacons
to get positions.
* lily/cluster-engraver.cc: rewrite: catch cluster-note-events,
make ClusterSpannerBeacon to record Y positions. This removes the
need to switch off notes. Use \apply #notes-to-clusters { .. } to
make cluster-note-events.
+2003-07-17 Han-Wen Nienhuys <hanwen@cs.uu.nl>
+
+ * scm/define-grob-interfaces.scm (cluster-beacon-interface): add
+ cluster-beacon-interface
+
+ * scm/define-grobs.scm (all-grob-descriptions): default to ramp.
+
+ * scripts/convert-ly.py (FatalConversionError.conv): add cluster rule.
+
+ * ly/spanners-init.ly (stopGroup): remove start/stopCluster.
+
+ * lily/cluster.cc (brew_molecule): examine ClusterSpannerBeacons
+ to get positions.
+
+ * lily/cluster-engraver.cc: rewrite: catch cluster-note-events,
+ make ClusterSpannerBeacon to record Y positions. This removes the
+ need to switch off notes. Use \apply #notes-to-clusters { .. } to
+ make cluster-note-events.
+
2003-07-17 Jan Nieuwenhuizen <janneke@gnu.org>
* configure.in: Use lily/main.cc as identifying source file.
@syntax
-A cluster is engraved as the envelope of a set of notes. The starting
-note is marked with @code{\startCluster}, and the ending note with
-@code{\stopCluster}, e.g.,
-
-@example
- c4-\startCluster
- ...
- f4-\stopCluster
-@end example
+A cluster is engraved as the envelope of a set of cluster-notes. This
+is achieved by applying the function @code{notes-to-cluster} to a
+sequence of chords, eg.
+@lilypond[relative 2]
+ \apply #notes-to-cluster { << c e >> <<b f'>> }
+@end lilypond
The following example (from
@inputfileref{input/regression,cluster.ly}) shows what the result
}
fragment =\notes \relative c' {
- c4 f4 a4 <<e d'>>4
+ c4 f4 <<e d'>>4
<<g a>>8 <<e a>> a4 c2 <<d b>>4 e4
- c4 a4 f4 g4 a4 }
+ c4 }
\score {
\notes <
\context Staff = SA \fragment
- \context Staff = SB
- \context Voice <
- \fragment
- { s2 \hideNotes
- s4-\startCluster
- s1*2
- s4-\stopCluster
- \unHideNotes
- } >
+ \context Staff = SB \apply #notes-to-clusters \fragment
>
+ \paper { raggedright = ##t }
}
pmin = pmin <? p;
}
- Item *it = new Item (get_property ("ClusterSpannerBeacon"));
- it->set_grob_property ("positions", scm_cons (gh_int2scm (pmin),
- gh_int2scm (pmax)));
-
+ beacon_ = new Item (get_property ("ClusterSpannerBeacon"));
+ beacon_->set_grob_property ("positions",
+ scm_cons (gh_int2scm (pmin),
+ gh_int2scm (pmax)));
+ announce_grob (beacon_, cluster_notes_[0]->self_scm ());
}
if (beacon_ && !spanner_)
{
- spanner_ = new Spanner (get_property ("Cluster"));
+ spanner_ = new Spanner (get_property ("ClusterSpanner"));
announce_grob (spanner_, cluster_notes_[0]->self_scm ());
}
ENTER_DESCRIPTION(Cluster_spanner_engraver,
/* descr */ "Engraves a cluster using Spanner notation ",
-/* creats*/ "Cluster",
+/* creats*/ "ClusterSpanner ClusterSpannerBeacon",
/* accepts */ "cluster-note-event abort-event",
/* acks */ "note-column-interface",
/* reads */ "",
/* write */ "");
+
*/
#include <stdio.h>
+
#include "cluster.hh"
-#include "grob.hh"
#include "spanner.hh"
#include "item.hh"
#include "pitch.hh"
#include "box.hh"
#include "interval.hh"
#include "paper-def.hh"
-#include "paper-column.hh"
-#include "note-column.hh"
+#include "warn.hh"
+
/*
- * TODO: Add support for cubic spline segments.
+ TODO: Add support for cubic spline segments.
+
*/
Molecule
brew_cluster_piece (Grob *me, Array<Offset> bottom_points, Array<Offset> top_points)
SCM shape_scm = me->get_grob_property ("style");
String shape;
+
if (gh_symbol_p (shape_scm))
{
shape = ly_symbol2string (shape_scm);
}
else
{
- shape = "leftsided-stairs";
+ programming_error ("#'style should be symbol.");
+ me->suicide();
+ return Molecule();
}
Real left_coord = left_bound->relative_coordinate (common, X_AXIS);
+ Real unit = Staff_symbol_referencer::staff_space (me) *0.5;
+
+ /*
+ TODO: should we move the cluster a little to the right to be in
+ line with the center of the note heads?
+
+ */
for (SCM s = cols; gh_pair_p (s); s = ly_cdr (s))
{
Grob * col = unsmob_grob (ly_car (s));
gh_scm2int (gh_cdr (posns)));
Real x = col->relative_coordinate (common, X_AXIS) - left_coord;
- bottom_points.push (Offset (x, s[DOWN] *0.5));
- top_points.push (Offset (x, s[UP] * 0.5));
+ bottom_points.push (Offset (x, s[DOWN] *unit));
+ top_points.push (Offset (x, s[UP] * unit));
}
/*
Real x = right_bound->relative_coordinate (common,X_AXIS) - left_coord;
- bottom_points.insert (Offset (x, s[DOWN] * 0.5),0);
- top_points.insert (Offset (x, s[UP] * 0.5),0);
+ bottom_points.insert (Offset (x, s[DOWN] * unit),0);
+ top_points.insert (Offset (x, s[UP] * unit),0);
}
}
}
(meta . ((interfaces . (cluster-beacon-interface item-interface))))
))
- (Cluster
+ (ClusterSpanner
. (
(molecule-callback . ,Cluster::brew_molecule)
(spacing-procedure . ,Spanner::set_spacing_rods)
(minimum-length . 0.0)
(padding . 0.25)
- (shape . leftsided-stairs)
+ (style . ramp)
(meta . ((interfaces . (cluster-interface spanner-interface))))
))
(internal-class-name . "Event")
(types . (general-music event busy-playing-event))
- ))
+ ))
+
(ClusterNoteEvent
. (
(description . "A note that is part of a cluster.")
(internal-class-name . "Event")
- (types . (general-music note-event cluster-note-event melodic-event rhythmic-event event))
+
+ ; not a note-event, to ensure that Note_engraver doesn't eat it.
+ (types . (general-music cluster-note-event melodic-event rhythmic-event event))
))
+
(ContextSpeccedMusic
. (
(description . "Interpret the argument music within a specific context.")
(internal-class-name . "Music_wrapper")
(types . (context-specification general-music music-wrapper-music))
))
+
(CrescendoEvent
. (
(description . "Begins or ends a crescendo. Syntax: @var{note}\\cr
(types . (general-music simultaneous-music))
))
+
(SlurEvent
. (
(description . "Start or end slur. Syntax NOTE( and )NOTE")
cn)
music))
-(define-public (notes-to-cluster music)
+(define-public (notes-to-clusters music)
(music-map note-to-cluster music))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
conversions.append (((1,7,23), conv,"barNonAuto -> automaticBars"))
+if 1:
+ def conv(str):
+ if re.search( r'-(start|stop)Cluster', str):
+ sys.stderr.write ("""Cluster syntax has been changed.
+Please refer to the manual for details, and convert manually.
+""")
+
+ raise FatalConversionError()
+
+ return str
+
+ conversions.append (((1,7,24), conv,"cluster syntax"))
+
+
################################
# END OF CONVERSIONS