lilypond-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Making two functions into one


From: | || | |
Subject: Making two functions into one
Date: Mon, 16 Jan 2023 15:12:15 +0100
User-agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.6.1

Hi,

I would like to make a function which will be responsible for two things:

1. Change time signature

2. Fill empty bar with 's8'

I made this one, but there is a problem with point'n'click function, so I can't click on time signature to go to correspondent place in code:

\version "2.24.0"

nd =  #(define-music-function (number) (integer?)
           (make-music
  'SequentialMusic
  'elements
  (list (make-music
          'SequentialMusic
          'elements
          (list (make-music
                  'TimeSignatureMusic
                  'numerator
                  number
                  'denominator
                  8
                  'beat-structure
                  '())))
        (make-music
          'UnfoldedRepeatedMusic
          'elements
          '()
          'repeat-count
          number
          'element
          (make-music
            'SequentialMusic
            'elements
            (list (make-music
                    'SkipEvent
                    'duration
                    (ly:make-duration 3)))))))
                      )

\score {
  \new Staff {

    \nd 8
    \nd 7
  }
}


So I thought about delete one nested (list) and try it:

nd =  #(define-music-function (number) (integer?)
          (make-music
          'TimeSignatureMusic
          'numerator
          8
          'denominator
          8
          'beat-structure
          '())
        (make-music
          'UnfoldedRepeatedMusic
          'elements
          '()
          'repeat-count
          8
          'element
          (make-music
            'SequentialMusic
            'elements
            (list (make-music
                    'SkipEvent
                    'duration
                    (ly:make-duration 3))))))


But the problem is, when I don't use (list) for two adjacent (make-music) functions, one of them doesn't run, so depending on the kind of second (make-music) code, one od them goes, another don't.

Honestly, I don't understand why it's like that, because when I run displayScheme{}, it display it properly without (list) and SquentialMusic for this two events. I suspect it could be something wrong with my definition.


Thank you :)




reply via email to

[Prev in Thread] Current Thread [Next in Thread]