diff --git a/lib/embellishments.ily b/lib/embellishments.ily index 18c6651..ea94cbe 100644 --- a/lib/embellishments.ily +++ b/lib/embellishments.ily @@ -42,10 +42,10 @@ dragddr = \drummode { \drumgrace { g16[\dr g] } } % Drag right with start repea draggdr = \drummode { \drumgrace { d16[\dr d] } } % Drag left with start repeat % Open Drags -odragd = \drummode { \drumgrace { << { g16[ g] } { s16 s32^\markup { \musicglyph #"scripts.open" } } >> } } % Open Drag right -odragg = \drummode { \drumgrace { << { d16[ d] } { s16 s32^\markup { \musicglyph #"scripts.open" } } >> } } % Open Drag left -odragddr = \drummode { \drumgrace { << { d16[\dr d] } { s16 s32^\markup { \musicglyph #"scripts.open" } } >> } } % Open Drag right with start repeat -odraggdr = \drummode { \drumgrace { << { g16[\dr g] } { s16 s32^\markup { \musicglyph #"scripts.open" } } >> } } % Open Drag left with start repeat +odragd = \drummode { \drumgrace { << { g16[ g] } { s16 s32^\markup { \musicglyph #"scripts.open" } } >> } } % Open Drag right +odragg = \drummode { \drumgrace { << { d16[ d] } { s16 s32^\markup { \musicglyph #"scripts.open" } } >> } } % Open Drag left +odragddr = \drummode { \drumgrace { << { d16[\dr d] } { s16 s32^\markup { \musicglyph #"scripts.open" } } >> } } % Open Drag right with start repeat +odraggdr = \drummode { \drumgrace { << { g16[\dr g] } { s16 s32^\markup { \musicglyph #"scripts.open" } } >> } } % Open Drag left with start repeat % Ruff ruffg = \drummode { \drumgrace { d16[ g d] } } % Ruff right @@ -63,18 +63,12 @@ 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) "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))) + (let ((note (_get-first-note music))) #{ #(if (string=? (symbol->string (ly:music-property note 'drum-type)) "left-hand") #{ $left #} @@ -98,6 +92,7 @@ optflamdr = #(autohandFunc optflamgdr optflamddr ) % Drag drag = #(autohandFunc dragg dragd ) dragdr = #(autohandFunc draggdr dragddr ) + % Open Drag odrag = #(autohandFunc odragg odragd ) odragdr = #(autohandFunc odraggdr odragddr ) diff --git a/lib/flourishing.ily b/lib/flourishing.ily index 60038cb..424984d 100644 --- a/lib/flourishing.ily +++ b/lib/flourishing.ily @@ -338,9 +338,9 @@ flourish = #(define-music-function (parser location notes) (ly:music?) scoop = #(define-music-function (music) (ly:music?) #{ <>^"scoop"\startGroup - #(allbutlastnote music) + #(_allbutlastnote music) <>\stopGroup - #(lastnote music) + #(_lastnote music) #}) %---------------------------------------------------% % music function definitions diff --git a/lib/internal_functions.ily b/lib/internal_functions.ily new file mode 100644 index 0000000..e885610 --- /dev/null +++ b/lib/internal_functions.ily @@ -0,0 +1,27 @@ +% ================================================= % +% Internal Functions % +% as used by other files in this library % +% ================================================= % +% Part of lilydrum + +#(define ( _get-first-note mus) + "Get the first note-event in @var{music}" + (let ((note (car (extract-typed-music mus 'note-event)))) + note + ) +) + +#(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))) + ) +) + diff --git a/lib/musical_functions.ily b/lib/musical_functions.ily index 889c378..787eedb 100644 --- a/lib/musical_functions.ily +++ b/lib/musical_functions.ily @@ -91,18 +91,6 @@ odr = #(define-event-function (parser location) () #{ -\tag #'tutti \startGroup ofr = #(define-event-function (parser location) () #{ -\tag #'tutti \stopGroup #}) rn = #(define-event-function (parser location) () #{ -\tag #'tutti ^\markup \path #0.1 #'((moveto 0 0)(rlineto 0 1)(rlineto 4 0)(rlineto 0 -1)) #}) -#(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))) - ) -) tutti = #(define-music-function (myMusic) (ly:music?) (define (grace-music-filter event) diff --git a/lilydrum.ly b/lilydrum.ly index 25f12ff..1587eae 100644 --- a/lilydrum.ly +++ b/lilydrum.ly @@ -26,6 +26,8 @@ #(ly:set-option 'relative-includes #t) +\include "lib/internal_functions.ily" + \include "lib/layout_tweaks.ily" \include "lib/musical_functions.ily" \include "lib/embellishments.ily"