Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(5)

Issue 152600043: Additions in event-listener.ly

Can't Edit
Can't Publish+Mail
Start Review
Created:
2 years, 8 months ago by pkx166h
Modified:
3 months ago
CC:
lilypond-devel_gnu.org, phil Hezaine
Visibility:
Public.

Description

Issue 4164 Additions in event-listener.ly Changes applied to DrumVoice, drum-type... Patch provided by Phil Hezaine

Patch Set 1 #

Total comments: 5

Patch Set 2 : Rebased to current master - comment by VV not yet addressed #

Unified diffs Side-by-side diffs Delta from patch set Stats (+36 lines, -1 line) Patch
M ly/event-listener.ly View 1 3 chunks +36 lines, -1 line 0 comments Download

Messages

Total messages: 7
Valentin Villenave
Greetings Philippe and James, this looks good overall, I just have one minor comment. https://codereview.appspot.com/152600043/diff/1/ly/event-listener.ly ...
2 years, 8 months ago (2014-10-17 06:40:24 UTC) #1
pkx166h
Rebased to current master - comment by VV not yet addressed
3 months, 1 week ago (2017-03-19 12:32:36 UTC) #2
pkx166h
On 2014/10/17 06:40:24, Valentin Villenave wrote: > Greetings Philippe and James, > this looks good ...
3 months, 1 week ago (2017-03-22 07:02:43 UTC) #3
dak
https://codereview.appspot.com/152600043/diff/1/ly/event-listener.ly File ly/event-listener.ly (right): https://codereview.appspot.com/152600043/diff/1/ly/event-listener.ly#newcode69 ly/event-listener.ly:69: (eq? 0 (ly:moment-grace-numerator moment)) Why this change for the ...
3 months, 1 week ago (2017-03-22 10:24:21 UTC) #4
Graham Percival
On 2017/03/22 10:24:21, dak wrote: > ly/event-listener.ly:69: (eq? 0 (ly:moment-grace-numerator moment)) > Why this change ...
3 months, 1 week ago (2017-03-23 00:55:21 UTC) #5
pkx166h
Thanks to David (and Graham). I understand David's comments but don't have the knowledge (or ...
3 months ago (2017-03-25 10:34:02 UTC) #6
thomasmorley651
3 months ago (2017-03-25 22:31:36 UTC) #7
On 2017/03/25 10:34:02, pkx166h wrote:
> Thanks to David (and Graham).
> 
> I understand David's comments but don't have the knowledge (or the time) to
make
> the edits that are suggested here - at least from as I understand it there
would
> need to be some kind of 'check/test' (if/then) construction in format-note to
> decide if it was \Voice or \DrumVoice.
> 
> At least that is my reading of the comments.
> 
> Oh well, it didn't hurt to try to resurrect someone's old patch. I'll have to
> set this back to patch-abandoned then.
> 
> Thank you again all the same.

Hi James,

sorry for the late reply.
Maybe below will do the trick (diff is against master):


diff --git a/ly/event-listener.ly b/ly/event-listener.ly
index 4627aaa..a062472 100644
--- a/ly/event-listener.ly
+++ b/ly/event-listener.ly
@@ -122,12 +122,18 @@ as an engraver for convenience."
 
 #(define (format-note engraver event)
    (let* ((origin (ly:input-file-line-char-column
-                   (ly:event-property event 'origin))))
+                   (ly:event-property event 'origin)))
+          (drum-type (ly:event-property event 'drum-type))
+          (pitch (ly:event-property event 'pitch)))
      (print-line engraver
-                 "note"
-                 ;; get a MIDI pitch value.
-                 (+ 60 (ly:pitch-semitones
-                        (ly:event-property event 'pitch)))
+                 (if (ly:pitch? pitch)
+                     "note"
+                     "type")
+                 (if (ly:pitch? pitch)
+                     ;; get a MIDI pitch value.
+                     (+ 60 (ly:pitch-semitones
+                            (ly:event-property event 'pitch)))
+                     drum-type)
                  (ly:duration->string
                   (ly:event-property event 'duration))
                  (format-moment (ly:duration-length
@@ -206,23 +212,30 @@ as an engraver for convenience."
 %%%% are notified about all notes and rests. We don't create any grobs or
 %%%% change any settings.
 
+#(define event-listener-engraver
+  (make-engraver
+    (listeners
+     (tempo-change-event . format-tempo)
+     (rest-event . format-rest)
+     (note-event . format-note) ;; works for
+     (articulation-event . format-articulation)
+     (text-script-event . format-text)
+     (slur-event . format-slur)
+     (breathing-event . format-breathe)
+     (dynamic-event . format-dynamic)
+     (crescendo-event . format-cresc)
+     (decrescendo-event . format-decresc)
+     (text-span-event . format-textspan)
+     (glissando-event . format-glissando)
+     (tie-event . format-tie))))
+
 \layout {
   \context {
-  \Voice
-  \consists #(make-engraver
-              (listeners
-               (tempo-change-event . format-tempo)
-               (rest-event . format-rest)
-               (note-event . format-note)
-               (articulation-event . format-articulation)
-               (text-script-event . format-text)
-               (slur-event . format-slur)
-               (breathing-event . format-breathe)
-               (dynamic-event . format-dynamic)
-               (crescendo-event . format-cresc)
-               (decrescendo-event . format-decresc)
-               (text-span-event . format-textspan)
-               (glissando-event . format-glissando)
-               (tie-event . format-tie)))
+    \Voice
+    \consists #event-listener-engraver
+  }
+  \context {
+    \DrumVoice
+    \consists #event-listener-engraver
   }
 }
Sign in to reply to this message.

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld 80a51fa-tainted