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

Method _writeNoteNode

packages/alphatab/src/exporter/GpifWriter.ts:177–276  ·  view source on GitHub ↗
(parent: XmlNode, note: Note)

Source from the content-addressed store, hash-verified

175 }
176
177 private _writeNoteNode(parent: XmlNode, note: Note) {
178 const noteNode = parent.addElement('Note');
179 noteNode.attributes.set('id', note.id.toString());
180
181 this._writeNoteProperties(noteNode, note);
182
183 if (note.isGhost) {
184 noteNode.addElement('AntiAccent').innerText = 'normal';
185 }
186
187 if (note.isLetRing) {
188 noteNode.addElement('LetRing');
189 }
190
191 if (note.isTrill) {
192 noteNode.addElement('Trill').innerText = note.trillValue.toString();
193 }
194
195 let accentFlags = 0;
196 if (note.isStaccato) {
197 accentFlags |= 1;
198 }
199 switch (note.accentuated) {
200 case AccentuationType.Normal:
201 accentFlags |= 0x08;
202 break;
203 case AccentuationType.Heavy:
204 accentFlags |= 0x04;
205 break;
206 case AccentuationType.Tenuto:
207 accentFlags |= 0x10;
208 break;
209 }
210
211 if (accentFlags > 0) {
212 noteNode.addElement('Accent').innerText = accentFlags.toString();
213 }
214
215 if (note.isTieOrigin || note.isTieDestination) {
216 const tie = noteNode.addElement('Tie');
217 tie.attributes.set('origin', note.isTieOrigin ? 'true' : 'false');
218 tie.attributes.set('destination', note.isTieDestination ? 'true' : 'false');
219 }
220
221 switch (note.vibrato) {
222 case VibratoType.Slight:
223 noteNode.addElement('Vibrato').innerText = 'Slight';
224 break;
225 case VibratoType.Wide:
226 noteNode.addElement('Vibrato').innerText = 'Wide';
227 break;
228 }
229
230 if (note.isFingering) {
231 switch (note.leftHandFinger) {
232 case Fingers.Thumb:
233 noteNode.addElement('LeftFingering').innerText = 'P';
234 break;

Callers 1

_writeDomMethod · 0.95

Calls 4

_writeNotePropertiesMethod · 0.95
addElementMethod · 0.80
setMethod · 0.45
toStringMethod · 0.45

Tested by

no test coverage detected