renderizando projetos no mmpCreator sem erros

This commit is contained in:
JotaChina committed 2025-12-28 13:51:08 -03:00
1 parent ca5d4fc9a7
commit faaf8752a8
2 files changed
+87 -66

No files matched your search

+11 -7
View File
@@ -68,7 +68,10 @@ function _convertSecondsToBeat(seconds) {
function _initContext() {
if (!audioCtx) {
initializeAudioContext();
audioCtx = getAudioContext(); // deve ser o rawContext do Tone
// ✅ garante que é o AudioContext nativo
audioCtx = Tone.getContext().rawContext;
} else if (audioCtx.rawContext) {
audioCtx = audioCtx.rawContext;
}
}
@@ -404,16 +407,17 @@ export async function startAudioEditorPlayback(seekTime) {
// garante contexto ativo do Tone (gesto do usuário já ocorreu antes)
await Tone.start();
if (audioCtx.state === "suspended") {
await audioCtx.resume();
}
const raw = audioCtx?.rawContext || audioCtx;
if (raw?.state === "suspended" && typeof raw.resume === "function") {
await raw.resume();
}
audioCtx = raw;
// alinhamento de relógio próprio
startTime = audioCtx.currentTime;
isPlaying = true;
appState.global.isAudioEditorPlaying = true;
// alinhamento de relógio próprio (mantido para o seu scheduler)
startTime = audioCtx.currentTime;
// 1. Determine o tempo de início:
let timeToStart =
seekTime !== null && seekTime !== undefined && !isNaN(seekTime)