tentando resolver conflitos do tone no mmpCreator
Deploy / Deploy (push) Successful in 2m0s
Details
Deploy / Deploy (push) Successful in 2m0s
Details
This commit is contained in:
parent
cb2479be0c
commit
b7d3bc529a
|
|
@ -12,6 +12,9 @@ import { SuperSaw } from "../../audio/plugins/SuperSaw.js";
|
||||||
import { Lb302 } from "../../audio/plugins/Lb302.js";
|
import { Lb302 } from "../../audio/plugins/Lb302.js";
|
||||||
import { Kicker } from "../../audio/plugins/Kicker.js";
|
import { Kicker } from "../../audio/plugins/Kicker.js";
|
||||||
|
|
||||||
|
const TICKS_PER_STEP = 12; // LMMS: 12 ticks por 1/16
|
||||||
|
const STEPS_PER_BAR = 16; // 4/4 em 1/16
|
||||||
|
|
||||||
// Mapa para facilitar a criação dinâmica
|
// Mapa para facilitar a criação dinâmica
|
||||||
const PLUGIN_CLASSES = {
|
const PLUGIN_CLASSES = {
|
||||||
tripleoscillator: TripleOscillator,
|
tripleoscillator: TripleOscillator,
|
||||||
|
|
@ -310,9 +313,21 @@ function schedulePianoRoll() {
|
||||||
}
|
}
|
||||||
}, events).start(0);
|
}, events).start(0);
|
||||||
|
|
||||||
const bars = parseInt(document.getElementById("bars-input")?.value || 1);
|
// calcula até onde vai a última nota do pianoroll
|
||||||
|
let maxEndTick = 0;
|
||||||
|
for (const n of pattern.notes) {
|
||||||
|
const pos = Number(n.pos) || 0;
|
||||||
|
const rawLen = Number(n.len) || 0;
|
||||||
|
const len = rawLen < 0 ? TICKS_PER_STEP : rawLen;
|
||||||
|
maxEndTick = Math.max(maxEndTick, pos + Math.max(len, TICKS_PER_STEP));
|
||||||
|
}
|
||||||
|
|
||||||
|
const totalStepsNeeded = Math.max(1, Math.ceil(maxEndTick / TICKS_PER_STEP));
|
||||||
|
const barsNeeded = Math.max(1, Math.ceil(totalStepsNeeded / STEPS_PER_BAR));
|
||||||
|
|
||||||
part.loop = true;
|
part.loop = true;
|
||||||
part.loopEnd = bars + "m";
|
part.loopEnd = `${barsNeeded}m`;
|
||||||
|
|
||||||
|
|
||||||
activeParts.push(part);
|
activeParts.push(part);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue