Hi Carl

Thanks for the hint - I guess it wasn't clear to me when and where ly:stencil-add was
needed.

Now the code works, although there still are som FIXME's. For example the black keys
are generated by thick lines, but unfortunately they have rounded caps.

But I have submitted my code to the snippet repository any way, so hopefully
others can benefit from your help too.

Cheers

/Morten



On 18/1/12 2:55 AM, Carl Sorensen wrote:
On 1/17/12 2:30 PM, "Morten Jagd Christensen"<morte...@jcaps.com>  wrote:

Hello all

I'm trying to make a scheme function that generates a keyboard with
black and white dots for showing specific chord layouts

The code below compiles and produces the keyboard figure

I then call a function (make-dot key) which works fine. What I really
want is
(make-dot-list '(1 5 8))  which should produce a black dot on c, a white
dot on ees and a
black dot on g (for a C major chord).

I suspect that somehow only the last empty-stencil is returned but have
been unable
to solve my problem.

Does anyone have a suggestion how to solve this?

First of all, congratulations on this attempt. It's very good.

You are correct.  You are only returning the empty stencil.

You need the following:

#(define (make-dot-list l1)
    (if (null? l1)
        empty-stencil
        (ly:stencil-add (make-dot (car l1)
                        (make-dot-list (cdr l1))))

This way, you are adding all the stencils.  Previously, you were not doing
anything with the make-dot stencil.  It was getting created, then thrown
away.


Good luck!


Carl


_______________________________________________
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user

Reply via email to