#include "music.hh"
#include "duration.hh"
+#include "program-option.hh"
#include "warn.hh"
LY_DEFINE (ly_music_length, "ly:music-length",
return sc->self_scm ();
}
+LY_DEFINE (ly_make_music_relative_x, "ly:make-music-relative!",
+ 2, 0, 0, (SCM music, SCM pitch),
+ "Make @var{music} relative to @var{pitch},"
+ " return final pitch.")
+{
+ LY_ASSERT_TYPE (unsmob_music, music, 1);
+ LY_ASSERT_TYPE (unsmob_pitch, pitch, 2);
+
+ Pitch start = *unsmob_pitch (pitch);
+ Music *m = unsmob_music (music);
+ Pitch last = m->to_relative_octave (start);
+ if (lily_1_8_relative)
+ m->set_property ("last-pitch", last.smobbed_copy ());
+
+ return last.smobbed_copy ();
+}
+
+
LY_DEFINE (ly_music_duration_length, "ly:music-duration-length", 1, 0, 0,
(SCM mus),
"Extract the duration field from @var{mus} and return the"
PITCH_IDENTIFIER NOTENAME_PITCH TONICNAME_PITCH
SCM_FUNCTION SCM_IDENTIFIER SCM_TOKEN
UNSIGNED DURATION_IDENTIFIER
+ CHORDMODE CHORDS DRUMMODE DRUMS FIGUREMODE FIGURES LYRICMODE LYRICS
+ NOTEMODE
/* The above are the symbols that can start function arguments */
#include "main.hh"
#include "misc.hh"
#include "music.hh"
-#include "music.hh"
#include "output-def.hh"
#include "paper-book.hh"
-#include "program-option.hh"
#include "scm-hash.hh"
#include "score.hh"
#include "text-interface.hh"
static Music *make_music_with_input (SCM name, Input where);
-SCM make_music_relative (Pitch start, SCM music, Input loc);
SCM run_music_function (Lily_parser *parser, Input loc, SCM func, SCM args);
SCM check_scheme_arg (Lily_parser *parser, Input loc, SCM fallback,
SCM arg, SCM args, SCM pred);
%token ONCE "\\once"
%token OVERRIDE "\\override"
%token PAPER "\\paper"
-%token RELATIVE "\\relative"
%token REMOVE "\\remove"
%token REPEAT "\\repeat"
%token REST "\\rest"
%type <scm> post_event
%type <scm> post_event_nofinger
%type <scm> re_rhythmed_music
-%type <scm> relative_music
%type <scm> simple_element
%type <scm> simple_music_property_def
%type <scm> start_symbol
%type <scm> music_function_call
%type <scm> music_list
-%type <scm> absolute_pitch
%type <scm> assignment_id
%type <scm> bare_number
%type <scm> unsigned_number
$$ = MAKE_SYNTAX ("time-scaled-music", @$, $2, $3);
}
| repeated_music { $$ = $1; }
- | relative_music { $$ = $1; }
| re_rhythmed_music { $$ = $1; }
;
}
;
-
-relative_music:
- RELATIVE absolute_pitch music {
- Pitch start = *unsmob_pitch ($2);
- $$ = make_music_relative (start, $3, @$);
- }
- | RELATIVE composite_music {
- Pitch middle_c (0, 0, 0);
- $$ = make_music_relative (middle_c, $2, @$);
- }
- ;
-
new_lyrics:
ADDLYRICS { PARSER->lexer_->push_lyric_state (); }
/*cont */
| '-' { $$ = CENTER; }
;
-
-absolute_pitch:
- pitch {
- $$ = $1;
- }
- ;
-
duration_length:
multiplied_duration {
$$ = $1;
|| (scm_is_pair (x) && ly_is_procedure (scm_car (x)));
}
-SCM
-make_music_relative (Pitch start, SCM music, Input loc)
-{
- Music *relative = MY_MAKE_MUSIC ("RelativeOctaveMusic", loc);
- relative->set_property ("element", music);
-
- Music *m = unsmob_music (music);
- Pitch last = m->to_relative_octave (start);
- if (lily_1_8_relative)
- m->set_property ("last-pitch", last.smobbed_copy ());
- return relative->unprotect ();
-}
-
int
yylex (YYSTYPE *s, YYLTYPE *loc, void *v)
{