playlist importando sample track
Deploy / Deploy (push) Successful in 1m58s
Details
Deploy / Deploy (push) Successful in 1m58s
Details
This commit is contained in:
parent
a4b4157f7e
commit
7ec18a5f02
|
|
@ -123,7 +123,6 @@ export function initializeAudioState() {
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function loadAudioForClip(clip) {
|
export async function loadAudioForClip(clip) {
|
||||||
// --- ADIÇÃO ---
|
|
||||||
// Se já temos um buffer (do bounce ou colagem), não faz fetch
|
// Se já temos um buffer (do bounce ou colagem), não faz fetch
|
||||||
if (clip.buffer) {
|
if (clip.buffer) {
|
||||||
// Garante que as durações estão corretas
|
// Garante que as durações estão corretas
|
||||||
|
|
@ -133,7 +132,6 @@ export async function loadAudioForClip(clip) {
|
||||||
clip.durationInSeconds = clip.buffer.duration;
|
clip.durationInSeconds = clip.buffer.duration;
|
||||||
return clip;
|
return clip;
|
||||||
}
|
}
|
||||||
// --- FIM DA ADIÇÃO ---
|
|
||||||
|
|
||||||
if (!clip.sourcePath || clip.sourcePath.startsWith("blob:")) {
|
if (!clip.sourcePath || clip.sourcePath.startsWith("blob:")) {
|
||||||
// Se não há caminho ou se é um blob, não há nada para buscar.
|
// Se não há caminho ou se é um blob, não há nada para buscar.
|
||||||
|
|
@ -147,7 +145,9 @@ export async function loadAudioForClip(clip) {
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const response = await fetch(clip.sourcePath);
|
const safeUrl = encodeURI(url).replace(/#/g, "%23");
|
||||||
|
const response = await fetch(safeUrl);
|
||||||
|
|
||||||
if (!response.ok)
|
if (!response.ok)
|
||||||
throw new Error(`Falha ao buscar áudio: ${clip.sourcePath}`);
|
throw new Error(`Falha ao buscar áudio: ${clip.sourcePath}`);
|
||||||
const arrayBuffer = await response.arrayBuffer();
|
const arrayBuffer = await response.arrayBuffer();
|
||||||
|
|
@ -155,7 +155,7 @@ export async function loadAudioForClip(clip) {
|
||||||
|
|
||||||
clip.buffer = audioBuffer;
|
clip.buffer = audioBuffer;
|
||||||
|
|
||||||
// --- CORREÇÃO: Salva a duração original ---
|
// --- Salva a duração original ---
|
||||||
if (clip.durationInSeconds === 0) {
|
if (clip.durationInSeconds === 0) {
|
||||||
clip.durationInSeconds = audioBuffer.duration;
|
clip.durationInSeconds = audioBuffer.duration;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -27,7 +27,8 @@ function buildSamplePathMap(tree, currentPath) {
|
||||||
for (const key in tree) {
|
for (const key in tree) {
|
||||||
if (key === "_isFile") continue;
|
if (key === "_isFile") continue;
|
||||||
const node = tree[key];
|
const node = tree[key];
|
||||||
const newPath = `${currentPath}/${key}`;
|
const encodedKey = encodeURIComponent(key);
|
||||||
|
const newPath = `${currentPath}/${encodedKey}`;
|
||||||
if (node._isFile) {
|
if (node._isFile) {
|
||||||
samplePathMap[key] = newPath;
|
samplePathMap[key] = newPath;
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -72,7 +73,8 @@ function renderFileTree(tree, parentElement, currentPath) {
|
||||||
|
|
||||||
const node = tree[key];
|
const node = tree[key];
|
||||||
const li = document.createElement("li");
|
const li = document.createElement("li");
|
||||||
const newPath = `${currentPath}/${key}`;
|
const encodedKey = encodeURIComponent(key);
|
||||||
|
const newPath = `${currentPath}/${encodedKey}`;
|
||||||
|
|
||||||
if (node._isFile) {
|
if (node._isFile) {
|
||||||
// --- LÓGICA PARA ARQUIVOS ---
|
// --- LÓGICA PARA ARQUIVOS ---
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue