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
|
|
@ -122,8 +122,7 @@ export function initializeAudioState() {
|
|||
});
|
||||
}
|
||||
|
||||
export async function loadAudioForClip(clip) {
|
||||
// --- ADIÇÃO ---
|
||||
export async function loadAudioForClip(clip) {
|
||||
// Se já temos um buffer (do bounce ou colagem), não faz fetch
|
||||
if (clip.buffer) {
|
||||
// Garante que as durações estão corretas
|
||||
|
|
@ -132,8 +131,7 @@ export async function loadAudioForClip(clip) {
|
|||
if (clip.durationInSeconds === 0)
|
||||
clip.durationInSeconds = clip.buffer.duration;
|
||||
return clip;
|
||||
}
|
||||
// --- FIM DA ADIÇÃO ---
|
||||
}
|
||||
|
||||
if (!clip.sourcePath || clip.sourcePath.startsWith("blob:")) {
|
||||
// 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 {
|
||||
const response = await fetch(clip.sourcePath);
|
||||
const safeUrl = encodeURI(url).replace(/#/g, "%23");
|
||||
const response = await fetch(safeUrl);
|
||||
|
||||
if (!response.ok)
|
||||
throw new Error(`Falha ao buscar áudio: ${clip.sourcePath}`);
|
||||
const arrayBuffer = await response.arrayBuffer();
|
||||
|
|
@ -155,7 +155,7 @@ export async function loadAudioForClip(clip) {
|
|||
|
||||
clip.buffer = audioBuffer;
|
||||
|
||||
// --- CORREÇÃO: Salva a duração original ---
|
||||
// --- Salva a duração original ---
|
||||
if (clip.durationInSeconds === 0) {
|
||||
clip.durationInSeconds = audioBuffer.duration;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -27,7 +27,8 @@ function buildSamplePathMap(tree, currentPath) {
|
|||
for (const key in tree) {
|
||||
if (key === "_isFile") continue;
|
||||
const node = tree[key];
|
||||
const newPath = `${currentPath}/${key}`;
|
||||
const encodedKey = encodeURIComponent(key);
|
||||
const newPath = `${currentPath}/${encodedKey}`;
|
||||
if (node._isFile) {
|
||||
samplePathMap[key] = newPath;
|
||||
} else {
|
||||
|
|
@ -72,7 +73,8 @@ function renderFileTree(tree, parentElement, currentPath) {
|
|||
|
||||
const node = tree[key];
|
||||
const li = document.createElement("li");
|
||||
const newPath = `${currentPath}/${key}`;
|
||||
const encodedKey = encodeURIComponent(key);
|
||||
const newPath = `${currentPath}/${encodedKey}`;
|
||||
|
||||
if (node._isFile) {
|
||||
// --- LÓGICA PARA ARQUIVOS ---
|
||||
|
|
|
|||
Loading…
Reference in New Issue