1
0
Fork 0
mirror of https://github.com/kastdeur/lilydrum.git synced 2024-12-22 17:23:32 +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

@ -63,18 +63,12 @@ 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)
"Return a music function that prepends @var{left} if the first next note-event is of type 'left-hand, "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}" else it will prepend @var{right}"
(define-music-function (parser location music) (ly:music? ) (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") #(if (string=? (symbol->string (ly:music-property note 'drum-type)) "left-hand")
#{ $left #} #{ $left #}
@ -98,6 +92,7 @@ optflamdr = #(autohandFunc optflamgdr optflamddr )
% Drag % Drag
drag = #(autohandFunc dragg dragd ) drag = #(autohandFunc dragg dragd )
dragdr = #(autohandFunc draggdr dragddr ) dragdr = #(autohandFunc draggdr dragddr )
% Open Drag % Open Drag
odrag = #(autohandFunc odragg odragd ) odrag = #(autohandFunc odragg odragd )
odragdr = #(autohandFunc odraggdr odragddr ) 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 = #(define-music-function (music) (ly:music?)
#{ #{
<>^"scoop"\startGroup <>^"scoop"\startGroup
#(allbutlastnote music) #(_allbutlastnote music)
<>\stopGroup <>\stopGroup
#(lastnote music) #(_lastnote music)
#}) #})
%---------------------------------------------------% %---------------------------------------------------%
% music function definitions % 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 #}) 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)) #}) 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 = tutti =
#(define-music-function (myMusic) (ly:music?) #(define-music-function (myMusic) (ly:music?)
(define (grace-music-filter event) (define (grace-music-filter event)

View file

@ -26,6 +26,8 @@
#(ly:set-option 'relative-includes #t) #(ly:set-option 'relative-includes #t)
\include "lib/internal_functions.ily"
\include "lib/layout_tweaks.ily" \include "lib/layout_tweaks.ily"
\include "lib/musical_functions.ily" \include "lib/musical_functions.ily"
\include "lib/embellishments.ily" \include "lib/embellishments.ily"