1
0
mirror of synced 2024-11-24 06:30:11 +01:00

fix acb_mix

This commit is contained in:
kohos 2020-08-22 23:30:42 +08:00
parent abb4cd24cb
commit 1cc605012d

View File

@ -111,7 +111,17 @@ async function mixAcb(acbPath, key, wavDir, mode, skip) {
for (let i = 0; i < acb.CueTable.length; i++) { for (let i = 0; i < acb.CueTable.length; i++) {
const Cue = acb.CueTable[i]; const Cue = acb.CueTable[i];
let samplingRate = 0, channelCount = 0; let samplingRate = 0, channelCount = 0;
if (Cue.ReferenceType !== 3) debugger; if (Cue.ReferenceType === 1) {
const Waveform = acb.WaveformTable[Cue.ReferenceIndex];
const isMemory = Waveform.Streaming === 0;
const hcaBuffer = isMemory ? acb.memoryHcas[Waveform.MemoryAwbId] : acb.streamHcas[Waveform.StreamAwbPortNo][Waveform.StreamAwbId];
const awbKey = isMemory ? acb.memoryHcas.config.key : acb.streamHcas[Waveform.StreamAwbPortNo].config.key;
const name = cueNameMap[i] + '.wav';
const wavPath = path.join(wavDir, name);
await hca.decodeHcaToWav(hcaBuffer, key, awbKey, wavPath, 1, mode);
} else if (Cue.ReferenceType === 2) {
console.log(`Unsupport ReferenceType: ${Cue.ReferenceType}`);
} else if (Cue.ReferenceType === 3) {
const Sequence = acb.SequenceTable[Cue.ReferenceIndex]; const Sequence = acb.SequenceTable[Cue.ReferenceIndex];
// Sequence.Type: 0 - Polyphonic, 1 - Sequential, Random, Random No Repeat, Switch, Shuffle Cue, Combo Sequential, Track Transition by Selector // Sequence.Type: 0 - Polyphonic, 1 - Sequential, Random, Random No Repeat, Switch, Shuffle Cue, Combo Sequential, Track Transition by Selector
const timeline = []; const timeline = [];
@ -197,6 +207,7 @@ async function mixAcb(acbPath, key, wavDir, mode, skip) {
await hca.writeWavFile(wavPath, mode, channelCount, samplingRate, pcmData); await hca.writeWavFile(wavPath, mode, channelCount, samplingRate, pcmData);
} }
} }
}
exports.mixAcb = mixAcb; exports.mixAcb = mixAcb;
async function acb2hcas(acbPath, key, hcaDir, type, skip) { async function acb2hcas(acbPath, key, hcaDir, type, skip) {