Correctly update channel sliders

This commit is contained in:
Phireh 2023-08-14 22:18:24 +02:00 committed by Hane
commit c4b1c4b796
2 changed files with 16 additions and 14 deletions

View file

@ -128,7 +128,8 @@ void OverseerHandler::updateChannelVolumeCallback(uint64_t idx, uint32_t channel
// convert channel to bitmask
int i = 0;
while (i++);
while (i < channel)
i++;
uint32_t mask = (1 << i);
updateFrontVolumeCallback(idx, mask, newVal);

View file

@ -108,23 +108,24 @@ void EndpointWidget::updateMainVolume(float newValue){
void EndpointWidget::updateChannelVolume(uint32_t channel, float newValue){
this->blockSignals(true);
if (channel == (uint32_t)AudioChannel::CHANNEL_MAIN) {
if (channel == (uint32_t)AudioChannel::CHANNEL_MAIN)
updateMainVolume(newValue);
} else {
int newVal = newValue * 100;
log_debugcpp("chanel: " << channel << " volcallback int: " << newVal);
//TODO: Above
//this->channelSliders.at(channel)->blockSignals(true);
for (size_t i = 0; i < sizeof(uint32_t) * 8; ++i) {
if ((channel << i & 1) && this->channelSliders.at(channel)->value() != newVal) {
this->channelSliders.at(channel)->setValue(newVal);
this->channelLabels.at(channel)->setText(QString::number((int)(newValue * 100)));
}
for (size_t i = 0; i < sizeof(uint32_t) * 8 && i < channelSliders.size(); ++i) {
if (((channel >> i) & 1) && this->channelSliders.at(i)->value() != newVal) {
this->channelSliders.at(i)->blockSignals(true);
this->channelSliders.at(i)->setValue(newVal);
this->channelLabels.at(i)->setText(QString::number((int)(newValue * 100)));
this->channelSliders.at(i)->blockSignals(false);
}
}
this->blockSignals(false);
//this->channelSliders.at(channel)->blockSignals(false);
}
void EndpointWidget::toggleFrontEvents(bool active){