samples de áudio não reiniciavam ao fim da playlist
Deploy / Deploy (push) Successful in 2m5s
Details
Deploy / Deploy (push) Successful in 2m5s
Details
This commit is contained in:
parent
bf03931eb8
commit
23258e7d02
|
|
@ -34,6 +34,29 @@ const timerDisplay = document.getElementById("timer-display");
|
||||||
// Variável para armazenar as "Parts" (sequências melódicas) do Tone.js
|
// Variável para armazenar as "Parts" (sequências melódicas) do Tone.js
|
||||||
let activeParts = [];
|
let activeParts = [];
|
||||||
|
|
||||||
|
// =====================================================
|
||||||
|
// Proteção: não “vazar” loop do Pattern Editor pro Song
|
||||||
|
// =====================================================
|
||||||
|
let _transportLoopSnapshot = null;
|
||||||
|
|
||||||
|
function snapshotTransportLoopOnce() {
|
||||||
|
if (_transportLoopSnapshot) return;
|
||||||
|
_transportLoopSnapshot = {
|
||||||
|
loop: Tone.Transport.loop,
|
||||||
|
loopStart: Tone.Transport.loopStart,
|
||||||
|
loopEnd: Tone.Transport.loopEnd,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
function restoreTransportLoop() {
|
||||||
|
if (!_transportLoopSnapshot) return;
|
||||||
|
Tone.Transport.loop = _transportLoopSnapshot.loop;
|
||||||
|
Tone.Transport.loopStart = _transportLoopSnapshot.loopStart;
|
||||||
|
Tone.Transport.loopEnd = _transportLoopSnapshot.loopEnd;
|
||||||
|
_transportLoopSnapshot = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
let currentStep = 0;
|
let currentStep = 0;
|
||||||
|
|
||||||
function updateStepHighlight(step) {
|
function updateStepHighlight(step) {
|
||||||
|
|
@ -182,6 +205,7 @@ export function stopPlayback(rewind = true) {
|
||||||
Tone.Transport.stop();
|
Tone.Transport.stop();
|
||||||
Tone.Transport.cancel();
|
Tone.Transport.cancel();
|
||||||
stopScheduledPianoRoll();
|
stopScheduledPianoRoll();
|
||||||
|
restoreTransportLoop();
|
||||||
|
|
||||||
// ✅ Pattern Editor: para apenas o preview (não mexe no track.player da playlist)
|
// ✅ Pattern Editor: para apenas o preview (não mexe no track.player da playlist)
|
||||||
appState.pattern.tracks.forEach((track) => {
|
appState.pattern.tracks.forEach((track) => {
|
||||||
|
|
@ -255,6 +279,8 @@ export function schedulePianoRoll() {
|
||||||
barsInput.dispatchEvent(new Event("input", { bubbles: true }));
|
barsInput.dispatchEvent(new Event("input", { bubbles: true }));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
snapshotTransportLoopOnce();
|
||||||
|
|
||||||
Tone.Transport.loop = true;
|
Tone.Transport.loop = true;
|
||||||
Tone.Transport.loopStart = 0;
|
Tone.Transport.loopStart = 0;
|
||||||
Tone.Transport.loopEnd = `${barsNeeded}m`;
|
Tone.Transport.loopEnd = `${barsNeeded}m`;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue