UNPKG

vgm-conv

Version:
33 lines (32 loc) 1.04 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.OPLToOPL2Converter = void 0; const vgm_converter_1 = require("./vgm-converter"); const vgm_parser_1 = require("vgm-parser"); function type2cmd(type) { switch (type) { case "ymf262": return 0x5e; case "ym3812": default: return 0x5a; } } class OPLToOPL2Converter extends vgm_converter_1.VGMConverter { _type; _target; constructor(from, to, opts) { super(from, { chip: to.chip, index: from.index, clock: to.chip === "ymf262" ? 4 : 1, relativeClock: true }); this._type = to.chip; this._target = type2cmd(this._type); } convertCommand(cmd) { if (cmd instanceof vgm_parser_1.VGMWriteDataCommand && (cmd.chip === "ym3526" || cmd.chip === "y8950") && cmd.index === this.from.index) { return [cmd.copy({ target: this._target })]; } return [cmd]; } } exports.OPLToOPL2Converter = OPLToOPL2Converter;