lilypond-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How to check if script belongs to first note


From: Martín Rincón Botero
Subject: Re: How to check if script belongs to first note
Date: Mon, 31 Oct 2022 09:25:36 +0100

      
  

 Thank you Jean for the information. That works!
  

  
Martín.
  
  

  
  
>   
> On Oct 31, 2022 at 12:00 AM,  <Jean Abou Samra (mailto:jean@abou-samra.fr)>  
> wrote:
>   
>   
>   
>  Le 30/10/2022 à 20:55, Martín Rincón Botero a écrit :  >  Hi all,  >   >   > 
>  I hope this can be answered with pseudo- C++ code. I've been working on 
> something but I'm stuck with this. Say I have a list of scripts produced by 
> extract_grob_set. They all make part of a spanner. How can I generally check 
> if a certain script is attached to the first note of the spanner? I tried 
> getting the x parent of the script (which I imagine is a note), Depends on 
> what kind of script we are talking about. It could also be a FingeringColumn, 
> for example. \version "2.23.80" { \override Fingering.after-line-breaking = 
> #(lambda (grob) (ly:message "~s" (ly:grob-parent grob X))) \set 
> fingeringOrientations = #'(left left)  <c'-1 c''-5>  }  >  getting the column 
> of this x parent (with get_column ()), There is no need to get the X parent 
> for that. Just do script->get_column (), not script->get_x_parent 
> ()->get_column (). get_column () works on any Item (vs. Spanner).  >  and 
> then comparing that column with the first note-column of the spanner without 
> success. Can someone point me in the right direction? My guess from your 
> message is that you did not realize there are two kinds of "columns" 
> involved, paper columns and note columns, which are entirely different 
> things. Note columns are created per-voice, a note column is either a group 
> of notes that should share a stem, or a container for a rest (in LilyPond, 
> rests also have stems, so most note columns have a stem, although those in 
> GregorianTranscriptionVoice don't as you have found out in !1677). Then you 
> have musical paper columns, which are the parents of note columns and more 
> generally of all musical items happening at one given moment, while 
> non-musical paper columns group non-musical items happening at a moment. Cf. 
> https://lilypond.org/doc/v2.23/Documentation/notation/overview-of-object_002dspecific-horizontal-spacing-tweaks.html
>  get_column () finds the *paper* column that an item is a child  of. So if 
> you want to check that a script happens at the same moment as a given note 
> column, you can do script->get_column () == note_column->get_column () But be 
> aware that the script could come from another voice than the one where your 
> NoteColumn was created, so even if that condition is true, it might not 
> belong to your NoteColumn. Depending on the context, maybe that case is not 
> possible, or maybe the condition above is what you actually want, or maybe 
> you want to find something more specific that utilizes your knowledge of what 
> the script is more precisely in order to retain only scripts that actually 
> belong to the note column. -Jean  
>
>   
  
  



reply via email to

[Prev in Thread] Current Thread [Next in Thread]