Changeset 3693876
- Timestamp:
- 09/13/2026 03:49:32 PM (2 months ago)
- Location:
- studiolite/trunk
- Files:
-
- 3 edited
-
assets/studio-lite.js (modified) (6 diffs)
-
readme.txt (modified) (3 diffs)
-
studio-lite.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
studiolite/trunk/assets/studio-lite.js
r3639744 r3693876 1 1 // ============================================================ 2 // Studio Lite v1.0 — WordPress Plugin (Free)2 // Studio Lite v1.0.1 — WordPress Plugin (Free) 3 3 // © 2025 Bloco do Moreno — Todos os direitos reservados. 4 4 // contato: oficina@blocodomoreno.com.br … … 41 41 let soloTrackId = null; 42 42 let isSeeking = false; 43 43 let playAnchorCtx = 0; // audioCtx.currentTime no instante do start agendado 44 let playAnchorPos = 0; // posição (s) correspondente a esse instante 45 46 // Velocidade fixa nesta versão — sem controle de tempo na UI. 47 // Sempre que PLAYBACK_SPEED === 1.0, usamos o motor direto (sample-accurate, 48 // sem ScriptProcessor) em vez do pipeline SoundTouch, evitando cliques e 49 // dessincronismo entre trilhas. 50 const PLAYBACK_SPEED = 1.0; 44 51 45 52 function initCtx() { … … 113 120 } 114 121 122 // ── Motor direto (sem time-stretch) ──────────────────────── 123 // Agenda todas as trilhas para iniciar no MESMO instante do relógio do 124 // AudioContext (sample-accurate). Isso elimina o dessincronismo entre 125 // trilhas e os cliques causados pelo ScriptProcessorNode, que dependiam 126 // da thread principal do navegador para cada trilha individualmente. 127 function playDirect(offsetSeconds) { 128 const LOOKAHEAD = 0.06; // margem p/ o navegador agendar sem estalos 129 const startAt = audioCtx.currentTime + LOOKAHEAD; 130 playAnchorCtx = startAt; 131 playAnchorPos = offsetSeconds; 132 133 tracks.forEach(function (t) { 134 if (!t.buffer) return; 135 const source = audioCtx.createBufferSource(); 136 source.buffer = t.buffer; 137 const gain = audioCtx.createGain(); 138 gain.gain.value = soloTrackId ? (t.id === soloTrackId ? 1 : 0) : (t.muted ? 0 : 1); 139 source.connect(gain); 140 gain.connect(audioCtx.destination); 141 source.start(startAt, Math.min(offsetSeconds, t.buffer.duration)); 142 t.gain = gain; 143 t.source = source; 144 }); 145 } 146 147 function currentDirectPosition() { 148 return Math.max(0, audioCtx.currentTime - playAnchorCtx) + playAnchorPos; 149 } 150 115 151 // ── Carregar arquivos ───────────────────────────────────── 116 152 btnLoad.addEventListener('click', function () { fileInput.click(); }); … … 235 271 if (!isPlaying || isPaused) return; 236 272 isPaused = true; 237 pauseOffset = Math.min( stPosition, totalDuration);273 pauseOffset = Math.min(PLAYBACK_SPEED === 1.0 ? currentDirectPosition() : stPosition, totalDuration); 238 274 tracks.forEach(function (t) { try { if (t.source) t.source.stop(); } catch (_) {} }); 239 275 teardownStNodes(); … … 272 308 tempoTot.textContent = formatTime(totalDuration); 273 309 274 // Sempre modo SoundTouch — fluido em qualquer velocidade 275 stPosition = pauseOffset; 276 tracks.forEach(function (t, i) { 277 if (!t.buffer) return; 278 const offsetSamples = Math.floor(pauseOffset * t.buffer.sampleRate); 279 const node = buildStNode(t, offsetSamples, 1.0, i === 0); 280 node.gain.gain.value = soloTrackId ? (t.id === soloTrackId ? 1 : 0) : (t.muted ? 0 : 1); 281 t.gain = node.gain; 282 t.source = null; 283 stNodes.push(node); 284 }); 310 if (PLAYBACK_SPEED === 1.0) { 311 stPosition = pauseOffset; 312 playDirect(pauseOffset); 313 } else { 314 // Modo SoundTouch — reservado para troca de velocidade (não usado nesta versão) 315 stPosition = pauseOffset; 316 tracks.forEach(function (t, i) { 317 if (!t.buffer) return; 318 const offsetSamples = Math.floor(pauseOffset * t.buffer.sampleRate); 319 const node = buildStNode(t, offsetSamples, PLAYBACK_SPEED, i === 0); 320 node.gain.gain.value = soloTrackId ? (t.id === soloTrackId ? 1 : 0) : (t.muted ? 0 : 1); 321 t.gain = node.gain; 322 t.source = null; 323 stNodes.push(node); 324 }); 325 } 285 326 286 327 clearInterval(progressInterval); 287 328 progressInterval = setInterval(function () { 329 if (PLAYBACK_SPEED === 1.0) stPosition = currentDirectPosition(); 288 330 const cur = Math.min(stPosition, totalDuration); 289 331 const pct = totalDuration > 0 ? Math.min((cur / totalDuration) * 100, 100) : 0; … … 320 362 teardownStNodes(); 321 363 stPosition = newTime; 322 tracks.forEach(function (t, i) { 323 if (!t.buffer) return; 324 const offsetSamples = Math.floor(newTime * t.buffer.sampleRate); 325 const node = buildStNode(t, offsetSamples, 1.0, i === 0); 326 node.gain.gain.value = soloTrackId ? (t.id === soloTrackId ? 1 : 0) : (t.muted ? 0 : 1); 327 t.gain = node.gain; 328 t.source = null; 329 stNodes.push(node); 330 }); 364 if (PLAYBACK_SPEED === 1.0) { 365 playDirect(newTime); 366 } else { 367 tracks.forEach(function (t, i) { 368 if (!t.buffer) return; 369 const offsetSamples = Math.floor(newTime * t.buffer.sampleRate); 370 const node = buildStNode(t, offsetSamples, PLAYBACK_SPEED, i === 0); 371 node.gain.gain.value = soloTrackId ? (t.id === soloTrackId ? 1 : 0) : (t.muted ? 0 : 1); 372 t.gain = node.gain; 373 t.source = null; 374 stNodes.push(node); 375 }); 376 } 331 377 } else { 332 378 pauseOffset = newTime; -
studiolite/trunk/readme.txt
r3647929 r3693876 4 4 Requires at least: 5.0 5 5 Tested up to: 7.0.4 6 Stable tag: 1.0. 06 Stable tag: 1.0.1 7 7 Requires PHP: 7.4 8 8 License: GPL-2.0+ … … 74 74 == Changelog == 75 75 76 = 1.0.1 = 77 * Corrigido: cliques e dessincronismo entre trilhas durante a reprodução simultânea de múltiplos arquivos de áudio 78 76 79 = 1.0.0 = 77 80 * Initial release … … 79 82 == Upgrade Notice == 80 83 84 = 1.0.1 = 85 Corrige um bug de áudio (cliques/dessincronia entre trilhas). Atualização recomendada para todos os usuários. 86 81 87 = 1.0.0 = 82 88 Initial release of Studiolite. -
studiolite/trunk/studio-lite.php
r3639744 r3693876 4 4 * Plugin URI: https://blocodomoreno.com.br/studiolite 5 5 * Description: Multitrack audio mixer for WordPress. Load tracks, adjust volumes, use Mute — all in the browser, no installation needed. 6 * Version: 1.0. 06 * Version: 1.0.1 7 7 * Author: Bloco do Moreno 8 8 * Author URI: https://blocodomoreno.com.br … … 15 15 if ( ! defined( 'ABSPATH' ) ) exit; 16 16 17 define( 'STUDIO_LITE_VERSION', '1.0. 0' );17 define( 'STUDIO_LITE_VERSION', '1.0.1' ); 18 18 define( 'STUDIO_LITE_URL', plugin_dir_url( __FILE__ ) ); 19 19 define( 'STUDIO_LITE_PATH', plugin_dir_path( __FILE__ ) );
Note:
See TracChangeset
for help on using the changeset viewer.