1
0
Fork 0
mirror of https://github.com/kastdeur/lilydrum.git synced 2024-12-22 09:13:33 +01:00

Move internal functions into separate file for deprecation

This commit is contained in:
Eric Teunis de Boone 2023-08-08 22:13:12 +02:00
parent 04633ac833
commit 50da682fb6
5 changed files with 37 additions and 25 deletions

View file

@ -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 )

View file

@ -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

View file

@ -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)))
)
)

View file

@ -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)

View file

@ -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"