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โ€‹

Deprecated

Use scoreDisplay , tabDisplay , slashDisplay , or numberedDisplay .barNumber for per-staff-type per-bar control. The setter broadcasts the value to all four override bags (lazy-creating each); on undefined it clears .barNumber on each existing bag without removing it.

How bar numbers should be displayed on this specific bar.

barNumberDisplay: BarNumberDisplay | undefined;

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;

numberedDisplayโ€‹

Per-bar override for the numbered (jianpu) staff's display.

numberedDisplay?: NumberedBarOverride;

previousBarโ€‹

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

previousBar: Bar | null;

scoreDisplayโ€‹

Per-bar override for the standard-notation staff's display.

scoreDisplay?: ScoreBarOverride;

simileMarkโ€‹

Gets or sets the simile mark on this bar.

simileMark: SimileMark;

slashDisplayโ€‹

Per-bar override for the slash staff's display.

slashDisplay?: SlashBarOverride;

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[];

tabDisplayโ€‹

Per-bar override for the tablature staff's display.

tabDisplay?: TabBarOverride;

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