%% Generated by lilypond-book
%% Options: [exampleindent=10.16\mm,indent=0\mm,line-width=160\mm,paper-height=845.047\pt,paper-width=597.508\pt,papersize='(cons (* 597.508 pt) (* 845.047 pt))]
\include "lilypond-book-preamble.ly"


% ****************************************************************
% Start cut-&-pastable-section
% ****************************************************************

#(ly:set-option 'eps-box-padding 3.000000)



\paper {
  #(set-paper-size '(cons (* 597.508 pt) (* 845.047 pt)))
  indent = 0\mm
  line-width = 160\mm
  % offset the left padding, also add 1mm as lilypond creates cropped
  % images with a little space on the right
  line-width = #(- line-width (* mm  3.000000) (* mm 1))
}

\layout {
  
}




% ****************************************************************
% ly snippet:
% ****************************************************************
\sourcefilename "/lilypond-2.27.0/input/regression/auto-beam-beambreak.ly"
\sourcefileline 0
\version "2.27.0"

\header {
  texidoc = "Autobeaming can be adjusted using @code{\\beamBreak} and
@code{\\noBeamBreak}."
}

#(define (invert-predicate pred?)
   (lambda (arg . rest)
     (not (apply pred? (cons arg rest)))))

#(define (remove-typed-music mus types)
   (music-filter (invert-predicate (music-type-predicate types))
                 (ly:music-deep-copy mus)))

#(define (remove-beam-control mus)
   (remove-typed-music mus '(beam-break-event beam-event beam-forbid-event)))

"\\|" = \beamBreak
"\\_" = \noBeamBreak

\parallelMusic beamBreaks,manualBeams {
  %% split beam groups
  8  8 \| 8  8  8  8 8\| 8  |
  8[ 8]   8[ 8] 8[ 8 8]  8] |

  %% connect two beam groups
  8 8 8 8 \_ 8 8 8 8   |
  8[ 8 8 8   8 8 8 8 ] |

  %% manual beaming by [ ] and \noBeam always takes precedence
  8 8[ 8 8\| 8 8] 8 \_ 8\noBeam |
  8 8[ 8 8   8 8] 8 8\noBeam    |

  %% split off individual notes
  8 \|     8 8 8 8 \| 8 \|      8 8 |
  8\noBeam 8 8 8 8    8 \noBeam 8 8 |

  %% connect beams over breathing signs
  8  8 \_ \breathe 8 8  8  8 \breathe \_ 8 8  |
  8[ 8 \breathe    8 8] 8[ 8 \breathe    8 8] |

  %% connect beams over bar lines
  8 8 8 8 8  8 8 8 \_ |
  8 8 8 8 8[ 8 8 8    |
  %
  8 8 8 8  8 8 8 8    |
  8 8 8 8] 8 8 8 8    |

  %% \noBeamBreak also creates new beams
  \time 3/8 4 8\_ 8 4 |
  \time 3/8 4 8[ 8] 4 |
}

#(assert
  (equal? ((@@ (lily) music->lily-string)
           (remove-beam-control beamBreaks))
          ((@@ (lily) music->lily-string)
           (remove-beam-control manualBeams)))
  "\\beamBreaks and \\manualBeams should agree in substance.")

\new RhythmicStaff
<<
  {
    <>-"Effect of \\beamBreak and \\noBeamBreak"
    \beamBreaks
  }
  \\
  {
    <>-"Desired result"
    \manualBeams
  }
>>



% ****************************************************************
% end ly snippet
% ****************************************************************
