Skip to main content

alphaTab.model.Bar

A bar is a single block within a track, also known as Measure.

 class Bar

Properties​

barLineLeft​

The bar line to draw on the left side of the bar. Note that the combination with barLineRight of the previous bar matters. If this bar has a Regular/Automatic style but the previous bar is customized, no additional line is drawn by this bar. If both bars have a custom style, both bar styles are drawn.

barLineLeft: BarLineStyle;

barLineRight​

The bar line to draw on the right side of the bar. Note that the combination with barLineLeft of the next bar matters. If this bar has a Regular/Automatic style but the next bar is customized, no additional line is drawn by this bar. If both bars have a custom style, both bar styles are drawn.

barLineRight: BarLineStyle;

barNumberDisplay​

How bar numbers should be displayed. If specified, overrides the value from the stylesheet on score level.

barNumberDisplay?: BarNumberDisplay;

clef​

Gets or sets the clef on this bar.

clef: Clef;

clefOttava​

Gets or sets the ottava applied to the clef.

clefOttava: Ottavia;

displayScale​

A relative scale for the size of the bar when displayed. The scale is relative within a single line (system). The sum of all scales in one line make the total width, and then this individual scale gives the relative size.

displayScale: number;

displayWidth​

An absolute width of the bar to use when displaying in single track display scenarios.

displayWidth: number;

filledVoices​

Gets the number of voices which have content within this stuff.

readonly filledVoices: Set<number>;

hasChanges​

Whether this bar has any changes applied which are not related to the voices in it. (e.g. new key signatures)

readonly hasChanges: boolean;

id​

Gets or sets the unique id of this bar.

id: number;

index​

Gets or sets the zero-based index of this bar within the staff.

index: number;

isEmpty​

Whether this bar is fully empty (not even having rests).

readonly isEmpty: boolean;

isMultiVoice​

Gets a value indicating whether this bar contains multiple voices with notes.

readonly isMultiVoice: boolean;

isRestOnly​

Whether this bar is empty or has only rests.

readonly isRestOnly: boolean;

keySignature​

Gets or sets the key signature used on all bars.

keySignature: KeySignature;

keySignatureType​

Gets or sets the type of key signature (major/minor)

keySignatureType: KeySignatureType;

masterBar​

(no description)

readonly masterBar: MasterBar;

nextBar​

Gets or sets the next bar that comes after this bar.

nextBar: Bar | null;

previousBar​

Gets or sets the previous bar that comes before this bar.

previousBar: Bar | null;

simileMark​

Gets or sets the simile mark on this bar.

simileMark: SimileMark;

staff​

Gets or sets the reference to the parent staff.

staff: Staff;

style​

The style customizations for this item.

style?: BarStyle;

sustainPedals​

The sustain pedal markers within this bar.

sustainPedals: SustainPedalMarker[];

voices​

Gets or sets the list of voices contained in this bar.

voices: Voice[];

Methods​

addVoice​

(no description)

addVoice(voice: Voice): void
ParameterSummary
voiceAll

(no description)

calculateDuration​

(no description)

calculateDuration(): number

finish​

(no description)

finish(settings: Settings, sharedDataBag?: Map<string, unknown> | null): void
ParameterSummary
settingsAll

(no description)

sharedDataBagAll

(no description)

getActualBarLineLeft​

The bar line to draw on the left side of the bar with an "automatic" type resolved to the actual one.

getActualBarLineLeft(isFirstOfSystem: boolean): BarLineStyle
ParameterSummary
isFirstOfSystemAll

Whether the bar is the first one in the system.

getActualBarLineRight​

The bar line to draw on the right side of the bar with an "automatic" type resolved to the actual one.

getActualBarLineRight(): BarLineStyle