music-cause

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

music-cause

David Kastrup

Anybody actually using the "music-cause"?  Inside of LilyPond, the only
appearance (apart from its declaration) would be

  /*
    ES TODO: This is a temporary fix. Stream_events should not be
    aware of music.
  */
  e->set_property ("music-cause", self_scm ());

It would likely have some minor benefits in memory usage if this would
be retired since the music events could be garbage collected after
conversion to stream events.  It is also conceptually cleaner.

--
David Kastrup


_______________________________________________
lilypond-devel mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/lilypond-devel
Reply | Threaded
Open this post in threaded view
|

Re: music-cause

Graham Percival-3
On Sun, Jan 22, 2012 at 11:49:06AM +0100, David Kastrup wrote:
>
> Anybody actually using the "music-cause"?  Inside of LilyPond, the only
> appearance (apart from its declaration) would be
>
>   /*
>     ES TODO: This is a temporary fix. Stream_events should not be
>     aware of music.
>   */
>   e->set_property ("music-cause", self_scm ());

If it's used anywhere, it would be here:
http://lilypond.org/website/pdf/thesis-erik-sandberg

It may have been added just so he could produce some graphs or
tables or something?  I know that I have a ton of "graph-producing
code" in Artifastring and Vivi like that.

- Graham

_______________________________________________
lilypond-devel mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/lilypond-devel
Reply | Threaded
Open this post in threaded view
|

Re: music-cause

David Kastrup
Graham Percival <[hidden email]> writes:

> On Sun, Jan 22, 2012 at 11:49:06AM +0100, David Kastrup wrote:
>>
>> Anybody actually using the "music-cause"?  Inside of LilyPond, the only
>> appearance (apart from its declaration) would be
>>
>>   /*
>>     ES TODO: This is a temporary fix. Stream_events should not be
>>     aware of music.
>>   */
>>   e->set_property ("music-cause", self_scm ());
>
> If it's used anywhere, it would be here:
> http://lilypond.org/website/pdf/thesis-erik-sandberg
>
> It may have been added just so he could produce some graphs or
> tables or something?  I know that I have a ton of "graph-producing
> code" in Artifastring and Vivi like that.

Seems somewhat pointless since events take the whole mutable property
list of their originating music event anyway.  If you need more for
tracking, you could just do

maketrackable =
#(define-music-function (parser location m)
  (music-map
    (lambda (m)
       (set! ly:music-property 'music-cause m)
       m)
    m))

and call that on your music before processing.


--
David Kastrup

_______________________________________________
lilypond-devel mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/lilypond-devel
Reply | Threaded
Open this post in threaded view
|

Re: music-cause

David Kastrup
David Kastrup <[hidden email]> writes:

> Graham Percival <[hidden email]> writes:
>
>> On Sun, Jan 22, 2012 at 11:49:06AM +0100, David Kastrup wrote:
>>>
>>> Anybody actually using the "music-cause"?  Inside of LilyPond, the only
>>> appearance (apart from its declaration) would be
>>>
>>>   /*
>>>     ES TODO: This is a temporary fix. Stream_events should not be
>>>     aware of music.
>>>   */
>>>   e->set_property ("music-cause", self_scm ());
>>
>> If it's used anywhere, it would be here:
>> http://lilypond.org/website/pdf/thesis-erik-sandberg
>>
>> It may have been added just so he could produce some graphs or
>> tables or something?  I know that I have a ton of "graph-producing
>> code" in Artifastring and Vivi like that.
>
> Seems somewhat pointless since events take the whole mutable property
> list of their originating music event anyway.  If you need more for
> tracking, you could just do
>
> maketrackable =
> #(define-music-function (parser location m)
>   (music-map
>     (lambda (m)
>        (set! ly:music-property 'music-cause m)
>        m)
>     m))
>
> and call that on your music before processing.

I lean towards going through with my threat here and removing
music-cause which seems like a weird punch-through kind of property.
Any objections here?  Anybody actually using it anywhere?

--
David Kastrup

Reply | Threaded
Open this post in threaded view
|

Re: music-cause

Urs Liska-3
Am Donnerstag, den 20.02.2020, 17:12 +0100 schrieb David Kastrup:

