(xml: string, settings: Settings)
| 144 | public loadAsset?: (fileName: string) => Uint8Array | undefined; |
| 145 | |
| 146 | public parseXml(xml: string, settings: Settings): void { |
| 147 | this._masterTrackAutomations = new Map<number, Automation[]>(); |
| 148 | this._automationsPerTrackIdAndBarIndex = new Map<string, Map<number, Automation[]>>(); |
| 149 | this._sustainPedalsPerTrackIdAndBarIndex = new Map<string, Map<number, SustainPedalMarker[]>>(); |
| 150 | this._tracksMapping = []; |
| 151 | this._tracksById = new Map<string, Track>(); |
| 152 | this._masterBars = []; |
| 153 | this._barsOfMasterBar = []; |
| 154 | this._voicesOfBar = new Map<string, string[]>(); |
| 155 | this._barsById = new Map<string, Bar>(); |
| 156 | this._voiceById = new Map<string, Voice>(); |
| 157 | this._beatsOfVoice = new Map<string, string[]>(); |
| 158 | this._beatById = new Map<string, Beat>(); |
| 159 | this._rhythmOfBeat = new Map<string, string>(); |
| 160 | this._rhythmById = new Map<string, GpifRhythm>(); |
| 161 | this._notesOfBeat = new Map<string, string[]>(); |
| 162 | this._noteById = new Map<string, Note>(); |
| 163 | this._tappedNotes = new Map<string, boolean>(); |
| 164 | this._lyricsByTrack = new Map<string, Lyrics[]>(); |
| 165 | this._soundsByTrack = new Map<string, Map<string, GpifSound>>(); |
| 166 | this._skipApplyLyrics = false; |
| 167 | |
| 168 | const dom: XmlDocument = new XmlDocument(); |
| 169 | try { |
| 170 | dom.parse(xml); |
| 171 | } catch (e) { |
| 172 | throw new UnsupportedFormatError('Could not parse XML', e as Error); |
| 173 | } |
| 174 | |
| 175 | this._parseDom(dom); |
| 176 | this._buildModel(); |
| 177 | ModelUtils.consolidate(this.score); |
| 178 | this.score.finish(settings); |
| 179 | if (!this._skipApplyLyrics && this._lyricsByTrack.size > 0) { |
| 180 | for (const [t, lyrics] of this._lyricsByTrack) { |
| 181 | const track: Track = this._tracksById.get(t)!; |
| 182 | track.applyLyrics(lyrics); |
| 183 | } |
| 184 | } |
| 185 | } |
| 186 | |
| 187 | private _parseDom(dom: XmlDocument): void { |
| 188 | const root: XmlNode | null = dom.firstElement; |
no test coverage detected