mirror of
https://github.com/kastdeur/lilydrum.git
synced 2024-12-22 17:23:32 +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 %%
|
%% 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 (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")
|
#(if (string=? (symbol->string (ly:music-property note 'drum-type)) "left-hand")
|
||||||
#{ $left #}
|
#{ $left #}
|
||||||
#{ $right #})
|
#{ $right #})
|
||||||
|
|
||||||
% print the note, else it won't show up
|
% print the note, else it won't show up
|
||||||
#note
|
#music
|
||||||
#}
|
#}
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
)
|
||||||
% Flam
|
% Flam
|
||||||
flam = #(autohandFunc flamg flamd)
|
flam = #(autohandFunc flamg flamd)
|
||||||
flamdr = #(autohandFunc flamgdr flamddr )
|
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 #})
|
ofr = #(define-event-function (parser location) () #{ -\tag #'tutti \stopGroup #})
|
||||||
|
|
||||||
#(define (allbutlastnote mus)
|
#(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)))
|
(let ((elts (ly:music-property mus 'elements)))
|
||||||
(make-music 'SequentialMusic 'elements (reverse (cdr (reverse elts))))
|
(make-music 'SequentialMusic 'elements (reverse (cdr (reverse elts))))
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
#(define (lastnote mus)
|
#(define (lastnote mus)
|
||||||
|
"Get the last element, make it a list, put it in a SequentialMusic"
|
||||||
(let ((elts (ly:music-property mus 'elements)))
|
(let ((elts (ly:music-property mus 'elements)))
|
||||||
(make-music 'SequentialMusic 'elements (list (last elts)))
|
(make-music 'SequentialMusic 'elements (list (last elts)))
|
||||||
)
|
)
|
||||||
|
|
Loading…
Reference in a new issue