Web: sidebar playlists fixed for 1080p, side album art, vertical stem faders with live meters
- Nav scrolls, playlists section always gets room, boot race fixed (waits on connect) - Album art expands into the left sidebar (Feishin style), collapses on hover button - Mixer: tall vertical channel strips with per-stem peak meters (AnalyserNode, rAF, transform-only) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
115eb28bdf
commit
f624a9866a
5 files changed
+165
-100
No files matched your search
+18
-5
@@ -193,7 +193,7 @@ const Pre = {
|
||||
// ---- engine -----------------------------------------------------------------------------------
|
||||
|
||||
export const E = {
|
||||
els: [], names: [], gains: [], urls: [], ctx: null, master: null,
|
||||
els: [], names: [], gains: [], meters: [], urls: [], ctx: null, master: null, mbuf: new Float32Array(1024),
|
||||
want: false, stalled: false, loading: false, loadFrac: 0, pendingPos: 0,
|
||||
entry: null, offline: null, ctl: null, gen: 0,
|
||||
|
||||
@@ -262,13 +262,15 @@ export const E = {
|
||||
el.src = s.url;
|
||||
el.playbackRate = el.defaultPlaybackRate = S.speed;
|
||||
if (this.pendingPos) el.currentTime = this.pendingPos;
|
||||
let gain = null;
|
||||
let gain = null, meter = null;
|
||||
if (graph) {
|
||||
gain = this.ctx.createGain();
|
||||
this.ctx.createMediaElementSource(el).connect(gain).connect(this.master);
|
||||
meter = this.ctx.createAnalyser();
|
||||
meter.fftSize = 1024;
|
||||
this.ctx.createMediaElementSource(el).connect(meter).connect(gain).connect(this.master);
|
||||
}
|
||||
if (s.blob) this.urls.push(s.url);
|
||||
this.els.push(el); this.gains.push(gain); this.names.push(s.name);
|
||||
this.els.push(el); this.gains.push(gain); this.meters.push(meter); this.names.push(s.name);
|
||||
}
|
||||
this.graph = graph;
|
||||
const lead = this.els[0];
|
||||
@@ -284,10 +286,21 @@ export const E = {
|
||||
this.ctl?.abort(); this.ctl = null;
|
||||
for (const el of this.els) { el.pause(); el.removeAttribute("src"); el.load(); }
|
||||
for (const u of this.urls) URL.revokeObjectURL(u);
|
||||
this.els = []; this.names = []; this.gains = []; this.urls = [];
|
||||
this.els = []; this.names = []; this.gains = []; this.meters = []; this.urls = [];
|
||||
this.loading = false;
|
||||
},
|
||||
|
||||
// A stem's live peak before its fader, 0..1 over a 48 dB range (0 without Web Audio).
|
||||
meter(name) {
|
||||
const a = this.meters[this.names.indexOf(name)];
|
||||
if (!a) return 0;
|
||||
const b = this.mbuf;
|
||||
a.getFloatTimeDomainData(b);
|
||||
let p = 0;
|
||||
for (let i = 0; i < b.length; i++) { const v = b[i] < 0 ? -b[i] : b[i]; if (v > p) p = v; }
|
||||
return p < 0.004 ? 0 : Math.min(1, (20 * Math.log10(p) + 48) / 48);
|
||||
},
|
||||
|
||||
applyGains() {
|
||||
const named = this.names.filter(Boolean);
|
||||
this.els.forEach((el, i) => {
|
||||
|
||||
Reference in new issue
Block a user