> David Kastrup <[hidden email]> writes:
>
> > Graham Percival <[hidden email]> writes:
> >
> > > On Sun, Jan 22, 2012 at 11:49:06AM +0100, David Kastrup wrote:
> > > > Anybody actually using the "music-cause"?  Inside of LilyPond,
> > > > the only
> > > > appearance (apart from its declaration) would be
> > > >
> > > >   /*
> > > >     ES TODO: This is a temporary fix. Stream_events should not
> > > > be
> > > >     aware of music.
> > > >   */
> > > >   e->set_property ("music-cause", self_scm ());
> > >
> > > If it's used anywhere, it would be here:
> > > http://lilypond.org/website/pdf/thesis-erik-sandberg
> > >
> > > It may have been added just so he could produce some graphs or
> > > tables or something?  I know that I have a ton of "graph-
> > > producing
> > > code" in Artifastring and Vivi like that.
> >
> > Seems somewhat pointless since events take the whole mutable
> > property
> > list of their originating music event anyway.  If you need more for
> > tracking, you could just do
> >
> > maketrackable =
> > #(define-music-function (parser location m)
> >   (music-map
> >     (lambda (m)
> >        (set! ly:music-property 'music-cause m)
> >        m)
> >     m))
> >
> > and call that on your music before processing.
>
> I lean towards going through with my threat here and removing
> music-cause which seems like a weird punch-through kind of property.
> Any objections here?  Anybody actually using it anywhere?
>

It is used in openLilyLib a few times, I assume by Jan-Peter:

$ grep -rnw . -e 'music-cause'
./snippets/editorial-tools/auto-
transpose/module.ily:79:               ;  (ly:make-stream-event 'key-
change-event `((music-cause . ,key-sig)) ))
./snippets/editorial-tools/auto-transpose/module.ily:92:        (cond-
transp engraver (ly:event-property event 'music-cause)))
./snippets/editorial-tools/auto-transpose/module.ily:95:        (cond-
transp engraver (ly:event-property event 'music-cause)))
./edition-
engraver/engine.scm:944:                                      (music-
cause . mod)))))
./lilypond-export/api.scm:147:      ; search for music-cause of grob
./lilypond-export/api.scm:152:         ((ly:stream-event? grob) (grob-
cause (ly:event-property grob 'music-cause)))
./lilypond-export/api.scm:205:                (music (ly:event-property
event 'music-cause))
./lilypond-export/api.scm:468:               (music (ly:event-property
event 'music-cause))
./oll-misc/pitch/auto-
transpose/module.ily:79:               ;  (ly:make-stream-event 'key-
change-event `((music-cause . ,key-sig)) ))
./oll-misc/pitch/auto-transpose/module.ily:92:        (cond-transp
engraver (ly:event-property event 'music-cause)))
./oll-misc/pitch/auto-transpose/module.ily:95:        (cond-transp
engraver (ly:event-property event 'music-cause)))



Reply | Threaded
Open this post in threaded view
|

Re: music-cause

David Kastrup
In reply to this post by David Kastrup
David Kastrup <[hidden email]> writes:

> David Kastrup <[hidden email]> writes:
>
>> Graham Percival <[hidden email]> writes:
>>
>>> On Sun, Jan 22, 2012 at 11:49:06AM +0100, David Kastrup wrote:
>>>>
>>>> Anybody actually using the "music-cause"?  Inside of LilyPond, the only
>>>> appearance (apart from its declaration) would be
>>>>
>>>>   /*
>>>>     ES TODO: This is a temporary fix. Stream_events should not be
>>>>     aware of music.
>>>>   */
>>>>   e->set_property ("music-cause", self_scm ());
>>>
>>> If it's used anywhere, it would be here:
>>> http://lilypond.org/website/pdf/thesis-erik-sandberg
>>>
>>> It may have been added just so he could produce some graphs or
>>> tables or something?  I know that I have a ton of "graph-producing
>>> code" in Artifastring and Vivi like that.
>>
>> Seems somewhat pointless since events take the whole mutable property
>> list of their originating music event anyway.  If you need more for
>> tracking, you could just do
>>
>> maketrackable =
>> #(define-music-function (parser location m)
>>   (music-map
>>     (lambda (m)
>>        (set! ly:music-property 'music-cause m)
>>        m)
>>     m))
>>
>> and call that on your music before processing.
>
> I lean towards going through with my threat here and removing
> music-cause which seems like a weird punch-through kind of property.
> Any objections here?  Anybody actually using it anywhere?

Darn it.  I see that the edition engraver sets this somewhere, so
removing music-cause will possibly make the edition engraver bomb out.
Or do we check music properties (as a note aside: this is likely going
to happen with some change of mine that will eventually end up in
LilyPond, at the latest).  I should have gone through when I asked
first: bad ideas are certain to get picked up eventually.

So what now?

--
David Kastrup