tentando resolver conflitos do tone no mmpCreator

This commit is contained in:
JotaChina committed 2025-12-26 19:47:54 -03:00
1 parent e929fb88c1
commit f148254958
6 files changed
+13 -8

No files matched your search

+1 -1
View File
@@ -17,7 +17,7 @@ import {
import { getPixelsPerSecond } from "../utils.js"; import { getPixelsPerSecond } from "../utils.js";
// 🔊 ADIÇÃO: usar a MESMA instância do Tone que o projeto usa // 🔊 ADIÇÃO: usar a MESMA instância do Tone que o projeto usa
import * as Tone from "https://esm.sh/tone"; import * as Tone from "https://esm.sh/tone@14.7.77";
// --- Configurações do Scheduler --- // --- Configurações do Scheduler ---
const LOOKAHEAD_INTERVAL_MS = 25.0; const LOOKAHEAD_INTERVAL_MS = 25.0;
+1 -1
View File
@@ -2,7 +2,7 @@
import { DEFAULT_VOLUME, DEFAULT_PAN } from "../config.js"; import { DEFAULT_VOLUME, DEFAULT_PAN } from "../config.js";
import { renderAudioEditor } from "./audio_ui.js"; import { renderAudioEditor } from "./audio_ui.js";
import { getMainGainNode, getAudioContext } from "../audio.js"; import { getMainGainNode, getAudioContext } from "../audio.js";
import * as Tone from "https://esm.sh/tone"; import * as Tone from "https://esm.sh/tone@14.7.77";
export let audioState = { export let audioState = {
tracks: [], tracks: [],
+1 -1
View File
@@ -14,7 +14,7 @@ import { renderAll, getSamplePathMap } from "./ui.js";
import { DEFAULT_PAN, DEFAULT_VOLUME, NOTE_LENGTH } from "./config.js"; import { DEFAULT_PAN, DEFAULT_VOLUME, NOTE_LENGTH } from "./config.js";
import { initializeAudioContext, getMainGainNode } from "./audio.js"; import { initializeAudioContext, getMainGainNode } from "./audio.js";
import { DEFAULT_PROJECT_XML, getSecondsPerStep, SAMPLE_SRC } from "./utils.js"; import { DEFAULT_PROJECT_XML, getSecondsPerStep, SAMPLE_SRC } from "./utils.js";
import * as Tone from "https://esm.sh/tone"; import * as Tone from "https://esm.sh/tone@14.7.77";
import { sendAction } from "./socket.js"; import { sendAction } from "./socket.js";
// ⚠️ vem do módulo de áudio (o mesmo que audio_ui usa) // ⚠️ vem do módulo de áudio (o mesmo que audio_ui usa)
+1 -1
View File
@@ -20,7 +20,7 @@ import { sendAction, joinRoom, setUserName } from "./socket.js";
import { renderActivePatternToBlob } from "./pattern/pattern_audio.js"; import { renderActivePatternToBlob } from "./pattern/pattern_audio.js";
import { showToast } from "./ui.js"; import { showToast } from "./ui.js";
import { toggleRecording } from "./recording.js" import { toggleRecording } from "./recording.js"
import * as Tone from "https://esm.sh/tone"; // Adicione o Tone aqui se não estiver global import * as Tone from "https://esm.sh/tone@14.7.77";
const ROOM_NAME = new URLSearchParams(window.location.search).get("room"); const ROOM_NAME = new URLSearchParams(window.location.search).get("room");
window.ROOM_NAME = ROOM_NAME; window.ROOM_NAME = ROOM_NAME;
+8 -3
View File
@@ -1,12 +1,11 @@
// js/pattern_audio.js // js/pattern_audio.js
import * as Tone from "https://esm.sh/tone"; import * as Tone from "https://esm.sh/tone@14.7.77";
import { appState } from "../state.js"; import { appState } from "../state.js";
import { highlightStep } from "./pattern_ui.js"; import { highlightStep } from "./pattern_ui.js";
import { getTotalSteps } from "../utils.js"; import { getTotalSteps } from "../utils.js";
import { initializeAudioContext } from "../audio.js"; import { initializeAudioContext } from "../audio.js";
// Ajuste os caminhos (../plugins/...) conforme a estrutura real das suas pastas
import { TripleOscillator } from "../../audio/plugins/TripleOscillator.js"; import { TripleOscillator } from "../../audio/plugins/TripleOscillator.js";
import { Nes } from "../../audio/plugins/Nes.js"; import { Nes } from "../../audio/plugins/Nes.js";
import { SuperSaw } from "../../audio/plugins/SuperSaw.js"; import { SuperSaw } from "../../audio/plugins/SuperSaw.js";
@@ -633,7 +632,13 @@ export function startSongPatternPlaybackOnTransport() {
if (patt.steps[stepInPattern]) { if (patt.steps[stepInPattern]) {
if (track.type === "sampler" && track.player) { if (track.type === "sampler" && track.player) {
track.player.restart = true; track.player.restart = true;
try { track.player.start(time); } catch {} try {
// Verifica se já está tocando. Se sim, para imediatamente antes de recomeçar.
if (track.player.state === "started") {
track.player.stop();
}
track.player.start(time); }
catch {}
} else if (track.type === "plugin" && track.instrument) { } else if (track.type === "plugin" && track.instrument) {
// plugin sem piano roll // plugin sem piano roll
try { track.instrument.triggerAttackRelease("C5", "16n", time); } catch {} try { track.instrument.triggerAttackRelease("C5", "16n", time); } catch {}
+1 -1
View File
@@ -1,5 +1,5 @@
// js/pattern/pattern_state.js // js/pattern/pattern_state.js
import * as Tone from "https://esm.sh/tone"; import * as Tone from "https://esm.sh/tone@14.7.77";
import { TripleOscillator } from "../../audio/plugins/TripleOscillator.js"; import { TripleOscillator } from "../../audio/plugins/TripleOscillator.js";
import { Kicker } from "../../audio/plugins/Kicker.js"; import { Kicker } from "../../audio/plugins/Kicker.js";
import { Lb302 } from "../../audio/plugins/Lb302.js"; import { Lb302 } from "../../audio/plugins/Lb302.js";