Mixer
This commit is contained in:
parent
f57d39af48
commit
debc7f1853
5 changed files with 276 additions and 7 deletions
|
|
@ -830,6 +830,45 @@ void PipeWireGraphModel::applyVolumeStates(const QHash<QString, NodeVolumeState>
|
|||
}
|
||||
}
|
||||
|
||||
void PipeWireGraphModel::setNodeVolumeState(uint32_t nodeId, const NodeVolumeState &state)
|
||||
{
|
||||
m_nodeVolumeState.insert(nodeId, state);
|
||||
|
||||
auto nodeIt = m_pwToNode.find(nodeId);
|
||||
if (nodeIt == m_pwToNode.end()) {
|
||||
return;
|
||||
}
|
||||
auto widgetIt = m_nodeWidgets.find(nodeIt->second);
|
||||
if (widgetIt == m_nodeWidgets.end()) {
|
||||
return;
|
||||
}
|
||||
|
||||
QWidget *widget = widgetIt->second;
|
||||
if (!widget) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (auto *slider = widget->findChild<QSlider*>()) {
|
||||
slider->blockSignals(true);
|
||||
slider->setValue(static_cast<int>(state.volume * 100.0f));
|
||||
slider->blockSignals(false);
|
||||
}
|
||||
if (auto *button = widget->findChild<QToolButton*>()) {
|
||||
button->blockSignals(true);
|
||||
button->setChecked(state.mute);
|
||||
button->blockSignals(false);
|
||||
}
|
||||
}
|
||||
|
||||
bool PipeWireGraphModel::nodeVolumeState(uint32_t nodeId, NodeVolumeState &state) const
|
||||
{
|
||||
if (!m_nodeVolumeState.contains(nodeId)) {
|
||||
return false;
|
||||
}
|
||||
state = m_nodeVolumeState.value(nodeId);
|
||||
return true;
|
||||
}
|
||||
|
||||
void PipeWireGraphModel::saveLayout() const
|
||||
{
|
||||
const QString path = layoutFilePath();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue