Section Targets
Target utility functions.
Handle targets in a score.
- See
- Target
Summary
Return type | Function and summary |
---|---|
Target | ChooseTarget(Score score, string prompt, int selectedBar, string selectedName) Select a Target (rehearsal mark) in the Score. |
int | DeleteAllTargets(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. | |
boolean | SortTargets(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. | |
int | TargetVisibility(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.
Parameter | Type | Default | Description |
---|---|---|---|
score | Score | The score to play | |
barNumber | int | The bar to start from, could be Target.Bar | |
showKaraoke | boolean | user prefs | Display karaoke if score has lyrics? |
scrollMusic | boolean | user prefs | Scrolls the score while playing? |
followMusic | boolean | user prefs | Open follow tune dialog? |
metronomeBars | int | user prefs | Number 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.
Parameter | Type | Default | Description |
---|---|---|---|
score | Score | score | |
preserveScore | boolean | false | Preserve 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.
Parameter | Type | Default | Description |
---|---|---|---|
score | Score | 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.
Parameter | Type | Default | Description |
---|---|---|---|
score | Score | score | |
prompt | string | "Select a rehearsal mark" | Title of the menu. |
selectedBar | int | 0 | Preselect target from the bar number selectedBar:
|
selectedName | string | nil | Select 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.
Parameter | Type | Default | Description |
---|---|---|---|
score | Score | score | |
target | Target | nil | nil for all targets of score |
visible | boolean | 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.
Parameter | Type | Default | Description |
---|---|---|---|
score | Score | 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.
Parameter | Type | Default | Description |
---|---|---|---|
score | Score | score |