Section Targets

Target utility functions.

Handle targets in a score.

See
Target

Summary

Return typeFunction and summary
TargetChooseTarget(Score score, string prompt, int selectedBar, string selectedName)
Select a Target (rehearsal mark) in the Score.
intDeleteAllTargets(Score score, boolean preserveScore)
Delete all targets (rehearsal marks) from a score.
 PlayFromBar(Score score, int barNumber, boolean showKaraoke, boolean scrollMusic, boolean followMusic, int metronomeBars)
Start playing music from specified bar.
booleanSortTargets(Score score)
Sort the targets (rehearsal marks) by bar number.
 TargetHideBarNumbers(Score score)
Hide bar numbers at bar that display a rehearsal mark, for all views.
 TargetSplitMultiRests(Score score)
Split multi-rests at all visible rehearsal marks, for all views.
intTargetVisibility(Score score, Target target, boolean visible)
Turn one or all targets visible or hidden.

Functions

PlayFromBar(Score score, int barNumber, boolean showKaraoke, boolean scrollMusic, boolean followMusic, int metronomeBars)

Start playing music from specified bar.

Target.PlayMusic() is bogus; here is a work-around.

ParameterTypeDefaultDescription
scoreScore The score to play
barNumberint The bar to start from, could be Target.Bar
showKaraokebooleanuser prefsDisplay karaoke if score has lyrics?
scrollMusicbooleanuser prefsScrolls the score while playing?
followMusicbooleanuser prefsOpen follow tune dialog?
metronomeBarsintuser prefsNumber of metronome bars to play before the music
Usage

PlayFromBar(FrontScore(), 2)

DeleteAllTargets(Score score, boolean preserveScore)

Delete all targets (rehearsal marks) from a score.

ParameterTypeDefaultDescription
scoreScore score
preserveScorebooleanfalsePreserve an undo?
Return
int: Number of deleted targets

SortTargets(Score score)

Sort the targets (rehearsal marks) 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 score
Return
boolean: false if no sort was needed, true if sort was done.
Usage

SortTargets(FrontScore())

ChooseTarget(Score score, string prompt, int selectedBar, string selectedName)

Select a Target (rehearsal mark) in the Score.

ParameterTypeDefaultDescription
scoreScore score
promptstring"Select a rehearsal mark"Title of the menu.
selectedBarint0Preselect target from the bar number selectedBar:
  • negative means no pre-selection,
  • nil or 0 means current cursor position (Score.TimeBeginSelection),
  • Positive number pre-selects the target where Target.Bar <= selectedBar.
selectedNamestringnilSelect the target which displayed name is selectedName. nil means no selection from the target displayed name.
Return
Target: Selected target or nil if user canceled the choice.

TargetVisibility(Score score, Target target, boolean visible)

Turn one or all targets visible or hidden.

The property for visibility Target.DisplayCaption is an inverted boolean. This function makes your code more comprehensible, and if inversion is fixed in a future version, you won't have to modify your code.
This doesn't regenerate captions nor refresh the score on screen.

ParameterTypeDefaultDescription
scoreScore score
targetTargetnilnil for all targets of score
visibleboolean visible
Return
int: Number of modified targets

TargetSplitMultiRests(Score score)

Split multi-rests at all visible rehearsal marks, for all views.

The property is set to the previous bar.

ParameterTypeDefaultDescription
scoreScore score

TargetHideBarNumbers(Score score)

Hide bar numbers at bar that display a rehearsal mark, for all views.

Common practice in orchestral score, rehearsal marks are framed big bar numbers, so no need to display regular bar numbers at these bars.

ParameterTypeDefaultDescription
scoreScore score