--- /dev/null
+\version "2.13.4"
+
+\header {
+texidoc = "Postfix functions for custom crescendo text spanners. The spanners
+should start on the first note of the measure. One has to use -\mycresc,
+otherwise the spanner start will rather be assigned to the next note."
+}
+
+% Two functions for (de)crescendo spanners where you can explicitly give the
+% spanner text.
+mycresc = #(define-music-function (parser location mymarkup) (string?)
+ (make-music 'CrescendoEvent 'span-direction START
+ 'span-type 'text 'span-text mymarkup))
+mydecresc = #(define-music-function (parser location mymarkup) (string?)
+ (make-music 'DecrescendoEvent 'span-direction START
+ 'span-type 'text 'span-text mymarkup))
+
+\relative c' {
+ c4-\mycresc "custom cresc" c4 c4 c4 |
+ c4 c4 c4 c4 |
+ c4-\mydecresc "custom decresc" c4 c4 c4 |
+ c4 c4\! c4 c4
+}
+
+
+
--- /dev/null
+\version "2.13.4"
+
+\header {
+texidoc = "The \cresc, \dim and \decresc spanners can now be redefined as
+postfix operators and produce one text spanner. Defining custom spanners is
+also easy. Hairpin and text crescendi can be easily mixed. \< and \> produce
+hairpins by default, \cresc etc. produce text spanners by default."
+}
+
+% Some sample text dynamic spanners, to be used as postfix operators
+crpoco = #(make-music 'CrescendoEvent 'span-direction START
+ 'span-type 'text 'span-text "cresc. poco a poco")
+% Redefine the existing \cresc, \dim and \decresc commands to use postfix syntax
+cresc = #(make-music 'CrescendoEvent 'span-direction START
+ 'span-type 'text 'span-text "cresc.")
+dim = #(make-music 'DecrescendoEvent 'span-direction START
+ 'span-type 'text 'span-text "dim.")
+decresc = #(make-music 'DecrescendoEvent 'span-direction START
+ 'span-type 'text 'span-text "decresc.")
+
+\relative c' {
+ c4\cresc d4 e4 f4 |
+ g4 a4\! b4\crpoco c4 |
+ c4 d4 e4 f4 |
+ g4 a4\! b4\< c4 |
+ g4\dim a4 b4\decresc c4\!
+}
--- /dev/null
+\version "2.13.4"
+
+\header {
+texidoc = "Postfix functions for custom crescendo text spanners. The spanners
+should start on the first note of the measure. One has to use -\mycresc,
+otherwise the spanner start will rather be assigned to the next note."
+}
+
+% Two functions for (de)crescendo spanners where you can explicitly give the
+% spanner text.
+mycresc = #(define-music-function (parser location mymarkup) (string?)
+ (make-music 'CrescendoEvent 'span-direction START
+ 'span-type 'text 'span-text mymarkup))
+mydecresc = #(define-music-function (parser location mymarkup) (string?)
+ (make-music 'DecrescendoEvent 'span-direction START
+ 'span-type 'text 'span-text mymarkup))
+
+\relative c' {
+ c4-\mycresc "custom cresc" c4 c4 c4 |
+ c4 c4 c4 c4 |
+ c4-\mydecresc "custom decresc" c4 c4 c4 |
+ c4 c4\! c4 c4
+}
+
+
+
--- /dev/null
+\version "2.13.4"
+
+\header {
+texidoc = "The \cresc, \dim and \decresc spanners can now be redefined as
+postfix operators and produce one text spanner. Defining custom spanners is
+also easy. Hairpin and text crescendi can be easily mixed. \< and \> produce
+hairpins by default, \cresc etc. produce text spanners by default."
+}
+
+% Some sample text dynamic spanners, to be used as postfix operators
+crpoco = #(make-music 'CrescendoEvent 'span-direction START
+ 'span-type 'text 'span-text "cresc. poco a poco")
+% Redefine the existing \cresc, \dim and \decresc commands to use postfix syntax
+cresc = #(make-music 'CrescendoEvent 'span-direction START
+ 'span-type 'text 'span-text "cresc.")
+dim = #(make-music 'DecrescendoEvent 'span-direction START
+ 'span-type 'text 'span-text "dim.")
+decresc = #(make-music 'DecrescendoEvent 'span-direction START
+ 'span-type 'text 'span-text "decresc.")
+
+\relative c' {
+ c4\cresc d4 e4 f4 |
+ g4 a4\! b4\crpoco c4 |
+ c4 d4 e4 f4 |
+ g4 a4\! b4\< c4 |
+ g4\dim a4 b4\decresc c4\!
+}
virtual void process_music ();
virtual void stop_translation_timestep ();
private:
+ SCM get_property_setting (Stream_event *evt, char const *evprop, char const *ctxprop);
+
Drul_array<Stream_event *> accepted_spanevents_drul_;
Spanner *current_spanner_;
Spanner *finished_spanner_;
ASSIGN_EVENT_ONCE (accepted_spanevents_drul_[d], ev);
}
+SCM
+New_dynamic_engraver::get_property_setting (Stream_event *evt, char const *evprop, char const *ctxprop)
+{
+ SCM spanner_type = evt->get_property (evprop);
+ if (spanner_type == SCM_EOL)
+ spanner_type = get_property (ctxprop);
+ return spanner_type;
+}
void
New_dynamic_engraver::process_music ()
return;
}
- SCM cresc_type = get_property ((start_type + "Spanner").c_str ());
+ SCM cresc_type = get_property_setting (current_span_event_, "span-type",
+ (start_type + "Spanner").c_str ());
if (cresc_type == ly_symbol2scm ("text"))
{
= make_spanner ("DynamicTextSpanner",
accepted_spanevents_drul_[START]->self_scm ());
- SCM text = get_property ((start_type + "Text").c_str ());
+ SCM text = get_property_setting (current_span_event_, "span-text",
+ (start_type + "Text").c_str ());
if (Text_interface::is_markup (text))
{
current_spanner_->set_property ("text", text);
(repeat-count ,integer? "Do a @code{\\repeat} how often?")
(span-direction ,ly:dir? "Does this start or stop a spanner?")
- (span-type ,string? "What kind of spanner should be created?
+ (span-type ,string? "What kind of spanner should be created? E.g. ligature
+for ligatures, or text or hairpin for (de-)crescendi.
TODO: Consider making type into symbol.")
+ (span-text ,string? "The displayed text for text spanners (e.g. cresc.)")
(split-list ,list? "Splitting moments for part combiner.")
(start-callback ,procedure? "Function to compute the negative length
of starting grace notes. This property can only be defined as initializer