[Top][All Lists]

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

Use of ly:set-default-scale

From: Felipe Gonçalves Assis
Subject: Use of ly:set-default-scale
Date: Mon, 20 Dec 2010 04:55:52 -0300


In the attached snippet, the call to ly:set-default-scale has no
effect on the midi result, both in the stable and development

I believe that this is due to Pitches being constructed before
the new default_global_scale is set (see files lily/ and
lily/, so that they keep a pointer to the old Scale,
created in scm/lily.scm:387.

This looks bad, because as ly:set-default-scale is called, the
old object gets unprotected.

In fact, by applying the change described in the attached file
diff.txt, I obtained the results I expected (set-scale-test-mine.midi),
which only confirms my suspicions. (The last c is 6 tones higher,
because an octave is hard-coded as 6 tones, but that is another

This leads me to the following questions:

1. Is the current behaviour the desired one?
2. Is it a bug?
3. Do we really have a problem with garbage collection?
    (I observe no consequences)

By the way, there is actually an alternative solution, which would be
to make Pitch objects use default_global_scale directly, instead of
storing its value as an internal field during initialisation. This leads
me to the related question:

4. What is the purpose of the non-static scale_ field in the Pitch class?

I look forward to and would very much appreciate any thoughts on
these from anybody acquainted with this code.

Kind regards,

Attachment: diff.txt
Description: Text document

Description: Text Data

Attachment: set-scale-test-mine.midi
Description: MIDI audio

reply via email to

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