|
Subject: Re: Fw: définition d'un nouveau contexte Newsgroups: gmane.comp.gnu.lilypond.general Date: 2008-06-13 09:38:25 GMT (12 weeks, 1 day, 22 hours and 24 minutes ago) Germain G. Ivanoff-Trinadtzaty wrote: > Hello, > > I've got two problems defining a new context \StaffSA, based on \Staff. Your code below defines a new context type StaffSA which does not contain any engravers and it's not based on the Staff context type (the description in the manual of what \alias does is very simplified and it seems that you have misinterpreted it). Unfortunately, there is no good explanation anywhere in the manual on how to make a new context type based on an existing one. However, you can find some examples in the mailing list archives, for example http://lists.gnu.org/archive/html/lilypond-user/2008-02/msg00837.html I also recommend you to take a look at the file ly/engraver-init.ly, where all the default contexts are defined. For example, if you look at the definition of the PianoStaff context, you will see how to base a new context definition on an already existing one. What is it really that you try to obtain? What should the new context type do that Staff doesn't? /Mats > I followed instruction from NR 6.2.5 Defining new contexts. > http://lilypond.org/doc/v2.11/Documentation/user/lilypond/Defining-new-contexts#Defining-new-contexts > > With the definitions that follow : > 1) I get two staves for one \new \StaffSA > 2) their instrumentName don't print > > What's wrong ? > > Thanks, > Germain > > ps: btw, are de sharps (#) well suited ? (i mean : in the right place ?) > > at : "test-newcontext.png" > > %% Test de définition d'un nouveau contexte > > \version "2.11.47" > \include "english.ly" > > Global = { \key f \major } > NotesDiscantus = { a'4 a'1 } > NotesCantus = { f'4 f'1 } > NotesFiller = { c'4 c'1 } > NotesBassus = { f4 f1 } > Words = \lyricmode { Ta __ daa } > > %---------------% > StaffVoiceNames = %% for Staff context > #(define-music-function (parser location n-max-width s-one s-two) > (number? string? string?) > "Format and print voice names for one staff" > #{ > \set Staff . instrumentName = \markup { \column { > \hcenter-in #$n-max-width $s-one > \hcenter-in #$n-max-width $s-two } } > #}) > %---------------% > StaffSAVoiceNames = %% same as above, but for StaffSA context > #(define-music-function (parser location n-max-width s-one s-two) > (number? string? string?) > "Format and print voice names for one staff" > #{ > \set StaffSA . instrumentName = \markup { \column { > \hcenter-in #$n-max-width $s-one > \hcenter-in #$n-max-width $s-two } } > #}) > %---------------% > \layout % commun > { > \context { \Score > \remove Bar_number_engraver } > \context { \ChoirStaff %% si placé après déf. de StaffSA : idem > \consists Instrument_name_engraver > \override InstrumentName #'self-alignment-X = #LEFT > \accepts StaffSA } > \context { \Staff > \remove Time_signature_engraver > \override InstrumentName #'self-alignment-X = #RIGHT } > \context { \name StaffSA > \type "Engraver_group" > \alias Staff } > } > %---------------% > \score % 1 > { > \new ChoirStaff > << > \set ChoirStaff . instrumentName = "N°1 Strange behaviour :" > > \new StaffSA > << > \StaffSAVoiceNames #3 #"S." #"A." %% ne donne rien > % \StaffVoiceNames #3 #"S." #"A." %% ne marche pas non plus > \clef "G" \Global > \new Voice = "one" { \voiceOne \NotesDiscantus } > \new Voice { \voiceTwo \NotesCantus } > >> > > \new Lyrics = thewords { s } > > \new Staff > << > \StaffVoiceNames #3 #"T." #"B." > \clef "F" \Global > \new Voice { \voiceOne \NotesFiller } > \new Voice { \voiceTwo \NotesBassus } > >> > \context Lyrics = thewords \lyricsto "one" { \Words } > >> > \layout { indent = 65\mm } > } > > ------------------------------------------------------------------------ > > ------------------------------------------------------------------------ > > _______________________________________________ > lilypond-user mailing list > lilypond-user <at> gnu.org > http://lists.gnu.org/mailman/listinfo/lilypond-user > -- ============================================= Mats Bengtsson Signal Processing School of Electrical Engineering Royal Institute of Technology (KTH) SE-100 44 STOCKHOLM Sweden Phone: (+46) 8 790 8463 Fax: (+46) 8 790 7260 Email: mats.bengtsson <at> ee.kth.se WWW: http://www.s3.kth.se/~mabe ============================================= |
|
|