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

Method _parseSound

packages/alphatab/src/importer/GpifParser.ts:1216–1244  ·  view source on GitHub ↗
(trackId: string, track: Track, node: XmlNode)

Source from the content-addressed store, hash-verified

1214 }
1215
1216 private _parseSound(trackId: string, track: Track, node: XmlNode): void {
1217 const sound = new GpifSound();
1218 for (const c of node.childElements()) {
1219 switch (c.localName) {
1220 case 'Name':
1221 sound.name = c.innerText;
1222 break;
1223 case 'Path':
1224 sound.path = c.innerText;
1225 break;
1226 case 'Role':
1227 sound.role = c.innerText;
1228 break;
1229 case 'MIDI':
1230 this._parseSoundMidi(sound, c);
1231 break;
1232 }
1233 }
1234
1235 if (!this._soundsByTrack.has(trackId)) {
1236 this._soundsByTrack.set(trackId, new Map<string, GpifSound>());
1237
1238 // apply first sound
1239 track.playbackInfo.program = sound.program;
1240 track.playbackInfo.bank = sound.bank;
1241 }
1242
1243 this._soundsByTrack.get(trackId)!.set(sound.uniqueId, sound);
1244 }
1245
1246 private _parseSoundMidi(sound: GpifSound, node: XmlNode): void {
1247 let bankMsb = 0;

Callers 1

_parseSoundsMethod · 0.95

Calls 5

_parseSoundMidiMethod · 0.95
childElementsMethod · 0.80
getMethod · 0.65
hasMethod · 0.45
setMethod · 0.45

Tested by

no test coverage detected