tentando resolver conflitos do tone no mmpCreator

This commit is contained in:
JotaChina committed 2025-12-26 20:00:10 -03:00
1 parent ee49f1c9ff
commit 0710f3c140
2 files changed
+7 -13

No files matched your search

+5 -5
View File
@@ -14,7 +14,7 @@ import { renderAll, getSamplePathMap } from "./ui.js";
import { DEFAULT_PAN, DEFAULT_VOLUME, NOTE_LENGTH } from "./config.js";
import { initializeAudioContext, getMainGainNode } from "./audio.js";
import { DEFAULT_PROJECT_XML, getSecondsPerStep, SAMPLE_SRC } from "./utils.js";
import * as Tone from "https://esm.sh/tone@14.7.77";
import * as Tone from "https://esm.sh/tone";
import { sendAction } from "./socket.js";
// ⚠️ vem do módulo de áudio (o mesmo que audio_ui usa)
@@ -414,7 +414,7 @@ export async function parseMmpContent(xmlString) {
const lanePan = st ? Number(st.getAttribute("pan") ?? 0) / 100 : 0;
// cada <sampletco> é um clip
const clips = Array.from(node.children).filter(c => c.tagName === "sampletco");
const clips = Array.from(node.querySelectorAll(":scope > sampletco"));
clips.forEach((c, cidx) => {
// resolve caminho via manifest; fallback para /samples
const src = c.getAttribute("src") || "";
@@ -509,9 +509,9 @@ export async function parseMmpContent(xmlString) {
.map((trackNode, idx) => {
const trackName = trackNode.getAttribute("name") || "Beat/Bassline";
const playlistClips = Array.from(trackNode.children)
.filter(c => c.tagName === "bbtco")
.map((bbtco) => ({
const playlistClips = Array.from(
trackNode.querySelectorAll(":scope > bbtco")
).map((bbtco) => ({
pos: parseInt(bbtco.getAttribute("pos"), 10) || 0,
len: parseInt(bbtco.getAttribute("len"), 10) || 192,
name: trackName,
+2 -8
View File
@@ -1,5 +1,5 @@
// js/pattern_audio.js
import * as Tone from "https://esm.sh/tone@14.7.77";
import * as Tone from "https://esm.sh/tone";
import { appState } from "../state.js";
import { highlightStep } from "./pattern_ui.js";
@@ -632,13 +632,7 @@ export function startSongPatternPlaybackOnTransport() {
if (patt.steps[stepInPattern]) {
if (track.type === "sampler" && track.player) {
track.player.restart = true;
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 {}
try { track.player.start(time); } catch {}
} else if (track.type === "plugin" && track.instrument) {
// plugin sem piano roll
try { track.instrument.triggerAttackRelease("C5", "16n", time); } catch {}