melhorando a leitura de projetos no mmpCreator
This commit is contained in:
1 parent
9f06aed297
commit
8dbf240928
3 files changed
+31
-20
No files matched your search
@@ -268,18 +268,26 @@ function parseInstrumentNode(
|
||||
const ticksPerStep = 12;
|
||||
|
||||
patternNode.querySelectorAll("note").forEach((noteNode) => {
|
||||
const pos = parseInt(noteNode.getAttribute("pos"), 10);
|
||||
const len = parseInt(noteNode.getAttribute("len"), 10);
|
||||
const vol = parseInt(noteNode.getAttribute("vol"), 10);
|
||||
const pan = parseInt(noteNode.getAttribute("pan"), 10);
|
||||
const key = parseInt(noteNode.getAttribute("key"), 10);
|
||||
const pos = parseInt(noteNode.getAttribute("pos"), 10) || 0;
|
||||
|
||||
notes.push({ pos, len, key, vol, pan });
|
||||
const rawLen = parseInt(noteNode.getAttribute("len"), 10) || 0;
|
||||
|
||||
// Calcula qual step acender
|
||||
const stepIndex = Math.floor(pos / ticksPerStep);
|
||||
// ✅ LMMS costuma salvar one-shots com len negativo (ex: -192).
|
||||
// Na nossa DAW, tratamos isso como 1 step (1/16) = 12 ticks.
|
||||
const len = rawLen < 0 ? TICKS_PER_STEP : rawLen;
|
||||
|
||||
notes.push({
|
||||
pos,
|
||||
len,
|
||||
key: parseInt(noteNode.getAttribute("key"), 10),
|
||||
vol: parseInt(noteNode.getAttribute("vol"), 10),
|
||||
pan: parseInt(noteNode.getAttribute("pan"), 10),
|
||||
});
|
||||
|
||||
// stepIndex também deve usar 12 (você já corrigiu isso antes)
|
||||
const stepIndex = Math.floor(pos / TICKS_PER_STEP);
|
||||
if (stepIndex < patternSteps) steps[stepIndex] = true;
|
||||
});
|
||||
});
|
||||
|
||||
return {
|
||||
name: patternName,
|
||||
|
||||
Reference in new issue
Block a user