too.
* lily/music.cc (LY_DEFINE): rename to music-mutable-properties
(LY_DEFINE): ly:music-compress new function.
* scm/music-functions.scm (make-non-relative-music): new function.
2004-03-31 Han-Wen Nienhuys <hanwen@xs4all.nl>
+ * scm/music-functions.scm (unfold-repeats): undo music compression
+ too.
+
+ * lily/music.cc (LY_DEFINE): rename to music-mutable-properties
+ (LY_DEFINE): ly:music-compress new function.
+
* scm/part-combiner.scm (determine-split-list): split for voice
crossings
\version "2.1.30"
-\header {
- texidoc = "Repeats may be unfolded through the Scheme function @code{unfold-repeats}."
+\header { texidoc = "Volta repeats may be unfolded through the Scheme
+ function @code{unfold-repeats}."
+
}
nots = \notes\relative c' {
c4 \repeat volta 2 c4 \alternative { d e }
- \repeat tremolo 4 { c16 d }
}
-\score { \notes \context Voice {
-\nots
-\apply #unfold-repeats \nots
+\score {
+ \notes \context Voice {
+ \nots
+ \bar "||"
+ \apply #unfold-repeats \nots
+ }
+ \paper {raggedright = ##t}
}
-\paper {raggedright = ##t}
- }
}
/* todo: property args */
-LY_DEFINE (ly_mutable_music_properties, "ly:mutable-music-properties",
+LY_DEFINE (ly_music_mutable_properties, "ly:music-mutable-properties",
1, 0, 0, (SCM mus),
"Return an alist containing the mutable properties of @var{mus}.\n"
"The immutable properties are not available, since "
return sc->self_scm ();
}
+/*
+ TODO: should take moment factor?
+ */
+LY_DEFINE (ly_music_compress, "ly:music-compress",
+ 3, 0, 0, (SCM m, SCM factor),
+ "Compress music object @var{m} by moment @var{factor}."
+ )
+{
+ Music * sc = unsmob_music (m);
+
+ SCM_ASSERT_TYPE (sc, m, SCM_ARG1, __FUNCTION__, "music");
+ SCM_ASSERT_TYPE (unsmob_moment (factor), factor, SCM_ARG2, __FUNCTION__, "moment");
+
+ sc->compress (*unsmob_moment (factor));
+ return sc->self_scm ();
+}
Music*
make_music_by_name (SCM sym)
{
SCM make_music_proc = ly_scheme_function ("make-music");
-
SCM rv = scm_call_1 (make_music_proc, sym);
/* UGH. */
SCM
make_simple_markup (SCM a)
{
- SCM simple = scm_c_eval_string ("simple-markup");
+ SCM simple = ly_scheme_function ("simple-markup");
return scm_list_2 (simple, a);
}
we can not get durations and other stuff correct down the line, so we have to
add to the duration log here.
*/
- static SCM func;
-
- if (!func)
- func = scm_primitive_eval (ly_symbol2scm ("shift-duration-log"));
+ SCM func = ly_scheme_function ("shift-duration-log");
int dots = ($3 % 3) ? 0 : 1;
int shift = -intlog2 ((dots) ? ($3*2/3) : $3);
"
This function replaces all repeats with unfold repeats. It was
written by Rune Zedeler. "
+
(let ((es (ly:music-property music 'elements))
(e (ly:music-property music 'element))
(n (ly:music-name music)))
(if (equal? n "Repeated_music")
- (begin
+ (let*
+ ((seq-arg? (memq 'sequential-music
+ (ly:music-property e 'types))))
+
(if (equal? (ly:music-property music 'iterator-ctor)
Chord_tremolo_iterator::constructor)
- (shift-duration-log music (ly:intlog2 (ly:music-property music 'repeat-count)) 0))
+ (begin
+ (shift-duration-log music (+ (if seq-arg? 1 0)
+ (ly:intlog2 (ly:music-property music 'repeat-count))) 0)
+ (if seq-arg?
+ (ly:music-compress e (ly:make-moment (length (ly:music-property e 'elements)) 1)))
+ ))
+
(set! (ly:music-property music 'length)
Repeated_music::unfolded_music_length)
(set! (ly:music-property music 'start-moment-function)
Repeated_music::first_start)
(set! (ly:music-property music 'iterator-ctor)
Unfolded_repeat_iterator::constructor)))
+
(if (pair? es)
(set! (ly:music-property music 'elements)
(map unfold-repeats es)))
conversions.append (((2,1,34), conv,
'''set-paper-size -> set-default-paper-size.'''))
+def conv (str):
+ str = re.sub (r"ly:mutable-music-properties",
+ "ly:music-mutable-properties", str)
+ return str
+
+conversions.append (((2,1, 36), conv,
+ '''ly:mutable-music-properties -> ly:music-mutable-properties'''))
+
################################
# END OF CONVERSIONS
################################