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

Method _parseNote

packages/alphatab/src/importer/GpifParser.ts:2244–2354  ·  view source on GitHub ↗
(node: XmlNode)

Source from the content-addressed store, hash-verified

2242 }
2243
2244 private _parseNote(node: XmlNode): void {
2245 const note: Note = new Note();
2246 const noteId: string = node.getAttribute('id');
2247 for (const c of node.childElements()) {
2248 switch (c.localName) {
2249 case 'Properties':
2250 this._parseNoteProperties(c, note, noteId);
2251 break;
2252 case 'AntiAccent':
2253 if (c.innerText.toLowerCase() === 'normal') {
2254 note.isGhost = true;
2255 }
2256 break;
2257 case 'LetRing':
2258 note.isLetRing = true;
2259 break;
2260 case 'Trill':
2261 note.trillValue = GpifParser._parseIntSafe(c.innerText, -1);
2262 note.trillSpeed = Duration.Sixteenth;
2263 break;
2264 case 'Accent':
2265 const accentFlags: number = GpifParser._parseIntSafe(c.innerText, 0);
2266 if ((accentFlags & 0x01) !== 0) {
2267 note.isStaccato = true;
2268 }
2269 if ((accentFlags & 0x04) !== 0) {
2270 note.accentuated = AccentuationType.Heavy;
2271 }
2272 if ((accentFlags & 0x08) !== 0) {
2273 note.accentuated = AccentuationType.Normal;
2274 }
2275 if ((accentFlags & 0x10) !== 0) {
2276 note.accentuated = AccentuationType.Tenuto;
2277 }
2278 break;
2279 case 'Tie':
2280 if (c.getAttribute('destination').toLowerCase() === 'true') {
2281 note.isTieDestination = true;
2282 }
2283 break;
2284 case 'Vibrato':
2285 switch (c.innerText) {
2286 case 'Slight':
2287 note.vibrato = VibratoType.Slight;
2288 break;
2289 case 'Wide':
2290 note.vibrato = VibratoType.Wide;
2291 break;
2292 }
2293 break;
2294 case 'LeftFingering':
2295 switch (c.innerText) {
2296 case 'P':
2297 note.leftHandFinger = Fingers.Thumb;
2298 break;
2299 case 'I':
2300 note.leftHandFinger = Fingers.IndexFinger;
2301 break;

Callers 1

_parseNotesMethod · 0.95

Calls 5

_parseNotePropertiesMethod · 0.95
getAttributeMethod · 0.80
childElementsMethod · 0.80
_parseIntSafeMethod · 0.80
setMethod · 0.45

Tested by

no test coverage detected