+2003-01-04 Han-Wen Nienhuys <hanwen@cs.uu.nl>
+
+ * Documentation/user/appendices.itely (scheme): update for new syntax.
+
+ * input/regression/chord-name-styles.ly: new file
+
+ * lily/instrument-name-engraver.cc: create instrument names
+ without barline too. Allows instrument name on ChordNames
+
+ * scm/new-markup.scm (interpret-markup): allow simple strings as
+ markup too.
+
2003-01-04 Jan Nieuwenhuizen <janneke@gnu.org>
* scm/chord-name.scm: Super/raise changes and fixes for Banter.
\score {
\notes <
- \context ChordNames \scheme
+ \context ChordNames {
+ #(set-chord-name-style 'american)
+ \scheme }
\context Staff \transpose c c' \scheme
>
\paper {
linewidth = 5.7\in
- \translator {
- \ChordNamesContext
- ChordName \override #'word-space = #1
- ChordName \override #'style = #'american
- }
}
}
@end lilypond
\score {
\notes <
- \context ChordNames \scheme
+ \context ChordNames {
+ #(set-chord-name-style 'jazz)
+ \scheme }
\context Staff \transpose c c' \scheme
>
\paper {
linewidth = 5.7\in
- \translator {
- \ChordNamesContext
- ChordName \override #'word-space = #1
- ChordName \override #'style = #'jazz
- }
}
}
@end lilypond
--- /dev/null
+\header {
+ texidoc = " show different naming conventions"
+}
+
+\version "1.7.10"
+
+scheme = \chords {
+ % major chords
+ c
+ c:6 % 6 = major triad with added sixth
+ c:maj % triangle = maj
+ c:6.9^7 % 6/9
+ c:9^7 % add9
+
+ % minor chords
+ c:m % m = minor triad
+ c:m.6 % m6 = minor triad with added sixth
+ c:m.7+ % m triangle = minor major seventh chord
+ c:3-.6.9^7 % m6/9
+ c:m.7 % m7
+ c:3-.9 % m9
+ c:3-.9^7 % madd9
+
+ % dominant chords
+ c:7 % 7 = dominant
+ c:7.5+ % +7 = augmented dominant
+ c:7.5- % 7b5 = hard diminished dominant
+ c:9 % 7(9)
+ c:9- % 7(b9)
+ c:9+ % 7(#9)
+ c:13^9.11 % 7(13)
+ c:13-^9.11 % 7(b13)
+ c:13^11 % 7(9,13)
+ c:13.9-^11 % 7(b9,13)
+ c:13.9+^11 % 7(#9,13)
+ c:13-^11 % 7(9,b13)
+ c:13-.9-^11 % 7(b9,b13)
+ c:13-.9+^11 % 7(#9,b13)
+
+ % half diminished chords
+ c:m5-.7 % slashed o = m7b5
+ c:9.3-.5- % o/7(pure 9)
+
+ % diminished chords
+ c:m5-.7- % o = diminished seventh chord
+}
+
+\score {
+ \notes <
+ \context ChordNames {
+ #(set-chord-name-style 'jazz)
+ \property ChordNames.instrument = #"Jazz"
+ \property ChordNames.instr = #"Jz"
+ \scheme }
+ \context ChordNames = bn {
+ #(set-chord-name-style 'banter)
+ \property ChordNames.instrument = # "Banter"
+ \property ChordNames.instr = #"Bn"
+ \scheme }
+ \context ChordNames = am {
+ #(set-chord-name-style 'american)
+ \property ChordNames.instr = #"Am"
+ \property ChordNames.instrument = #"American"
+ \scheme }
+ \context Staff \transpose c c' \scheme
+ >
+\paper {
+linewidth = 16.0\cm
+
+\translator {
+ \ChordNamesContext \consists Instrument_name_engraver }
+}
+}
+%% new-chords-done %%
--- /dev/null
+\header {
+
+texidoc = "Instrument names are set with Staff.instrument and
+Staff.instr. You can enter markup texts to create more funky names,
+including alterations. "
+
+}
+
+
+\version "1.7.6"
+
+
+\score {
+ \notes \context Staff = treble {
+ \property Staff.instrument
+ = \markup { \column << "Clarinetti" { "in B" \smaller \musicglyph #"accidentals--1" } >> }
+ \property Staff.instr
+ = \markup { \smaller { "Cl(B" \smaller \musicglyph #"accidentals--1" ")" } }
+
+ { c''1 \break c'' }
+
+ }
+ \paper { linewidth= 8.0\cm }
+}
+
+%% new-chords-done %%
--- /dev/null
+\version "1.7.6"
+\header{
+texidoc="
+Staff margins are also markings attached to barlines. They should be
+left of the staff, and be centered vertically wrt the staff. They may
+be on normal staves, but also on compound staves, like the PianoStaff
+"
+}
+
+
+
+
+\score {
+
+ \notes \context PianoStaff <
+ \context Staff = treble {
+ \property PianoStaff.instrument = "Piano "
+ \property Staff.instrument = "Right " { c''4 }}
+ \context Staff = bass { \property Staff.instrument = "Left " \clef bass c4 }>
+
+\paper {
+linewidth=-1.0
+}}
+
+%% new-chords-done %%
+++ /dev/null
-\version "1.7.6"
-\header{
-texidoc="
-Staff margins are also markings attached to barlines. They should be
-left of the staff, and be centered vertically wrt the staff. They may
-be on normal staves, but also on compound staves, like the PianoStaff
-"
-}
-
-
-
-
-\score {
-
- \notes \context PianoStaff <
- \context Staff = treble {
- \property PianoStaff.instrument = "Piano "
- \property Staff.instrument = "Right " { c''4 }}
- \context Staff = bass { \property Staff.instrument = "Left " \clef bass c4 }>
-
-\paper {
-linewidth=-1.0
-}}
-
-%% new-chords-done %%
\version "1.7.10"
-
-
+\header {
+texidoc = "Jazz notation for chord names."
+}
%% This should only be necessary if your kpathsea setup is broken
%
+++ /dev/null
-\header {
-texidoc = "Instrument names are
-set with Staff.instrument and Staff.instr"
-}
-
-
-\version "1.7.6"
-
-
-\score {
- \notes \context Staff = treble {
- \property Staff.instrument
- = \markup { \column << "Clarinetti" { "in B" \smaller \musicglyph #"accidentals--1" } >> }
- \property Staff.instr
- = \markup { \smaller { "Cl(B" \smaller \musicglyph #"accidentals--1" ")" } }
-
- { c''1 \break c'' }
-
- }
- \paper { linewidth= 8.0\cm }
-}
-
-%% new-chords-done %%
*/
yy_switch_to_buffer (yy_create_buffer (sl->get_istream (), YY_BUF_SIZE));
-
}
/*
Item *text_;
Grob *delim_ ;
- void create_text (SCM s);
+ void create_text ();
public:
TRANSLATOR_DECLARATIONS(Instrument_name_engraver);
virtual void initialize ();
virtual void acknowledge_grob (Grob_info);
virtual void stop_translation_timestep ();
+ virtual void process_music ();
};
}
void
-Instrument_name_engraver::create_text (SCM txt)
+Instrument_name_engraver::create_text ()
{
- if (!text_)
+ if (!text_)
{
+ SCM txt = get_property ("instrument");
+
+ if (now_mom () > Moment (0))
+ txt = get_property ("instr");
+
+ if (!new_markup_p (txt))
+ return ;
+
text_ = new Item (get_property ("InstrumentName"));
if (text_->get_grob_property ("text") != txt)
{
if (Bar_line::has_interface (i.grob_))
{
- SCM s = get_property ("instrument");
-
- if (now_mom () > Moment (0))
- s = get_property ("instr");
-
- /*
- FIXME: use get_markup () to check type.
- */
- if (gh_string_p (s) || gh_pair_p (s))
- create_text (s);
+ create_text();
}
if (dynamic_cast<Spanner*> (i.grob_)
groups enclosing that staff. The alignment has no real location,
but is only a vehicle for the placement routine it contains, and
therefore the location of its refpoint won't be very useful.
-
We could also just use stavesFound, but lets keep this working
without staffs as well.
-
*/
if (dynamic_cast<Spanner*> (i.grob_)
&& ((Axis_group_interface::has_interface (i.grob_)
}
}
-
-
+void
+Instrument_name_engraver::process_music ()
+{
+ /*
+ Also create text if barlines in other groups. This allows
+ a name to be attached to lyrics or chords.
+ */
+ if (gh_string_p (get_property ("whichBar")))
+ create_text();
+}
ENTER_DESCRIPTION(Instrument_name_engraver,
/* descr */ " Prints the name of the instrument (specified by "
"text axis baseline-skip extent lookup raise kern word-space");
+/*
+ Ugh. Duplicated from Scheme.
+ */
bool
new_markup_p (SCM x)
{
- return gh_pair_p (x)
- && SCM_BOOL_F != scm_object_property (gh_car (x), ly_symbol2scm ("markup-signature"));
+ return
+ gh_string_p (x) ||
+ (gh_pair_p (x)
+ && SCM_BOOL_F != scm_object_property (gh_car (x), ly_symbol2scm ("markup-signature")));
}
SCM
;; full recursive typecheck.
;;
(define (markup-typecheck? arg)
- (and (pair? arg)
+ (or (string? arg)
+ (and (pair? arg)
(markup-function? (car arg))
(markup-argument-list?
(object-property (car arg) 'markup-signature)
(cdr arg))
))
+)
;;
;; typecheck, and throw an error when something amiss.
;;
(define (markup-thrower-typecheck arg)
(cond
+ ((string? arg) #t)
((not (pair? arg))
(throw 'markup-format "Not a pair" arg)
)
#t
)
-
;;
;; good enough if you only use make-XXX-markup functions.
;;
(define (cheap-markup? x)
- (and (pair? x)
- (markup-function? (car x)))
+ (or (string? x)
+ (and (pair? x)
+ (markup-function? (car x))))
)
;;
(define-public empty-markup `(,simple-markup ""))
(define (interpret-markup grob props markup)
- (let*
- (
- (func (car markup))
- (args (cdr markup))
- )
-
- (apply func (cons grob (cons props args)) )
- ))
+ (if (string? markup)
+ (simple-markup grob props markup)
+ (let*
+ (
+ (func (car markup))
+ (args (cdr markup))
+ )
+
+ (apply func (cons grob (cons props args)) )
+ )))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;