diff --git a/Modules/Audio/LinearSpectrum.qml b/Modules/Audio/LinearSpectrum.qml index 11f2488..bb1600d 100644 --- a/Modules/Audio/LinearSpectrum.qml +++ b/Modules/Audio/LinearSpectrum.qml @@ -24,12 +24,6 @@ Item { height: root.height * amp x: index * xScale y: root.height - height - - Behavior on height { - SmoothedAnimation { - duration: 33 - } - } } } @@ -47,12 +41,6 @@ Item { height: root.height * amp x: (values.length + index) * xScale y: root.height - height - - Behavior on height { - SmoothedAnimation { - duration: 33 - } - } } } } diff --git a/Services/Cava.qml b/Services/Cava.qml index 5b5728c..3a5626f 100644 --- a/Services/Cava.qml +++ b/Services/Cava.qml @@ -13,7 +13,7 @@ Singleton { property var config: ({ "general": { "bars": barsCount, - "framerate": 40, + "framerate": 60, "autosens": 0, "overshoot": 0, "sensitivity": 200, @@ -26,7 +26,8 @@ Singleton { }, "output": { "method": "raw", - "data_format": "binary", + "data_format": "ascii", + "ascii_max_range": 100, "bit_format": "8bit", "channels": "mono", "mono_option": "average" @@ -35,17 +36,14 @@ Singleton { Process { id: process - property int fillIndex: 0 stdinEnabled: true running: MediaPlayer.isPlaying command: ["cava", "-p", "/dev/stdin"] onExited: { stdinEnabled = true - fillIndex = 0 values = Array(barsCount).fill(0) } onStarted: { - for (const k in config) { if (typeof config[k] !== "object") { write(k + "=" + config[k] + "\n") @@ -58,25 +56,11 @@ Singleton { } } stdinEnabled = false - fillIndex = 0 values = Array(barsCount).fill(0) } stdout: SplitParser { - splitMarker: "" onRead: data => { - if (process.fillIndex + data.length >= barsCount) { - process.fillIndex = 0 - } - - // copy array - var newValues = values.slice(0) - - for (var i = 0; i < data.length; i++) { - var amp = Math.min(data.charCodeAt(i), 128) / 128 - newValues[process.fillIndex] = amp - process.fillIndex = (process.fillIndex + 1) % barsCount - } - values = newValues + root.values = data.slice(0, -1).split(";").map(v => parseInt(v, 10) / 100) } } }