melhorando a leitura de projetos no mmpCreator
Deploy / Deploy (push) Successful in 2m29s
Details
Deploy / Deploy (push) Successful in 2m29s
Details
This commit is contained in:
parent
172c70f90a
commit
1a0436d4bb
|
|
@ -591,11 +591,23 @@ export function startSongPatternPlaybackOnTransport() {
|
||||||
if (patt.steps[hit.localStep]) {
|
if (patt.steps[hit.localStep]) {
|
||||||
// SAMPLER
|
// SAMPLER
|
||||||
if (track.type === "sampler" && track.player) {
|
if (track.type === "sampler" && track.player) {
|
||||||
track.player.restart = true; // baterias precisam retrigger
|
// Tone.Player é monofônico por padrão; sem retrigger, hits rápidos "morrem".
|
||||||
|
if ("retrigger" in track.player) track.player.retrigger = true;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
// preferível: restart() (método) retrigga sem depender do estado atual
|
||||||
|
if (typeof track.player.restart === "function") {
|
||||||
|
track.player.restart(time);
|
||||||
|
} else {
|
||||||
track.player.start(time);
|
track.player.start(time);
|
||||||
} catch {}
|
|
||||||
}
|
}
|
||||||
|
} catch (e) {
|
||||||
|
// fallback (p/ versões diferentes do Tone)
|
||||||
|
try { track.player.stop(time); } catch {}
|
||||||
|
try { track.player.start(time); } catch {}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// PLUGIN (step sem piano roll)
|
// PLUGIN (step sem piano roll)
|
||||||
else if (track.type === "plugin" && track.instrument) {
|
else if (track.type === "plugin" && track.instrument) {
|
||||||
const hasNotes = patt.notes && patt.notes.length > 0;
|
const hasNotes = patt.notes && patt.notes.length > 0;
|
||||||
|
|
|
||||||
|
|
@ -147,7 +147,10 @@ export async function loadAudioForTrack(track) {
|
||||||
track.instrument = null;
|
track.instrument = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
const player = new Tone.Player({ url: track.samplePath, autostart: false });
|
const player = new Tone.Player({ url: track.samplePath, autostart: false, retrigger: true });
|
||||||
|
// redundância segura p/ builds diferentes do Tone:
|
||||||
|
try { player.retrigger = true; } catch {}
|
||||||
|
|
||||||
await player.load(track.samplePath);
|
await player.load(track.samplePath);
|
||||||
|
|
||||||
player.connect(track.volumeNode);
|
player.connect(track.volumeNode);
|
||||||
|
|
|
||||||
|
|
@ -976,6 +976,19 @@ async function handleActionBroadcast(action) {
|
||||||
track.activePatternIndex = patternIndex;
|
track.activePatternIndex = patternIndex;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
try {
|
||||||
|
const maxSteps = appState.pattern.tracks
|
||||||
|
.filter(t => t.type !== "bassline")
|
||||||
|
.map(t => t.patterns?.[patternIndex]?.steps?.length || 0)
|
||||||
|
.reduce((a, b) => Math.max(a, b), 0);
|
||||||
|
|
||||||
|
const barsEl = document.getElementById("bars-input");
|
||||||
|
if (barsEl && maxSteps > 0) {
|
||||||
|
// assumindo 16 steps por compasso (4/4 em 1/16)
|
||||||
|
barsEl.value = Math.max(1, Math.ceil(maxSteps / 16));
|
||||||
|
}
|
||||||
|
} catch {}
|
||||||
|
|
||||||
// Mostra o toast (só uma vez)
|
// Mostra o toast (só uma vez)
|
||||||
if (!isFromSelf) {
|
if (!isFromSelf) {
|
||||||
const who = actorOf(action);
|
const who = actorOf(action);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue