renderizando projetos no mmpCreator

This commit is contained in:
JotaChina committed 2025-12-28 11:49:09 -03:00
1 parent a806eb73e1
commit 895a148d21
3 files changed
+388 -39

No files matched your search

+7 -8
View File
@@ -1,5 +1,5 @@
// js/main.js
import { appState, loadStateFromSession } from "./state.js"; // <--- Importe loadStateFromSession
import { appState, loadStateFromSession } from "./state.js";
import {
updateTransportLoop,
restartAudioEditorIfPlaying,
@@ -17,7 +17,7 @@ import { adjustValue, enforceNumericInput, DEFAULT_PROJECT_XML, secondsToSongTic
import { ZOOM_LEVELS } from "./config.js";
import { loadProjectFromServer } from "./file.js";
import { sendAction, joinRoom, setUserName } from "./socket.js";
import { renderActivePatternToBlob } from "./pattern/pattern_audio.js";
import { renderActivePatternToBlob, renderProjectAndDownload } from "./pattern/pattern_audio.js";
import { showToast } from "./ui.js";
import { toggleRecording } from "./recording.js"
import * as Tone from "https://esm.sh/tone"; // Adicione o Tone aqui se não estiver global
@@ -127,6 +127,10 @@ document.addEventListener("DOMContentLoaded", () => {
const deleteClipBtn = document.getElementById("delete-clip");
const addPatternBtn = document.getElementById("add-pattern-btn");
const removePatternBtn = document.getElementById("remove-pattern-btn");
const downloadPackageBtn = document.getElementById("download-package-btn");
// Download projeto
downloadPackageBtn?.addEventListener("click", generateMmpFile);
// Configuração do botão de Gravação
const recordBtn = document.getElementById('record-btn');
@@ -365,18 +369,13 @@ document.addEventListener("DOMContentLoaded", () => {
if (file) handleFileLoad(file).then(() => closeOpenProjectModal());
});
uploadSampleBtn?.addEventListener("click", () => sampleFileInput?.click());
saveMmpBtn?.addEventListener("click", generateMmpFile);
saveMmpBtn?.addEventListener("click", renderProjectAndDownload);
addInstrumentBtn?.addEventListener("click", () => {
initializeAudioContext();
sendAction({ type: "ADD_TRACK" });
});
removeInstrumentBtn?.addEventListener("click", () => {
initializeAudioContext();
sendAction({ type: "REMOVE_LAST_TRACK" });
});
// 👇 ATUALIZE ESTE LISTENER
removeInstrumentBtn?.addEventListener("click", () => {
initializeAudioContext();