forked from Shinonome/dots-hyprland
media controls: improve dupe entry filtering, correct cava config
This commit is contained in:
@@ -54,7 +54,7 @@ Scope {
|
||||
for (let j = i + 1; j < players.length; ++j) {
|
||||
let p2 = players[j];
|
||||
if (p1.trackTitle && p2.trackTitle &&
|
||||
(p1.trackTitle.startsWith(p2.trackTitle) || p2.trackTitle.startsWith(p1.trackTitle))) {
|
||||
(p1.trackTitle.includes(p2.trackTitle) || p2.trackTitle.includes(p1.trackTitle))) {
|
||||
group.push(j);
|
||||
}
|
||||
}
|
||||
@@ -81,8 +81,7 @@ Scope {
|
||||
stdout: SplitParser {
|
||||
onRead: data => {
|
||||
// Parse `;`-separated values into the visualizerPoints array
|
||||
let allPoints = data.split(";").map(p => parseFloat(p.trim())).filter(p => !isNaN(p));
|
||||
let points = allPoints.slice(Math.floor(allPoints.length / 2), allPoints.length);
|
||||
let points = data.split(";").map(p => parseFloat(p.trim())).filter(p => !isNaN(p));
|
||||
root.visualizerPoints = points;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -27,6 +27,7 @@ Item { // Player instance
|
||||
property bool downloaded: false
|
||||
property list<real> visualizerPoints: []
|
||||
property real maxVisualizerValue: 1000 // Max value in the data points
|
||||
property int visualizerSmoothing: 2 // Number of points to average for smoothing
|
||||
|
||||
implicitWidth: widgetWidth
|
||||
implicitHeight: widgetHeight
|
||||
@@ -168,7 +169,7 @@ Item { // Player instance
|
||||
|
||||
// Smoothing: simple moving average (optional)
|
||||
var smoothPoints = [];
|
||||
var smoothWindow = 3; // adjust for more/less smoothing
|
||||
var smoothWindow = playerController.visualizerSmoothing; // adjust for more/less smoothing
|
||||
for (var i = 0; i < n; ++i) {
|
||||
var sum = 0, count = 0;
|
||||
for (var j = -smoothWindow; j <= smoothWindow; ++j) {
|
||||
@@ -178,6 +179,7 @@ Item { // Player instance
|
||||
}
|
||||
smoothPoints.push(sum / count);
|
||||
}
|
||||
if (!playerController.player?.isPlaying) smoothedPoints.fill(0); // If not playing, show no points
|
||||
|
||||
ctx.beginPath();
|
||||
ctx.moveTo(0, h);
|
||||
@@ -193,7 +195,7 @@ Item { // Player instance
|
||||
blendedColors.colPrimary.r,
|
||||
blendedColors.colPrimary.g,
|
||||
blendedColors.colPrimary.b,
|
||||
0.25
|
||||
0.15
|
||||
);
|
||||
ctx.fill();
|
||||
}
|
||||
@@ -205,15 +207,14 @@ Item { // Player instance
|
||||
}
|
||||
|
||||
layer.enabled: true
|
||||
layer.effect: MultiEffect { // Blur a tiny bit to obscure away the points
|
||||
layer.effect: MultiEffect { // Blur a bit to obscure away the points
|
||||
source: visualizerCanvas
|
||||
saturation: 0.2
|
||||
blurEnabled: true
|
||||
blurMax: 6
|
||||
blurMax: 7
|
||||
blur: 1
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
RowLayout {
|
||||
anchors.fill: parent
|
||||
|
||||
@@ -2,13 +2,16 @@
|
||||
mode = waves
|
||||
framerate = 60
|
||||
autosens = 1
|
||||
bars = 60
|
||||
bars = 50
|
||||
|
||||
[output]
|
||||
method = raw
|
||||
raw_target = /dev/stdout
|
||||
data_format = ascii
|
||||
channels = mono
|
||||
mono_option = average
|
||||
|
||||
[smoothing]
|
||||
noise_reduction = 20
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user