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

Method insertNewBar

packages/playground/src/apps/RecorderApp.ts:245–264  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

243 }
244
245 private insertNewBar(): alphaTab.model.Bar {
246 const previousBar = this.staff.bars.length > 0 ? this.staff.bars[this.staff.bars.length - 1] : null;
247 const bar = new alphaTab.model.Bar();
248 if (previousBar) {
249 bar.clef = previousBar.clef;
250 bar.clefOttava = previousBar.clefOttava;
251 bar.keySignature = previousBar.keySignature;
252 bar.keySignatureType = previousBar.keySignatureType;
253 }
254 this.staff.addBar(bar);
255 const voice = new alphaTab.model.Voice();
256 bar.addVoice(voice);
257
258 const beats = this.createEmptyBeatsForBar();
259 for (let i = 0; i < beats.length; i++) {
260 voice.addBeat(beats[i]);
261 this.api.tickCache?.addBeat(beats[i], i * this.slotTicks, this.slotTicks);
262 }
263 return bar;
264 }
265
266 private insertNewSystem(): void {
267 this.insertTickThreshold = -1;

Callers 1

insertNewSystemMethod · 0.95

Calls 4

addVoiceMethod · 0.95
addBeatMethod · 0.95
addBarMethod · 0.45

Tested by

no test coverage detected