services/pipewire: update volume props from device for device nodes

Yet another device node edge case. In addition to only writing via
a pw_device when present, now we only read from one as well.

This fixes missing state changes not conveyed by the pw_node.

Fixes #35
This commit is contained in:
outfoxxed 2025-06-19 05:12:24 -07:00
parent 579d589290
commit 95d0af8113
Signed by untrusted user: outfoxxed
GPG key ID: 4C88A185FB89301E
5 changed files with 61 additions and 19 deletions

View file

@ -219,22 +219,22 @@ class PwNodeAudioIface: public QObject {
// clang-format off
/// If the node is currently muted. Setting this property changes the mute state.
///
/// > [!WARNING] This property is invalid unless the node is [bound](../pwobjecttracker).
/// > [!WARNING] This property is invalid unless the node is bound using @@PwObjectTracker.
Q_PROPERTY(bool muted READ isMuted WRITE setMuted NOTIFY mutedChanged);
/// The average volume over all channels of the node.
/// Setting this property modifies the volume of all channels proportionately.
///
/// > [!WARNING] This property is invalid unless the node is [bound](../pwobjecttracker).
/// > [!WARNING] This property is invalid unless the node is bound using @@PwObjectTracker.
Q_PROPERTY(float volume READ averageVolume WRITE setAverageVolume NOTIFY volumesChanged);
/// The audio channels present on the node.
///
/// > [!WARNING] This property is invalid unless the node is [bound](../pwobjecttracker).
/// > [!WARNING] This property is invalid unless the node is bound using @@PwObjectTracker.
Q_PROPERTY(QVector<qs::service::pipewire::PwAudioChannel::Enum> channels READ channels NOTIFY channelsChanged);
/// The volumes of each audio channel individually. Each entry corrosponds to
/// the volume of the channel at the same index in @@channels. @@volumes and @@channels
/// will always be the same length.
///
/// > [!WARNING] This property is invalid unless the node is [bound](../pwobjecttracker).
/// > [!WARNING] This property is invalid unless the node is bound using @@PwObjectTracker.
Q_PROPERTY(QVector<float> volumes READ volumes WRITE setVolumes NOTIFY volumesChanged);
// clang-format on
QML_NAMED_ELEMENT(PwNodeAudio);
@ -300,7 +300,7 @@ class PwNodeIface: public PwObjectIface {
/// - `media.title` - The title of the currently playing media.
/// - `media.artist` - The artist of the currently playing media.
///
/// > [!WARNING] This property is invalid unless the node is [bound](../pwobjecttracker).
/// > [!WARNING] This property is invalid unless the node is bound using @@PwObjectTracker.
Q_PROPERTY(QVariantMap properties READ properties NOTIFY propertiesChanged);
/// Extra information present only if the node sends or receives audio.
///
@ -357,7 +357,7 @@ class PwLinkIface: public PwObjectIface {
Q_PROPERTY(qs::service::pipewire::PwNodeIface* source READ source CONSTANT);
/// The current state of the link.
///
/// > [!WARNING] This property is invalid unless the node is [bound](../pwobjecttracker).
/// > [!WARNING] This property is invalid unless the node is bound using @@PwObjectTracker.
Q_PROPERTY(PwLinkState::Enum state READ state NOTIFY stateChanged);
QML_NAMED_ELEMENT(PwLink);
QML_UNCREATABLE("PwLinks cannot be created directly");
@ -392,7 +392,7 @@ class PwLinkGroupIface
Q_PROPERTY(qs::service::pipewire::PwNodeIface* source READ source CONSTANT);
/// The current state of the link group.
///
/// > [!WARNING] This property is invalid unless the node is [bound](../pwobjecttracker).
/// > [!WARNING] This property is invalid unless the node is bound using @@PwObjectTracker.
Q_PROPERTY(qs::service::pipewire::PwLinkState::Enum state READ state NOTIFY stateChanged);
QML_NAMED_ELEMENT(PwLinkGroup);
QML_UNCREATABLE("PwLinkGroups cannot be created directly");