[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Access a tie from a slur
From: |
Urs Liska |
Subject: |
Re: Access a tie from a slur |
Date: |
Tue, 3 Jan 2017 08:14:21 +0100 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Icedove/45.4.0 |
Hi David,
thank you for now. This is proof that one can at least *get* to the
right information, and when the use-case is clearer one may also find a
more efficient approach if possible.
Just one more question (a simple "yes" or "no" or a pointer to a
function name will do, no need to write a solution): The control-points
in tie-cps are of course relative to the tie's notehead. Is it possible
to determine the offset of the f' from the c'? This seems necessary to
make use of tie-cps to modify the slur.
Urs
Am 03.01.2017 um 02:33 schrieb David Nalesnik:
> Hi Urs,
>
> On Mon, Jan 2, 2017 at 6:33 PM, Urs Liska <address@hidden> wrote:
>> Hi all,
>>
>> the message title may be misleading, but it names the only idea I have
>> for my current issue.
>>
>> I am asked to create a strange slur configuration similar to the
>> attached example. The coloring is only for better referencing in the
>> email, and please don't question the notational use of the challenge -
>> it's asked for and I have to provide a solution (well, actually, right
>> now I'm only investigating if there *is* a proper solution I can offer).
>>
>> The task is to have the blue slur reliably point to the middle of the
>> magenta tie. For the example I have simply used \shape with the slur to
>> make it demonstrate the goal. But I am after a proper solution.
>>
>> My question is if it is somehow possible to access the control points of
>> the magenta tie while still being able to set the control points of the
>> blue slur. I would imagine to have the slur end at the magenta f', then
>> have some function implicitly create the tie there and use the tie's
>> control points to set the slur's control points. (In this constellation
>> the tie wouldn't actually be entered explicitly.)
>>
>> Does this sound plausible from the perspective of when which properties
>> can be retrieved and when changed?
>>
> Not much time to work on this, but I can get you to the Tie's
> control-points from the Slur.
>
> This is a bit inefficient since it filters all the grobs in the line
> to get at the Tie, since there's no pointer that I know of which could
> connect the Slur and Tie.
>
> It's also tailored to the use-case you give.
>
> Anyway...
>
> %%%%%
>
> \version "2.19.53"
>
> #(define slur-touches-tie
> (lambda (grob)
> (let* ((rb (ly:spanner-bound grob RIGHT))
> (sys (ly:grob-system grob))
> (when (grob::when rb))
> (elts (ly:grob-array->list
> (ly:grob-object sys 'all-elements)))
> (my-tie (filter (lambda (g)
> (and (grob::has-interface g 'tie-interface)
> (equal? (grob::when g) when)))
> elts))
> (tie-cps (ly:tie::calc-control-points (car my-tie))))
> (display my-tie)
> (newline)
> (display tie-cps)
> (ly:slur::calc-control-points grob))))
>
> {
> \override Slur.control-points = #slur-touches-tie
> c'4( d' e' f')~
> f'1
> }
--
address@hidden
https://openlilylib.org
http://lilypondblog.org