diff --git a/assets/css/creator.css b/assets/css/creator.css index 72cf3c00..bb7331fe 100644 --- a/assets/css/creator.css +++ b/assets/css/creator.css @@ -243,6 +243,25 @@ body.sidebar-hidden .sample-browser { width: 0; min-width: 0; border-right: none repeating-linear-gradient(to right, #3a3e44 0, #3a3e44 1px, transparent 1px, transparent 100%); } +/* Estilo para o Canvas de Onda ao Vivo dentro da Track Info */ +#live-waveform-canvas { + width: 100%; /* Ocupa a largura do painel lateral */ + height: 40px; /* Altura fixa definida no JS */ + background-color: #222; /* Fundo escuro para contraste */ + border-radius: 4px; + margin-top: 8px; /* Espaço entre os knobs e o canvas */ + border: 1px solid var(--border-color); + box-shadow: inset 0 0 5px rgba(0,0,0,0.5); +} + +/* Ajuste no container track-info para acomodar o novo elemento */ +.audio-track-lane .track-info { + /* Garante que o conteúdo flua verticalmente */ + display: flex; + flex-direction: column; + justify-content: flex-start; /* Alinha tudo ao topo */ + gap: 5px; +} /* Régua */ .ruler-wrapper { display: flex; flex-shrink: 0; background-color: #383c42; border-bottom: 1px solid var(--border-color); } .ruler-spacer { width: var(--track-info-width); flex-shrink: 0; border-right: 2px solid var(--border-color); } diff --git a/assets/js/creations/audio/audio_state.js b/assets/js/creations/audio/audio_state.js index 4cff2e49..e6627534 100644 --- a/assets/js/creations/audio/audio_state.js +++ b/assets/js/creations/audio/audio_state.js @@ -371,7 +371,18 @@ export function updateClipPan(clipId, pan) { export function addAudioTrackLane() { const newTrackName = `Pista de Áudio ${audioState.tracks.length + 1}`; - audioState.tracks.push({ id: Date.now(), name: newTrackName }); + + // 1. Cria o objeto da pista + const newTrack = { id: Date.now(), name: newTrackName }; + + // 2. Adiciona ao estado + audioState.tracks.push(newTrack); + + // 3. ATUALIZAÇÃO CRÍTICA: Renderiza a UI imediatamente para a pista aparecer + renderAudioEditor(); + + // 4. ATUALIZAÇÃO CRÍTICA: Retorna a pista para que o recording.js possa usar o ID + return newTrack; } export function removeAudioClip(clipId) { diff --git a/assets/js/creations/main.js b/assets/js/creations/main.js index 291e8d05..ae680bd4 100644 --- a/assets/js/creations/main.js +++ b/assets/js/creations/main.js @@ -109,6 +109,23 @@ document.addEventListener("DOMContentLoaded", () => { const zoomInBtn = document.getElementById("zoom-in-btn"); const zoomOutBtn = document.getElementById("zoom-out-btn"); const deleteClipBtn = document.getElementById("delete-clip"); + // Configuração do botão de Gravação + const recordBtn = document.getElementById('record-btn'); + + if (recordBtn) { + recordBtn.addEventListener('click', async () => { + // PASSO CRÍTICO: O navegador exige isso antes de gravar + if (Tone.context.state !== 'running') { + await Tone.start(); + console.log("Audio Context iniciado via clique."); + } + + // Chama a função que você criou no recording.js + toggleRecording(); + }); + } else { + console.error("Botão de gravação (#record-btn) não encontrado no DOM."); + } //envia pattern pro editor de áudio diff --git a/assets/js/creations/recording.js b/assets/js/creations/recording.js index 04a31d68..722ff553 100644 --- a/assets/js/creations/recording.js +++ b/assets/js/creations/recording.js @@ -102,12 +102,8 @@ async function _startRecording() { if (!success) return; try { - // --- MUDANÇA: Lógica movida para cá --- - // 1. Cria a pista de áudio *antes* de gravar - addAudioTrackLane(); // - - // 2. Pega o ID da pista recém-criada - const newTrack = appState.audio.tracks[appState.audio.tracks.length - 1]; // + const newTrack = addAudioTrackLane(); // Agora isso vai funcionar! + currentRecordingTrackId = newTrack.id; if (!newTrack) { console.error("Falha ao criar a nova pista de áudio no estado."); return; diff --git a/assets/js/creations/server/data/2025-11-23_16-20-05_sessao-9g58q.log b/assets/js/creations/server/data/2025-11-23_16-20-05_sessao-9g58q.log new file mode 100644 index 00000000..488d5831 --- /dev/null +++ b/assets/js/creations/server/data/2025-11-23_16-20-05_sessao-9g58q.log @@ -0,0 +1,10 @@ +{"level":30,"time":1763925606318,"pid":1793,"hostname":"ubuntu","timestamp":1763925606318,"socketId":"nnq0KrqWtDbQ-F2DAAJY","action":{"type":"LOAD_PROJECT","xml":"\n\n\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n\n


]]>
\n \n \n
\n
\n","__token":"1","__senderId":"nnq0KrqWtDbQ-F2DAAJY","__senderName":"Alicer-nnq0"},"msg":"action_received"} +{"level":30,"time":1763925616340,"pid":1793,"hostname":"ubuntu","timestamp":1763925616340,"socketId":"DrDFmi3z-5hVbRKNAAJa","action":{"type":"AUDIO_SNAPSHOT_REQUEST","__token":"1","__senderId":"DrDFmi3z-5hVbRKNAAJa","__senderName":"Alicer-DrDF"},"msg":"action_received"} +{"level":30,"time":1763925671726,"pid":1793,"hostname":"ubuntu","timestamp":1763925671726,"socketId":"FLIGt8cvMlscD_EMAAJc","action":{"type":"AUDIO_SNAPSHOT_REQUEST","__token":"1","__senderId":"FLIGt8cvMlscD_EMAAJc","__senderName":"Alicer-FLIG"},"msg":"action_received"} +{"level":30,"time":1763925676641,"pid":1793,"hostname":"ubuntu","timestamp":1763925676641,"socketId":"FLIGt8cvMlscD_EMAAJc","action":{"type":"TOGGLE_PLAYBACK","__token":"2","__senderId":"FLIGt8cvMlscD_EMAAJc","__senderName":"Alicer-FLIG","scheduleAtServerMs":1763925676791,"__syncMode":"global"},"msg":"action_received"} +{"level":30,"time":1763925678434,"pid":1793,"hostname":"ubuntu","timestamp":1763925678434,"socketId":"FLIGt8cvMlscD_EMAAJc","action":{"type":"STOP_PLAYBACK","__token":"3","__senderId":"FLIGt8cvMlscD_EMAAJc","__senderName":"Alicer-FLIG","__syncMode":"global"},"msg":"action_received"} +{"level":30,"time":1763925684217,"pid":1793,"hostname":"ubuntu","timestamp":1763925684217,"socketId":"9q3KAL7r7ipWcJPlAAJe","action":{"type":"AUDIO_SNAPSHOT_REQUEST","__token":"1","__senderId":"9q3KAL7r7ipWcJPlAAJe","__senderName":"Alicer-9q3K"},"msg":"action_received"} +{"level":30,"time":1763925689491,"pid":1793,"hostname":"ubuntu","timestamp":1763925689491,"socketId":"9q3KAL7r7ipWcJPlAAJe","action":{"type":"TOGGLE_PLAYBACK","__token":"2","__senderId":"9q3KAL7r7ipWcJPlAAJe","__senderName":"Alicer-9q3K","scheduleAtServerMs":1763925689652,"__syncMode":"global"},"msg":"action_received"} +{"level":30,"time":1763925700223,"pid":1793,"hostname":"ubuntu","timestamp":1763925700223,"socketId":"9q3KAL7r7ipWcJPlAAJe","action":{"type":"STOP_PLAYBACK","__token":"3","__senderId":"9q3KAL7r7ipWcJPlAAJe","__senderName":"Alicer-9q3K","__syncMode":"global"},"msg":"action_received"} +{"level":30,"time":1763925702535,"pid":1793,"hostname":"ubuntu","timestamp":1763925702535,"socketId":"9q3KAL7r7ipWcJPlAAJe","action":{"type":"TOGGLE_PLAYBACK","__token":"4","__senderId":"9q3KAL7r7ipWcJPlAAJe","__senderName":"Alicer-9q3K","scheduleAtServerMs":1763925702670,"__syncMode":"global"},"msg":"action_received"} +{"level":30,"time":1763925703793,"pid":1793,"hostname":"ubuntu","timestamp":1763925703793,"socketId":"9q3KAL7r7ipWcJPlAAJe","action":{"type":"STOP_PLAYBACK","__token":"5","__senderId":"9q3KAL7r7ipWcJPlAAJe","__senderName":"Alicer-9q3K","__syncMode":"global"},"msg":"action_received"} diff --git a/assets/js/creations/server/data/sessao-9g58q.json b/assets/js/creations/server/data/sessao-9g58q.json new file mode 100644 index 00000000..f767f94c --- /dev/null +++ b/assets/js/creations/server/data/sessao-9g58q.json @@ -0,0 +1 @@ +{"projectXml":"\n\n\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n\n


]]>
\n \n \n
\n
\n","audio":{"tracks":[],"clips":[]},"seq":0} \ No newline at end of file