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

Method _calculateDuration

packages/alphatab/src/model/Beat.ts:844–861  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

842 }
843
844 private _calculateDuration(): number {
845 if (this.overrideDisplayDuration !== undefined) {
846 return this.overrideDisplayDuration!;
847 }
848 if (this.isFullBarRest) {
849 return this.voice.bar.masterBar.calculateDuration();
850 }
851 let ticks: number = MidiUtils.toTicks(this.duration);
852 if (this.dots === 2) {
853 ticks = MidiUtils.applyDot(ticks, true);
854 } else if (this.dots === 1) {
855 ticks = MidiUtils.applyDot(ticks, false);
856 }
857 if (this.tupletDenominator > 0 && this.tupletNumerator >= 0) {
858 ticks = MidiUtils.applyTuplet(ticks, this.tupletNumerator, this.tupletDenominator);
859 }
860 return ticks;
861 }
862
863 public updateDurations(): void {
864 const ticks: number = this._calculateDuration();

Callers 1

updateDurationsMethod · 0.95

Calls 4

toTicksMethod · 0.80
applyDotMethod · 0.80
applyTupletMethod · 0.80
calculateDurationMethod · 0.45

Tested by

no test coverage detected