Section Tempo

Tempo utility functions

See
Dynamic

Summary

Return typeFunction and summary
 DeleteAllTargets(Score score, bool preserveScore)
Delete all targets from a score.
CollectionGetDynamicsThatApplyToStaff(Score score, Staff staff)
Get all Dynamic that apply to the specified staff.
number, int, DynamicGetTempoAtTime(Score score, int time)
Get tempo value and its Dynamic object (if applicable) at specified time of the score
boolSortTargets(Score score)
Sort the targets by bar number.

Functions

DeleteAllTargets(Score score, bool preserveScore)

Delete all targets from a score.

ParameterTypeDefaultDescription
scoreScore  
preserveScoreboolfalsePreserve an undo?

SortTargets(Score score)

Sort the targets by bar number.

Targets may be sorted by creation date in your score, if the last inserted is B between A and C, order is A, C, B. Thiis function sorts by deleting and recreating targets as A, B, C.

ParameterTypeDefaultDescription
scoreScore  
Return
bool: false if no sort was needed, true if sort was done.
Usage
SortTargets(FrontScore())

GetTempoAtTime(Score score, int time)

Get tempo value and its Dynamic object (if applicable) at specified time of the score

ParameterTypeDefaultDescription
scoreScore  
timeint Symbol.Time, Score.TimeBeginSelection
Returns
number: Tempo value (floatting point number)
int: Reference note length, DURATION_QUARTER for general tempo
Dynamic: nil if no tempo was added to the score, i.e. the returned value is general tempo
Error
if score is nil

GetDynamicsThatApplyToStaff(Score score, Staff staff)

Get all Dynamic that apply to the specified staff.

Dynamics are:

  • velocity changes (crescendo, descrendo, pppp to fff)
  • Tempo change
  • Pedal on/off
  • Ottava

ParameterTypeDefaultDescription
scoreScore  
staffStaff  
Return
Collection: of Dynamics that apply to staff are on attached to it, or one of merged staves with it, or one of the staves of the contain group, or to the whole score.
Error
if score or staff are nil
See
DYNAMIC_* constants in MSDefine
Dynamic.Type