MCPcopy Create free account
hub / github.com/CoderLine/alphaTab / addMasterBar

Method addMasterBar

packages/alphatab/src/model/Score.ts:356–374  ·  view source on GitHub ↗
(bar: MasterBar)

Source from the content-addressed store, hash-verified

354 }
355
356 public addMasterBar(bar: MasterBar): void {
357 bar.score = this;
358 bar.index = this.masterBars.length;
359 if (this.masterBars.length !== 0) {
360 bar.previousMasterBar = this.masterBars[this.masterBars.length - 1];
361 bar.previousMasterBar.nextMasterBar = bar;
362 // NOTE: this will not work on anacrusis. Correct anacrusis durations are only working
363 // when there are beats with playback positions already computed which requires full finish
364 // chicken-egg problem here. temporarily forcing anacrusis length here to 0,
365 // .finish() will correct these times
366 bar.start =
367 bar.previousMasterBar.start +
368 (bar.previousMasterBar.isAnacrusis ? 0 : bar.previousMasterBar.calculateDuration());
369 }
370
371 this._addMasterBarToRepeatGroups(bar);
372
373 this.masterBars.push(bar);
374 }
375
376 /**
377 * Adds the given bar correctly into the current repeat group setup.

Callers 13

buildScoreFunction · 0.95
insertNewMasterBarMethod · 0.45
_buildModelMethod · 0.45
readMasterBarMethod · 0.45
_addNewBarMethod · 0.45
_getOrCreateMasterBarMethod · 0.45
_barMetaMethod · 0.45
_getBarMethod · 0.45
setPropertyMethod · 0.45

Calls 3

calculateDurationMethod · 0.45
pushMethod · 0.45

Tested by 1

buildScoreFunction · 0.76