Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(242)

Delta Between Two Patch Sets: ly/music-functions-init.ly

Issue 7058068: Create a \tuplet function to complement \times and tupletSpannerDuration (Closed)
Left Patch Set: Created 12 years, 2 months ago
Right Patch Set: Fix comment problem Created 12 years, 2 months ago
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
Left: Side by side diff | Download
Right: Side by side diff | Download
« no previous file with change/comment | « input/regression/auto-beam-tuplets.ly ('k') | no next file » | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
1 %%%% -*- Mode: Scheme -*- 1 %%%% -*- Mode: Scheme -*-
2 2
3 %%%% This file is part of LilyPond, the GNU music typesetter. 3 %%%% This file is part of LilyPond, the GNU music typesetter.
4 %%%% 4 %%%%
5 %%%% Copyright (C) 2003--2012 Han-Wen Nienhuys <hanwen@xs4all.nl> 5 %%%% Copyright (C) 2003--2012 Han-Wen Nienhuys <hanwen@xs4all.nl>
6 %%%% Jan Nieuwenhuizen <janneke@gnu.org> 6 %%%% Jan Nieuwenhuizen <janneke@gnu.org>
7 %%%% 7 %%%%
8 %%%% LilyPond is free software: you can redistribute it and/or modify 8 %%%% LilyPond is free software: you can redistribute it and/or modify
9 %%%% it under the terms of the GNU General Public License as published by 9 %%%% it under the terms of the GNU General Public License as published by
10 %%%% the Free Software Foundation, either version 3 of the License, or 10 %%%% the Free Software Foundation, either version 3 of the License, or
(...skipping 1323 matching lines...) Expand 10 before | Expand all | Expand 10 after
1334 (make-property-set 'instrumentTransposition 1334 (make-property-set 'instrumentTransposition
1335 (ly:pitch-negate pitch)) 1335 (ly:pitch-negate pitch))
1336 'Staff)) 1336 'Staff))
1337 1337
1338 tuplet = 1338 tuplet =
1339 #(define-music-function (parser location ratio duration music) 1339 #(define-music-function (parser location ratio duration music)
1340 (fraction? (ly:duration?) ly:music?) 1340 (fraction? (ly:duration?) ly:music?)
1341 (_i "Scale the given @var{music} to tuplets. @var{ratio} is a 1341 (_i "Scale the given @var{music} to tuplets. @var{ratio} is a
1342 fraction that specifies how many notes are played in place of the 1342 fraction that specifies how many notes are played in place of the
1343 nominal value: it will be @samp{3/2} for triplets, namely three notes 1343 nominal value: it will be @samp{3/2} for triplets, namely three notes
1344 being played in place of two. If the optional @var{duration} is 1344 being played in place of two. If the optional @var{duration} is
Ian Hulin (gmail) 2013/01/11 18:28:35 If the optional @var{duration} parameter is specif
1345 specified, it is used for initializing @code{tupletSpannerDuration}. 1345 specified, it is used for initializing @code{tupletSpannerDuration}.
1346 For example, 1346 For example,
1347 @example 1347 @example
1348 \tuplet 3/2 4 { c8 c c c c c } 1348 \tuplet 3/2 4 @{ c8 c c c c c @}
1349 @end example 1349 @end example
1350 will result in two groups of three tuplets, each group lasting for a 1350 will result in two groups of three tuplets, each group lasting for a
1351 quarter note. The value of @code{tupletSpannerDuration} is retained 1351 quarter note. The value of @code{tupletSpannerDuration} is retained
Ian Hulin (gmail) 2013/01/11 18:28:35 Cut out these sentences "The value of @code{tuplet
1352 as default if it is set in this manner. Clearing it can be achieved 1352 as default if it is set in this manner. Clearing it can be achieved
1353 by specifying @samp{1*0} as @var{duration}.") 1353 by specifying @samp{1*0} as @var{duration}.")
1354 (let ((scaled 1354 (let ((scaled
1355 (make-music 'TimeScaledMusic 1355 (make-music 'TimeScaledMusic
1356 'element (ly:music-compress 1356 'element (ly:music-compress
1357 music 1357 music
1358 (ly:make-moment (cdr ratio) (car ratio))) 1358 (ly:make-moment (cdr ratio) (car ratio)))
1359 'numerator (cdr ratio) 1359 'numerator (cdr ratio)
1360 'denominator (car ratio))) 1360 'denominator (car ratio)))
1361 (len (and duration (ly:duration-length duration)))) 1361 (len (and duration (ly:duration-length duration))))
1362 (if duration 1362 (if duration
1363 (if (zero? (ly:moment-main len)) 1363 (if (zero? (ly:moment-main len))
1364 #{ \unset tupletSpannerDuration 1364 #{ \unset tupletSpannerDuration
1365 #scaled 1365 #scaled
1366 #} 1366 #}
1367 #{ 1367 #{
1368 \set tupletSpannerDuration = #len 1368 \set tupletSpannerDuration = #len
1369 #scaled 1369 #scaled
1370 #}) 1370 #})
1371 scaled))) 1371 scaled)))
1372 1372
Ian Hulin (gmail) 2013/01/11 18:28:35 Get rid of code doing things to tupletSpannerDurat
1373 tweak = 1373 tweak =
1374 #(define-music-function (parser location prop value item) 1374 #(define-music-function (parser location prop value item)
1375 (symbol-list-or-symbol? scheme? symbol-list-or-music?) 1375 (symbol-list-or-symbol? scheme? symbol-list-or-music?)
1376 (_i "Add a tweak to the following @var{item}, usually music. 1376 (_i "Add a tweak to the following @var{item}, usually music.
1377 Layout objects created by @var{item} get their property @var{prop} 1377 Layout objects created by @var{item} get their property @var{prop}
1378 set to @var{value}. If @var{prop} has the form @samp{Grob.property}, like with 1378 set to @var{value}. If @var{prop} has the form @samp{Grob.property}, like with
1379 @example 1379 @example
1380 \\tweak Accidental.color #red cis' 1380 \\tweak Accidental.color #red cis'
1381 @end example 1381 @end example
1382 an indirectly created grob (@samp{Accidental} is caused by 1382 an indirectly created grob (@samp{Accidental} is caused by
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
1481 Use this if you want to have a scheme expression evaluated 1481 Use this if you want to have a scheme expression evaluated
1482 because of its side-effects, but its value ignored.")) 1482 because of its side-effects, but its value ignored."))
1483 1483
1484 withMusicProperty = 1484 withMusicProperty =
1485 #(define-music-function (parser location sym val music) 1485 #(define-music-function (parser location sym val music)
1486 (symbol? scheme? ly:music?) 1486 (symbol? scheme? ly:music?)
1487 (_i "Set @var{sym} to @var{val} in @var{music}.") 1487 (_i "Set @var{sym} to @var{val} in @var{music}.")
1488 1488
1489 (set! (ly:music-property music sym) val) 1489 (set! (ly:music-property music sym) val)
1490 music) 1490 music)
LEFTRIGHT

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b