tentando resolver conflitos do tone no mmpCreator
Deploy / Deploy (push) Successful in 2m1s Details

This commit is contained in:
JotaChina 2025-12-26 20:00:10 -03:00
parent 2fa137a45d
commit 191e97d032
2 changed files with 7 additions and 13 deletions

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,

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 {}