vsink volume works

This commit is contained in:
Joey Yakimowich-Payne 2026-01-31 08:07:33 -07:00
commit 10fe7103da
4 changed files with 247 additions and 20 deletions

View file

@ -627,6 +627,38 @@ void WarpGraphModel::refreshFromClient() {
}
}
for (const auto &[pwId, qtId] : m_pwToQt) {
auto volResult = m_client->GetNodeVolume(warppipe::NodeId{pwId});
if (!volResult.ok()) continue;
float vol = volResult.value.volume;
bool mute = volResult.value.mute;
int sliderVal = static_cast<int>(std::round(vol * 100.0f));
sliderVal = std::clamp(sliderVal, 0, 150);
auto stateIt = m_volumeStates.find(qtId);
if (stateIt == m_volumeStates.end()) continue;
NodeVolumeState &cached = stateIt->second;
bool changed = (std::abs(cached.volume - vol) > 1e-4f) || (cached.mute != mute);
if (!changed) continue;
NodeVolumeState previous = cached;
cached.volume = vol;
cached.mute = mute;
auto wIt = m_volumeWidgets.find(qtId);
if (wIt != m_volumeWidgets.end()) {
auto *vw = static_cast<NodeVolumeWidget *>(wIt->second);
if (!vw->isSliderDown()) {
vw->setVolume(sliderVal);
vw->setMuted(mute);
}
}
Q_EMIT nodeVolumeChanged(qtId, previous, cached);
}
m_refreshing = false;
}