mirror of
https://github.com/kastdeur/lilydrum.git
synced 2024-12-22 09:13:33 +01:00
Closes #5
The Autohand works on the first note-event it can find Included DocString for embellishments.ily
This commit is contained in:
parent
ee97c53178
commit
ca6e9110e8
2 changed files with 23 additions and 11 deletions
|
@ -53,19 +53,29 @@ sruffddr = \drummode { \drumgrace { d16[\dr g g] } } % Swiss Ruff left with sta
|
|||
%% Embellishment functions, automatic left or right %%
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
|
||||
get-first-note = #(define-music-function (music) (ly:music?)
|
||||
"Get the first note-event in @var{music}"
|
||||
(let ((note(car (extract-typed-music music 'note-event))))
|
||||
note
|
||||
)
|
||||
)
|
||||
|
||||
#(define (autohandFunc left right)
|
||||
(define-music-function (parser location note) (ly:music? )
|
||||
"Return a music function that prepends @var{left} if the first next note-event is of type 'left-hand,
|
||||
else it will prepend @var{right}"
|
||||
(define-music-function (parser location music) (ly:music? )
|
||||
(let ((note (get-first-note music)))
|
||||
#{
|
||||
#(if (string=? (symbol->string (ly:music-property note 'drum-type)) "left-hand")
|
||||
#{ $left #}
|
||||
#{ $right #})
|
||||
|
||||
% print the note, else it won't show up
|
||||
#note
|
||||
#music
|
||||
#}
|
||||
)
|
||||
)
|
||||
|
||||
)
|
||||
% Flam
|
||||
flam = #(autohandFunc flamg flamd)
|
||||
flamdr = #(autohandFunc flamgdr flamddr )
|
||||
|
|
|
@ -89,11 +89,13 @@ odr = #(define-event-function (parser location) () #{ -\tag #'tutti \startGroup
|
|||
ofr = #(define-event-function (parser location) () #{ -\tag #'tutti \stopGroup #})
|
||||
|
||||
#(define (allbutlastnote mus)
|
||||
"Reverse the elements, Pop of (cdr) the first element, Reverse again, put it in a SequentialMusic"
|
||||
(let ((elts (ly:music-property mus 'elements)))
|
||||
(make-music 'SequentialMusic 'elements (reverse (cdr (reverse elts))))
|
||||
)
|
||||
)
|
||||
#(define (lastnote mus)
|
||||
"Get the last element, make it a list, put it in a SequentialMusic"
|
||||
(let ((elts (ly:music-property mus 'elements)))
|
||||
(make-music 'SequentialMusic 'elements (list (last elts)))
|
||||
)
|
||||
|
|
Loading…
Reference in a new issue