renderizando projetos no mmpCreator sem erros

This commit is contained in:
JotaChina committed 2025-12-28 14:07:30 -03:00
1 parent faaf8752a8
commit e902e8d735
3 files changed
+75 -122

No files matched your search

+7 -11
View File
@@ -68,10 +68,7 @@ function _convertSecondsToBeat(seconds) {
function _initContext() {
if (!audioCtx) {
initializeAudioContext();
// ✅ garante que é o AudioContext nativo
audioCtx = Tone.getContext().rawContext;
} else if (audioCtx.rawContext) {
audioCtx = audioCtx.rawContext;
audioCtx = getAudioContext(); // deve ser o rawContext do Tone
}
}
@@ -407,17 +404,16 @@ export async function startAudioEditorPlayback(seekTime) {
// garante contexto ativo do Tone (gesto do usuário já ocorreu antes)
await Tone.start();
const raw = audioCtx?.rawContext || audioCtx;
if (raw?.state === "suspended" && typeof raw.resume === "function") {
await raw.resume();
if (audioCtx.state === "suspended") {
await audioCtx.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)