style: auto-fix linting issues
This commit is contained in:
parent
44e811f56d
commit
f892d80bf6
3 changed files with 78 additions and 38 deletions
29
index.html
29
index.html
|
|
@ -4262,13 +4262,12 @@
|
||||||
<b>Scroll on a node</b> to adjust Q (bandwidth).
|
<b>Scroll on a node</b> to adjust Q (bandwidth).
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<b>Right-click a node</b> to change its filter type
|
<b>Right-click a node</b> to change its filter type (Peaking, Low
|
||||||
(Peaking, Low Shelf, High Shelf) or channel mode
|
Shelf, High Shelf) or channel mode (Stereo, Mid, Side).
|
||||||
(Stereo, Mid, Side).
|
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<b>Right-click empty space</b> or <b>double-click</b> to add a
|
<b>Right-click empty space</b> or <b>double-click</b> to add a node.
|
||||||
node. <b>Double-click a node</b> to remove it.
|
<b>Double-click a node</b> to remove it.
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<b>Save</b> the profile so you can switch between headphones
|
<b>Save</b> the profile so you can switch between headphones
|
||||||
|
|
@ -4301,9 +4300,8 @@
|
||||||
channel mode to <b>Stereo</b>, <b>Mid</b>, or <b>Side</b>.
|
channel mode to <b>Stereo</b>, <b>Mid</b>, or <b>Side</b>.
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<b>Right-click empty space</b> or <b>double-click</b> to add a
|
<b>Right-click empty space</b> or <b>double-click</b> to add a node
|
||||||
node at that position.
|
at that position. <b>Double-click a node</b> to delete it.
|
||||||
<b>Double-click a node</b> to delete it.
|
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
Use <b>+ Add Band / - Remove Band</b> to change the number of
|
Use <b>+ Add Band / - Remove Band</b> to change the number of
|
||||||
|
|
@ -4322,12 +4320,11 @@
|
||||||
Tip: Lower Q = wider curve, higher Q = narrower surgical cut.
|
Tip: Lower Q = wider curve, higher Q = narrower surgical cut.
|
||||||
</p>
|
</p>
|
||||||
<p class="eq-howto-tip">
|
<p class="eq-howto-tip">
|
||||||
Mid/Side tips: Set a band to <b>Mid</b> to EQ only the
|
Mid/Side tips: Set a band to <b>Mid</b> to EQ only the center image
|
||||||
center image (vocals, bass, kick). Set it to <b>Side</b> to
|
(vocals, bass, kick). Set it to <b>Side</b> to EQ only the stereo width
|
||||||
EQ only the stereo width (reverb, ambience, panned instruments).
|
(reverb, ambience, panned instruments). Try cutting low-end on Side
|
||||||
Try cutting low-end on Side below 200 Hz for tighter, mono-compatible
|
below 200 Hz for tighter, mono-compatible bass - or boost presence on
|
||||||
bass - or boost presence on Mid around 2-5 kHz to bring vocals forward
|
Mid around 2-5 kHz to bring vocals forward without touching the sides.
|
||||||
without touching the sides.
|
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
@ -4360,8 +4357,8 @@
|
||||||
<b>Right-click a node</b> to change type or channel mode.
|
<b>Right-click a node</b> to change type or channel mode.
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<b>Right-click empty space</b> or <b>double-click</b> to add a
|
<b>Right-click empty space</b> or <b>double-click</b> to add a node.
|
||||||
node. <b>Double-click a node</b> to remove it.
|
<b>Double-click a node</b> to remove it.
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
Repeat for each channel, then <b>Export JSON</b> with all channels.
|
Repeat for each channel, then <b>Export JSON</b> with all channels.
|
||||||
|
|
|
||||||
|
|
@ -326,7 +326,7 @@ class AudioContextManager {
|
||||||
const type = (this.currentTypes && this.currentTypes[i]) || 'peaking';
|
const type = (this.currentTypes && this.currentTypes[i]) || 'peaking';
|
||||||
const q = this.currentQs && this.currentQs[i] > 0 ? this.currentQs[i] : this._calculateQ(i);
|
const q = this.currentQs && this.currentQs[i] > 0 ? this.currentQs[i] : this._calculateQ(i);
|
||||||
const ch = (this.currentChannels && this.currentChannels[i]) || 'stereo';
|
const ch = (this.currentChannels && this.currentChannels[i]) || 'stereo';
|
||||||
const gain = ch === 'side' ? 0 : (this.currentGains[i] || 0);
|
const gain = ch === 'side' ? 0 : this.currentGains[i] || 0;
|
||||||
const filter = this.audioContext.createBiquadFilter();
|
const filter = this.audioContext.createBiquadFilter();
|
||||||
filter.type = type;
|
filter.type = type;
|
||||||
filter.frequency.value = freq;
|
filter.frequency.value = freq;
|
||||||
|
|
@ -339,7 +339,7 @@ class AudioContextManager {
|
||||||
const type = (this.currentTypes && this.currentTypes[i]) || 'peaking';
|
const type = (this.currentTypes && this.currentTypes[i]) || 'peaking';
|
||||||
const q = this.currentQs && this.currentQs[i] > 0 ? this.currentQs[i] : this._calculateQ(i);
|
const q = this.currentQs && this.currentQs[i] > 0 ? this.currentQs[i] : this._calculateQ(i);
|
||||||
const ch = (this.currentChannels && this.currentChannels[i]) || 'stereo';
|
const ch = (this.currentChannels && this.currentChannels[i]) || 'stereo';
|
||||||
const gain = ch === 'mid' ? 0 : (this.currentGains[i] || 0);
|
const gain = ch === 'mid' ? 0 : this.currentGains[i] || 0;
|
||||||
const filter = this.audioContext.createBiquadFilter();
|
const filter = this.audioContext.createBiquadFilter();
|
||||||
filter.type = type;
|
filter.type = type;
|
||||||
filter.frequency.value = freq;
|
filter.frequency.value = freq;
|
||||||
|
|
@ -353,7 +353,13 @@ class AudioContextManager {
|
||||||
* Destroy M/S parallel filter chains
|
* Destroy M/S parallel filter chains
|
||||||
*/
|
*/
|
||||||
_destroyMSFilters() {
|
_destroyMSFilters() {
|
||||||
const sd = (node) => { try { node?.disconnect(); } catch { /* */ } };
|
const sd = (node) => {
|
||||||
|
try {
|
||||||
|
node?.disconnect();
|
||||||
|
} catch {
|
||||||
|
/* */
|
||||||
|
}
|
||||||
|
};
|
||||||
this.midFilters.forEach(sd);
|
this.midFilters.forEach(sd);
|
||||||
this.sideFilters.forEach(sd);
|
this.sideFilters.forEach(sd);
|
||||||
this.midFilters = [];
|
this.midFilters = [];
|
||||||
|
|
@ -660,15 +666,15 @@ class AudioContextManager {
|
||||||
// Encode L/R → M/S
|
// Encode L/R → M/S
|
||||||
lastNode.connect(this.msSplitter);
|
lastNode.connect(this.msSplitter);
|
||||||
|
|
||||||
this.msSplitter.connect(this.msEncoderMidL, 0); // L → Mid
|
this.msSplitter.connect(this.msEncoderMidL, 0); // L → Mid
|
||||||
this.msSplitter.connect(this.msEncoderMidR, 1); // R → Mid
|
this.msSplitter.connect(this.msEncoderMidR, 1); // R → Mid
|
||||||
this.msEncoderMidL.connect(this.msMidInput);
|
this.msEncoderMidL.connect(this.msMidInput);
|
||||||
this.msEncoderMidR.connect(this.msMidInput); // Mid = (L+R)*0.5
|
this.msEncoderMidR.connect(this.msMidInput); // Mid = (L+R)*0.5
|
||||||
|
|
||||||
this.msSplitter.connect(this.msEncoderSideL, 0); // L → Side
|
this.msSplitter.connect(this.msEncoderSideL, 0); // L → Side
|
||||||
this.msSplitter.connect(this.msEncoderSideR, 1); // R → Side (-0.5)
|
this.msSplitter.connect(this.msEncoderSideR, 1); // R → Side (-0.5)
|
||||||
this.msEncoderSideL.connect(this.msSideInput);
|
this.msEncoderSideL.connect(this.msSideInput);
|
||||||
this.msEncoderSideR.connect(this.msSideInput); // Side = (L-R)*0.5
|
this.msEncoderSideR.connect(this.msSideInput); // Side = (L-R)*0.5
|
||||||
|
|
||||||
// Mid filter chain
|
// Mid filter chain
|
||||||
this.msMidInput.connect(this.midFilters[0]);
|
this.msMidInput.connect(this.midFilters[0]);
|
||||||
|
|
@ -688,12 +694,12 @@ class AudioContextManager {
|
||||||
this.midOutputNode.connect(this.msDecoderMidToL);
|
this.midOutputNode.connect(this.msDecoderMidToL);
|
||||||
this.sideOutputNode.connect(this.msDecoderSideToL);
|
this.sideOutputNode.connect(this.msDecoderSideToL);
|
||||||
this.msDecoderMidToL.connect(this.msLMix);
|
this.msDecoderMidToL.connect(this.msLMix);
|
||||||
this.msDecoderSideToL.connect(this.msLMix); // L = Mid + Side
|
this.msDecoderSideToL.connect(this.msLMix); // L = Mid + Side
|
||||||
|
|
||||||
this.midOutputNode.connect(this.msDecoderMidToR);
|
this.midOutputNode.connect(this.msDecoderMidToR);
|
||||||
this.sideOutputNode.connect(this.msDecoderSideToR);
|
this.sideOutputNode.connect(this.msDecoderSideToR);
|
||||||
this.msDecoderMidToR.connect(this.msRMix);
|
this.msDecoderMidToR.connect(this.msRMix);
|
||||||
this.msDecoderSideToR.connect(this.msRMix); // R = Mid - Side
|
this.msDecoderSideToR.connect(this.msRMix); // R = Mid - Side
|
||||||
|
|
||||||
this.msLMix.connect(this.msMerger, 0, 0);
|
this.msLMix.connect(this.msMerger, 0, 0);
|
||||||
this.msRMix.connect(this.msMerger, 0, 1);
|
this.msRMix.connect(this.msMerger, 0, 1);
|
||||||
|
|
@ -1089,7 +1095,8 @@ class AudioContextManager {
|
||||||
this.msEnabled = needsMS;
|
this.msEnabled = needsMS;
|
||||||
|
|
||||||
if (this.isInitialized && this.audioContext) {
|
if (this.isInitialized && this.audioContext) {
|
||||||
const needsRebuild = msChanged || this.filters.length !== count || (needsMS && this.midFilters.length !== count);
|
const needsRebuild =
|
||||||
|
msChanged || this.filters.length !== count || (needsMS && this.midFilters.length !== count);
|
||||||
|
|
||||||
if (needsRebuild) {
|
if (needsRebuild) {
|
||||||
// M/S state changed or band count changed — full rebuild
|
// M/S state changed or band count changed — full rebuild
|
||||||
|
|
@ -1108,11 +1115,11 @@ class AudioContextManager {
|
||||||
this._updateFilterChain(this.filters, newFrequencies, newTypes, newQs, newGains, now);
|
this._updateFilterChain(this.filters, newFrequencies, newTypes, newQs, newGains, now);
|
||||||
|
|
||||||
// Update mid filters (gain = 0 for side-only bands)
|
// Update mid filters (gain = 0 for side-only bands)
|
||||||
const midGains = newGains.map((g, i) => newChannels[i] === 'side' ? 0 : g);
|
const midGains = newGains.map((g, i) => (newChannels[i] === 'side' ? 0 : g));
|
||||||
this._updateFilterChain(this.midFilters, newFrequencies, newTypes, newQs, midGains, now);
|
this._updateFilterChain(this.midFilters, newFrequencies, newTypes, newQs, midGains, now);
|
||||||
|
|
||||||
// Update side filters (gain = 0 for mid-only bands)
|
// Update side filters (gain = 0 for mid-only bands)
|
||||||
const sideGains = newGains.map((g, i) => newChannels[i] === 'mid' ? 0 : g);
|
const sideGains = newGains.map((g, i) => (newChannels[i] === 'mid' ? 0 : g));
|
||||||
this._updateFilterChain(this.sideFilters, newFrequencies, newTypes, newQs, sideGains, now);
|
this._updateFilterChain(this.sideFilters, newFrequencies, newTypes, newQs, sideGains, now);
|
||||||
} else if (this.filters.length === count) {
|
} else if (this.filters.length === count) {
|
||||||
// Normal stereo — update in-place
|
// Normal stereo — update in-place
|
||||||
|
|
|
||||||
|
|
@ -2561,7 +2561,12 @@ export async function initializeSettings(scrobbler, player, api, ui) {
|
||||||
const bands = getActiveBands();
|
const bands = getActiveBands();
|
||||||
|
|
||||||
// Filter type actions
|
// Filter type actions
|
||||||
if (action.startsWith('eq-type-') && contextMenuNodeIdx !== null && bands && bands[contextMenuNodeIdx]) {
|
if (
|
||||||
|
action.startsWith('eq-type-') &&
|
||||||
|
contextMenuNodeIdx !== null &&
|
||||||
|
bands &&
|
||||||
|
bands[contextMenuNodeIdx]
|
||||||
|
) {
|
||||||
const typeMap = {
|
const typeMap = {
|
||||||
'eq-type-lowshelf': 'lowshelf',
|
'eq-type-lowshelf': 'lowshelf',
|
||||||
'eq-type-peaking': 'peaking',
|
'eq-type-peaking': 'peaking',
|
||||||
|
|
@ -2578,7 +2583,12 @@ export async function initializeSettings(scrobbler, player, api, ui) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Channel actions (per-band M/S mode)
|
// Channel actions (per-band M/S mode)
|
||||||
if (action.startsWith('eq-channel-') && contextMenuNodeIdx !== null && bands && bands[contextMenuNodeIdx]) {
|
if (
|
||||||
|
action.startsWith('eq-channel-') &&
|
||||||
|
contextMenuNodeIdx !== null &&
|
||||||
|
bands &&
|
||||||
|
bands[contextMenuNodeIdx]
|
||||||
|
) {
|
||||||
const channelMap = {
|
const channelMap = {
|
||||||
'eq-channel-stereo': 'stereo',
|
'eq-channel-stereo': 'stereo',
|
||||||
'eq-channel-mid': 'mid',
|
'eq-channel-mid': 'mid',
|
||||||
|
|
@ -2627,12 +2637,21 @@ export async function initializeSettings(scrobbler, player, api, ui) {
|
||||||
if (currentMode === 'autoeq') {
|
if (currentMode === 'autoeq') {
|
||||||
autoeqCurrentBands = [];
|
autoeqCurrentBands = [];
|
||||||
bands = autoeqCurrentBands;
|
bands = autoeqCurrentBands;
|
||||||
} else { hideEmptyContextMenu(); return; }
|
} else {
|
||||||
|
hideEmptyContextMenu();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (bands.length >= 32) {
|
||||||
|
hideEmptyContextMenu();
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
if (bands.length >= 32) { hideEmptyContextMenu(); return; }
|
|
||||||
|
|
||||||
const rect = autoeqCanvas.getBoundingClientRect();
|
const rect = autoeqCanvas.getBoundingClientRect();
|
||||||
const padLeft = 40, padRight = 10, padTop = 10, padBottom = 30;
|
const padLeft = 40,
|
||||||
|
padRight = 10,
|
||||||
|
padTop = 10,
|
||||||
|
padBottom = 30;
|
||||||
const w = rect.width - padLeft - padRight;
|
const w = rect.width - padLeft - padRight;
|
||||||
const h = rect.height - padTop - padBottom;
|
const h = rect.height - padTop - padBottom;
|
||||||
const dbCenter = isParam ? 0 : 75;
|
const dbCenter = isParam ? 0 : 75;
|
||||||
|
|
@ -2640,9 +2659,10 @@ export async function initializeSettings(scrobbler, player, api, ui) {
|
||||||
const dbMin = dbCenter - dbHalf;
|
const dbMin = dbCenter - dbHalf;
|
||||||
const dbMax = dbCenter + dbHalf;
|
const dbMax = dbCenter + dbHalf;
|
||||||
const freq = Math.max(20, Math.min(20000, Math.round(xToFreq(pendingAddCoords.x - padLeft, w))));
|
const freq = Math.max(20, Math.min(20000, Math.round(xToFreq(pendingAddCoords.x - padLeft, w))));
|
||||||
const gain = Math.max(-30, Math.min(30,
|
const gain = Math.max(
|
||||||
Math.round((yToDb(pendingAddCoords.y - padTop, h, dbMin, dbMax) - dbCenter) * 10) / 10
|
-30,
|
||||||
));
|
Math.min(30, Math.round((yToDb(pendingAddCoords.y - padTop, h, dbMin, dbMax) - dbCenter) * 10) / 10)
|
||||||
|
);
|
||||||
|
|
||||||
bands.push({ id: bands.length, type: 'peaking', freq, gain, q: 1.0, enabled: true, channel: 'stereo' });
|
bands.push({ id: bands.length, type: 'peaking', freq, gain, q: 1.0, enabled: true, channel: 'stereo' });
|
||||||
setActiveBands(bands);
|
setActiveBands(bands);
|
||||||
|
|
@ -2984,7 +3004,15 @@ export async function initializeSettings(scrobbler, player, api, ui) {
|
||||||
const defaultBands = [];
|
const defaultBands = [];
|
||||||
for (let i = 0; i < 10; i++) {
|
for (let i = 0; i < 10; i++) {
|
||||||
const freq = 20 * Math.pow(20000 / 20, i / 9);
|
const freq = 20 * Math.pow(20000 / 20, i / 9);
|
||||||
defaultBands.push({ id: i, type: 'peaking', freq: Math.round(freq), gain: 0, q: 1.0, enabled: true, channel: 'stereo' });
|
defaultBands.push({
|
||||||
|
id: i,
|
||||||
|
type: 'peaking',
|
||||||
|
freq: Math.round(freq),
|
||||||
|
gain: 0,
|
||||||
|
q: 1.0,
|
||||||
|
enabled: true,
|
||||||
|
channel: 'stereo',
|
||||||
|
});
|
||||||
}
|
}
|
||||||
parametricBands = defaultBands;
|
parametricBands = defaultBands;
|
||||||
applyBandsToAudio(parametricBands);
|
applyBandsToAudio(parametricBands);
|
||||||
|
|
@ -5295,7 +5323,15 @@ export async function initializeSettings(scrobbler, player, api, ui) {
|
||||||
setActiveBands(bands);
|
setActiveBands(bands);
|
||||||
}
|
}
|
||||||
if (bands.length >= 32) return;
|
if (bands.length >= 32) return;
|
||||||
bands.push({ id: bands.length, type: 'peaking', freq: 1000, gain: 0, q: 1.0, enabled: true, channel: 'stereo' });
|
bands.push({
|
||||||
|
id: bands.length,
|
||||||
|
type: 'peaking',
|
||||||
|
freq: 1000,
|
||||||
|
gain: 0,
|
||||||
|
q: 1.0,
|
||||||
|
enabled: true,
|
||||||
|
channel: 'stereo',
|
||||||
|
});
|
||||||
applyBandsToAudio(bands);
|
applyBandsToAudio(bands);
|
||||||
renderBandControls(bands);
|
renderBandControls(bands);
|
||||||
computeCorrectedCurve();
|
computeCorrectedCurve();
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue