2002-09-28 Han-Wen Nienhuys <hanwen@cs.uu.nl>
+ * lily/context-specced-music-iterator.cc (class
+ Context_specced_music_iterator): new file. Obsoletes the
+ Context_specced_music type.
+
+ * scm/music-types.scm (make-repeated-music): put different kinds
+ of repeated music into music-type table.
+
+ * VERSION: 1.7.1 released.
+
* scm/to-xml.scm: new file.
* input/test/to-xml.ly (fooBar): demo of what is possible with the
+++ /dev/null
-/*
- context-specced-music.cc -- implement Context_specced_music
-
- source file of the GNU LilyPond music typesetter
-
- (c) 1999--2002 Han-Wen Nienhuys <hanwen@cs.uu.nl>
-
- */
-#include "context-specced-music.hh"
-
-
-Context_specced_music::Context_specced_music ()
-{
-}
-
-ADD_MUSIC (Context_specced_music);
+++ /dev/null
-/*
- context-specced-music.hh -- declare Context_specced_music
-
- source file of the GNU LilyPond music typesetter
-
- (c) 1999--2002 Han-Wen Nienhuys <hanwen@cs.uu.nl>
-
- */
-
-#ifndef CONTEXT_SPECCED_MUSIC_HH
-#define CONTEXT_SPECCED_MUSIC_HH
-
-#include "music-wrapper.hh"
-
-class Context_specced_music : public Music_wrapper
-{
-public:
- Context_specced_music ();
- Context_specced_music (SCM);
- VIRTUAL_COPY_CONS (Music);
-};
-#endif /* CONTEXT_SPECCED_MUSIC_HH */
-
#include "music-wrapper.hh"
#include "music-wrapper-iterator.hh"
#include "simple-music-iterator.hh"
-#include "context-specced-music.hh"
#include "ly-smobs.icc"
{
music_ = m;
assert (m);
- if (Context_specced_music * csm =dynamic_cast<Context_specced_music *> (m))
- {
- SCM ct = csm->get_mus_property ("context-type");
- String c_type;
- if (gh_string_p (ct))
- c_type = ly_scm2string (ct);
-
- String c_id;
- SCM ci = csm->get_mus_property ("context-id");
- if (gh_string_p (ci))
- c_id = ly_scm2string (ci);
-
- Translator_group* a
- =report->find_create_translator (c_type, c_id);
-
- set_translator (a);
-
- }
-
if (! report_to ())
set_translator (report);
}
_("More alternatives than repeats. Junking excess alternatives."));
alts = ly_truncate_list (times, alts);
}
-
- Music *r = MY_MAKE_MUSIC("RepeatedMusic");
+
+
+ static SCM proc;
+ if (!proc)
+ proc = scm_c_eval_string ("make-repeated-music");
+
+ SCM mus = scm_call_1 (proc, $2);
+ scm_gc_protect_object (mus); // UGH.
+ Music *r =unsmob_music (mus);
if (beg)
{
r-> set_mus_property ("element", beg->self_scm ());
r->set_mus_property ("repeat-count", gh_int2scm (times >? 1));
r-> set_mus_property ("elements",alts);
- SCM func = scm_primitive_eval (ly_symbol2scm ("repeat-name-to-ctor"));
- SCM result = gh_call1 (func, $2);
-
if (gh_equal_p ($2, scm_makfrom0str ("tremolo")))
{
/*
else
gh_call3 (func, r->self_scm (), gh_int2scm(-intlog2 ($3)), gh_int2scm(0));
}
-
- set_music_properties (r, result);
-
r->set_spot (*$4->origin ());
$$ = r;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; repeats.
-(define-public (repeat-name-to-ctor name)
- (let*
- ((supported-reps
- `(("volta" . ((iterator-ctor . ,Volta_repeat_iterator::constructor)
- (start-moment-function . ,Repeated_music::first_start)
- (length . ,Repeated_music::volta_music_length)))
-
- ("unfold" . ((iterator-ctor . ,Unfolded_repeat_iterator::constructor)
- (start-moment-function . ,Repeated_music::first_start)
- (length . ,Repeated_music::unfolded_music_length)))
- ("fold" . ((iterator-ctor . ,Folded_repeat_iterator::constructor)
- (start-moment-function . ,Repeated_music::minimum_start)
- (length . ,Repeated_music::folded_music_length)))
- ("percent" . ((iterator-ctor . ,Percent_repeat_iterator::constructor)
- (start-moment-function . ,Repeated_music::first_start)
- (length . ,Repeated_music::unfolded_music_length)))
- ("tremolo" . ((iterator-ctor . ,Chord_tremolo_iterator::constructor)
- (start-moment-function . ,Repeated_music::first_start)
-
- ;; the length of the repeat is handled by shifting the note logs
- (length . ,Repeated_music::folded_music_length)))))
-
- (handle (assoc name supported-reps)))
-
- (if (pair? handle)
- (cdr handle)
- (begin
- (ly-warn
- (string-append "Unknown repeat type `" name "'\nSee scm/c++.scm for supported repeats"))
- '(type . 'repeated-music)))))
-
(define-public (unfold-repeats music)
"
This function replaces all repeats with unfold repeats. It was
))
(BarCheck
. (
- (description . "")
-
+ (description . "")
(internal-class-name . "Music")
(types . (general-music bar-check))
(iterator-ctor . ,Bar_check_iterator::constructor)
(ContextSpeccedMusic
. (
(description . "")
-
- (internal-class-name . "Context_specced_music")
+ (iterator-ctor . ,Context_specced_music_iterator::constructor)
+ (internal-class-name . "Music_wrapper")
(types . (context-specification general-music music-wrapper-music))
))
(CrescendoEvent
. (
(description . "")
- (internal-class-name . "Repeated_music")
(type . repeated-music)
(types . (general-music repeated-music))
))
(internal-class-name . "Music")
(types . (separator general-music))
))
-
- ))
+
+ (VoltaRepeatedMusic
+ . (
+ (iterator-ctor . ,Volta_repeat_iterator::constructor)
+ (internal-class-name . "Repeated_music")
+ (description . "")
+ (start-moment-function . ,Repeated_music::first_start)
+ (length . ,Repeated_music::volta_music_length)
+ (types . (general-music repeated-music volta-repeated-music))
+ ))
+
+ (UnfoldedRepeatedMusic
+ . (
+ (iterator-ctor . ,Unfolded_repeat_iterator::constructor)
+ (description . "")
+ (start-moment-function . ,Repeated_music::first_start)
+ (internal-class-name . "Repeated_music")
+ (types . (general-music repeated-music unfolded-repeated-music))
+ (length . ,Repeated_music::unfolded_music_length)
+ ))
+ (PercentRepeatedMusic
+ . (
+ (internal-class-name . "Repeated_music")
+ (description . "")
+ (iterator-ctor . ,Percent_repeat_iterator::constructor)
+ (start-moment-function . ,Repeated_music::first_start)
+ (length . ,Repeated_music::unfolded_music_length)
+ (types . (general-music repeated-music percent-repeated-music))
+ ))
+
+ (TremoloRepeteadMusic
+ . (
+ (iterator-ctor . ,Chord_tremolo_iterator::constructor)
+ (description . "")
+ (internal-class-name . "Repeated_music")
+ (start-moment-function . ,Repeated_music::first_start)
+
+ ;; the length of the repeat is handled by shifting the note logs
+ (length . ,Repeated_music::folded_music_length)
+ (types . (general-music repeated-music tremolo-repeated-music))
+
+ ))
+ (FoldedRepeatedMusic
+ . (
+ (internal-class-name . "Repeated_music")
+ (description . "")
+ (iterator-ctor . ,Folded_repeat_iterator::constructor)
+ (start-moment-function . ,Repeated_music::minimum_start)
+ (length . ,Repeated_music::folded_music_length)
+ (types . (general-music repeated-music folded-repeated-music))
+ ))
+ ))
(set! music-descriptions
(sort music-descriptions alist<?))
(make-music-by-name (cdr entry))
)
))
+
+(define-public (make-repeated-music name)
+ (let*
+ (
+ (handle (assoc
+ name
+ '(("volta" . VoltaRepeatedMusic)
+ ("unfold" . UnfoldedRepeatedMusic)
+ ("percent" . PercentRepeatedMusic)
+ ("tremolo" . TremoloRepeteadMusic)
+ ("fold" . FoldedRepeatedMusic)
+ )))
+ (music-name
+ (if (pair? handle)
+ (cdr handle)
+ (begin
+ (ly-warn
+ (string-append "Unknown repeat type `" name
+ "'\nSee music-types.scm for supported repeats"))
+ 'VoltaRepeatedMusic)
+ )
+ )
+ )
+
+ (make-music-by-name music-name)
+ ))
+