import { TheoryNote } from "../core/note/TheoryNote"; import { TheoryParse } from "../core/parse/TheoryParse"; import { TheoryMeasure } from "../core/measure/TheoryMeasure"; import { TheoryBeats } from "../core/beats/TheoryBeats"; import { TheoryData } from "../core/data/TheoryData"; /** * @class YYM 给 IOS 暴露的的接口类 */ export class TheoryLibrary { private _bpm: number; private _note: TheoryNote; private _parse: TheoryParse; private _measure: TheoryMeasure; private _beats: TheoryBeats; public constructor(xmlDom_: Document, bpm_: string) { this._bpm = parseInt(bpm_, 10); this._parse = new TheoryParse(xmlDom_); const xmlNoteList = this._parse.getXMLNoteList(); this._beats = new TheoryBeats(this._parse, this._bpm); this._measure = new TheoryMeasure(this._parse); this._note = new TheoryNote(xmlNoteList, this._measure, this._beats); } public getNotesJson() { let result = TheoryData.getInstance(this._note, this._beats).getFinalJsonData(); return result; } public getBeatsJson() { let beats = TheoryData.getInstance(this._note, this._beats).getFinalBeatsData(); return beats; } }