X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=lily%2Fmusic-scheme.cc;h=711df4d1a194352790df0dc839e8ce142316408d;hb=7831acdea3df3cb6579f02efa54de2752f26d7c4;hp=4da272678277b18daac75266058cfafe2435e30f;hpb=dbb4524af169a9c15e5c7fcfddfa1a4b85dd288d;p=lilypond.git diff --git a/lily/music-scheme.cc b/lily/music-scheme.cc index 4da2726782..711df4d1a1 100644 --- a/lily/music-scheme.cc +++ b/lily/music-scheme.cc @@ -3,13 +3,13 @@ source file of the GNU LilyPond music typesetter - (c) 2005--2006 Han-Wen Nienhuys + (c) 2005--2007 Han-Wen Nienhuys */ +#include "music.hh" + #include "duration.hh" #include "warn.hh" -#include "music.hh" -#include "pitch.hh" LY_DEFINE (ly_music_length, "ly:music-length", 1, 0, 0, (SCM mus), @@ -21,15 +21,13 @@ LY_DEFINE (ly_music_length, "ly:music-length", } LY_DEFINE (ly_music_property, - "ly:music-property", 2, 0, 0, (SCM mus, SCM sym), + "ly:music-property", 2, 1, 0, (SCM mus, SCM sym, SCM dfault), "Get the property @var{sym} of music expression @var{mus}.\n" - "If @var{sym} is undefined, return @code{' ()}.\n") + "If @var{sym} is undefined, return @code{'()}.\n") { Music *sc = unsmob_music (mus); SCM_ASSERT_TYPE (sc, mus, SCM_ARG1, __FUNCTION__, "music"); - SCM_ASSERT_TYPE (scm_is_symbol (sym), sym, SCM_ARG2, __FUNCTION__, "symbol"); - - return sc->internal_get_property (sym); + return ly_prob_property (mus,sym,dfault); } LY_DEFINE (ly_music_set_property, "ly:music-set-property!", @@ -38,13 +36,7 @@ LY_DEFINE (ly_music_set_property, "ly:music-set-property!", { Music *sc = unsmob_music (mus); SCM_ASSERT_TYPE (sc, mus, SCM_ARG1, __FUNCTION__, "music"); - SCM_ASSERT_TYPE (scm_is_symbol (sym), sym, SCM_ARG2, __FUNCTION__, "symbol"); - - bool ok = type_check_assignment (sym, val, ly_symbol2scm ("music-type?")); - if (ok) - sc->internal_set_property (sym, val); - - return SCM_UNSPECIFIED; + return ly_prob_set_property_x (mus, sym, val); } @@ -199,23 +191,23 @@ LY_DEFINE (ly_transpose_key_alist, "ly:transpose-key-alist", { Pitch orig (scm_to_int (scm_car (key)), scm_to_int (scm_cdr (key)), - scm_to_int (alter)); + ly_scm2rational (alter)); orig = orig.transposed (*p); SCM key = scm_cons (scm_from_int (orig.get_octave ()), scm_from_int (orig.get_notename ())); - newlist = scm_cons (scm_cons (key, scm_from_int (orig.get_alteration ())), + newlist = scm_cons (scm_cons (key, ly_rational2scm (orig.get_alteration ())), newlist); } else if (scm_is_number (key)) { - Pitch orig (0, scm_to_int (key), scm_to_int (alter)); + Pitch orig (0, scm_to_int (key), ly_scm2rational (alter)); orig = orig.transposed (*p); key = scm_from_int (orig.get_notename ()); - alter = scm_from_int (orig.get_alteration ()); + alter = ly_rational2scm (orig.get_alteration ()); newlist = scm_cons (scm_cons (key, alter), newlist); } }