Skip to content

Commit 0fcaa49

Browse files
committed
Revert "fix(media): gate spectrum pipeline on playback to cut idle CPU"
This reverts commit a0093e5.
1 parent 087f753 commit 0fcaa49

8 files changed

Lines changed: 19 additions & 25 deletions

File tree

Modules/Bar/Widgets/AudioVisualizer.qml

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -45,27 +45,21 @@ Item {
4545

4646
readonly property bool shouldShow: (currentVisualizerType !== "" && currentVisualizerType !== "none") && (!hideWhenIdle || MediaService.isPlaying)
4747

48-
readonly property bool needsSpectrum: root.shouldShow && MediaService.isPlaying
49-
5048
// Register/unregister with SpectrumService based on visibility (use screenName — screen can be null after DPMS/output changes)
5149
readonly property string spectrumComponentId: "bar:audiovisualizer:" + screenName + ":" + root.section + ":" + root.sectionWidgetIndex
5250

53-
onNeedsSpectrumChanged: {
54-
if (root.needsSpectrum) {
51+
onShouldShowChanged: {
52+
if (root.shouldShow) {
5553
SpectrumService.registerComponent(root.spectrumComponentId);
5654
} else {
5755
SpectrumService.unregisterComponent(root.spectrumComponentId);
5856
}
5957
}
6058

61-
Component.onCompleted: {
62-
if (root.needsSpectrum) {
63-
SpectrumService.registerComponent(root.spectrumComponentId);
64-
}
65-
}
66-
6759
Component.onDestruction: {
68-
SpectrumService.unregisterComponent(root.spectrumComponentId);
60+
if (root.shouldShow) {
61+
SpectrumService.unregisterComponent(root.spectrumComponentId);
62+
}
6963
}
7064

7165
// Content dimensions for implicit sizing
@@ -110,7 +104,7 @@ Item {
110104
id: visualizerLoader
111105
anchors.fill: parent
112106
anchors.margins: Style.marginS
113-
active: root.needsSpectrum
107+
active: shouldShow
114108
asynchronous: true
115109

116110
sourceComponent: {

Modules/Bar/Widgets/MediaMini.qml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ Item {
7575

7676
// SpectrumService registration for visualizer
7777
readonly property string spectrumComponentId: "bar:mediamini:" + root.screen?.name + ":" + root.section + ":" + root.sectionWidgetIndex
78-
readonly property bool needsSpectrum: root.showVisualizer && root.visualizerType !== "" && root.visualizerType !== "none" && !root.isHidden && MediaService.isPlaying
78+
readonly property bool needsSpectrum: root.showVisualizer && root.visualizerType !== "" && root.visualizerType !== "none" && !root.isHidden
7979

8080
Layout.preferredHeight: isVertical ? -1 : Style.getBarHeightForScreen(screenName)
8181
Layout.preferredWidth: isVertical ? Style.getBarHeightForScreen(screenName) : -1
@@ -265,10 +265,10 @@ Item {
265265
y: Style.pixelAlignCenter(parent.height, height)
266266
width: Style.toOdd(parent.width)
267267
height: Style.toOdd(parent.height)
268-
active: root.needsSpectrum
268+
active: showVisualizer
269269
z: 0
270270
sourceComponent: {
271-
if (!root.needsSpectrum)
271+
if (!showVisualizer)
272272
return null;
273273
if (visualizerType === "linear")
274274
return linearSpectrum;

Modules/Cards/MediaCard.qml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ NBox {
1616
readonly property bool hasActivePlayer: MediaService.currentPlayer && MediaService.canPlay
1717

1818
// SpectrumService registration for visualizer
19-
readonly property bool needsSpectrum: Settings.data.audio.visualizerType !== "" && Settings.data.audio.visualizerType !== "none" && MediaService.isPlaying
19+
readonly property bool needsSpectrum: Settings.data.audio.visualizerType !== "" && Settings.data.audio.visualizerType !== "none"
2020

2121
onNeedsSpectrumChanged: {
2222
if (root.needsSpectrum) {
@@ -138,7 +138,7 @@ NBox {
138138
// Background visualizer on top of the artwork
139139
Loader {
140140
anchors.fill: parent
141-
active: root.needsSpectrum
141+
active: Settings.data.audio.visualizerType !== "" && Settings.data.audio.visualizerType !== "none"
142142

143143
sourceComponent: {
144144
switch (Settings.data.audio.visualizerType) {

Modules/DesktopWidgets/Widgets/DesktopAudioVisualizer.qml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ DraggableDesktopWidget {
2525

2626
readonly property bool shouldShow: visualizerType !== "" && visualizerType !== "none" && (!hideWhenIdle || MediaService.isPlaying)
2727
readonly property bool isHidden: !shouldShow
28-
readonly property bool shouldRegisterSpectrum: shouldShow && MediaService.isPlaying
28+
readonly property bool shouldRegisterSpectrum: shouldShow
2929

3030
// Keep widget visible in edit mode so users can move/configure it
3131
visible: !root.isHidden || DesktopWidgetRegistry.editMode
@@ -66,7 +66,7 @@ DraggableDesktopWidget {
6666
id: visualizerLoader
6767
anchors.fill: parent
6868
anchors.margins: root.showBackground ? Math.round(Style.marginXS * root.widgetScale) : 0
69-
active: root.shouldRegisterSpectrum
69+
active: root.shouldShow
7070
asynchronous: true
7171

7272
sourceComponent: {

Modules/DesktopWidgets/Widgets/DesktopMediaPlayer.qml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ DraggableDesktopWidget {
3434

3535
// SpectrumService registration for visualizer
3636
readonly property string spectrumComponentId: "desktopmediaplayer:" + (root.screen ? root.screen.name : "unknown")
37-
readonly property bool needsSpectrum: root.shouldShowVisualizer && !root.isHidden && root.isPlaying
37+
readonly property bool needsSpectrum: root.shouldShowVisualizer && !root.isHidden
3838

3939
onNeedsSpectrumChanged: {
4040
if (root.needsSpectrum) {

Modules/LockScreen/LockScreen.qml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ Loader {
1717
active: false
1818

1919
// Track if the visualizer should be shown (lockscreen active + media playing + non-compact mode)
20-
readonly property bool needsSpectrum: root.active && !Settings.data.general.compactLockScreen && Settings.data.audio.visualizerType !== "" && Settings.data.audio.visualizerType !== "none" && MediaService.isPlaying
20+
readonly property bool needsSpectrum: root.active && !Settings.data.general.compactLockScreen && Settings.data.audio.visualizerType !== "" && Settings.data.audio.visualizerType !== "none"
2121

2222
onActiveChanged: {
2323
if (root.active && root.needsSpectrum) {

Modules/LockScreen/LockScreenPanel.qml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,7 @@ Item {
264264
Loader {
265265
anchors.fill: parent
266266
anchors.margins: 4
267-
active: Settings.data.audio.visualizerType === "linear" && MediaService.isPlaying
267+
active: Settings.data.audio.visualizerType === "linear"
268268
z: 0
269269
sourceComponent: NLinearSpectrum {
270270
anchors.fill: parent
@@ -278,7 +278,7 @@ Item {
278278
Loader {
279279
anchors.fill: parent
280280
anchors.margins: 4
281-
active: Settings.data.audio.visualizerType === "mirrored" && MediaService.isPlaying
281+
active: Settings.data.audio.visualizerType === "mirrored"
282282
z: 0
283283
sourceComponent: NMirroredSpectrum {
284284
anchors.fill: parent
@@ -292,7 +292,7 @@ Item {
292292
Loader {
293293
anchors.fill: parent
294294
anchors.margins: 4
295-
active: Settings.data.audio.visualizerType === "wave" && MediaService.isPlaying
295+
active: Settings.data.audio.visualizerType === "wave"
296296
z: 0
297297
sourceComponent: NWaveSpectrum {
298298
anchors.fill: parent

Modules/Panels/Media/MediaPlayerPanel.qml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ SmartPanel {
5050

5151
readonly property bool isSideBySide: root.compactMode && root.showAlbumArt
5252

53-
readonly property bool needsSpectrum: root.showVisualizer && root.visualizerType !== "" && root.visualizerType !== "none" && root.isPanelOpen && MediaService.isPlaying
53+
readonly property bool needsSpectrum: root.showVisualizer && root.visualizerType !== "" && root.visualizerType !== "none" && root.isPanelOpen
5454

5555
onNeedsSpectrumChanged: {
5656
if (root.needsSpectrum) {

0 commit comments

Comments
 (0)