diff --git a/src/qt/qtclasses.cpp b/src/qt/qtclasses.cpp index 583d767..a6bf603 100644 --- a/src/qt/qtclasses.cpp +++ b/src/qt/qtclasses.cpp @@ -77,15 +77,17 @@ EndpointWidget::EndpointWidget(uint64_t idx, EndpointHandler* eph, QWidget *pare layout->addWidget(tmpLb, 2, i); //TODO: check if there's a need to prevent deadlocks; probably this will eventually turn into its own func //this causes channel bar desync when back -> front. blocksignals below fix it. huh. - connect(tmp, &QSlider::valueChanged, [this, i](int newValue){ this->eph->setVolume(osh->getGuid(), i, newValue); this->channelLabels.at(i)->setText(QString::number(newValue)); }); - + connect(tmp, &QSlider::valueChanged, [this, i](int newValue){ + this->eph->setVolume(osh->getGuid(), i, newValue); + this->channelLabels.at(i)->setText(QString::number(newValue)); + }); } timer = new QTimer(this); connect(timer, &QTimer::timeout, [this, idx](){ if (memcmp(osh->callbackInfo[idx]->caller, osh->getGuid(), sizeof(NGuid)) == 0) return; - mainSlider->blockSignals(true); - muteButton->blockSignals(true); + //mainSlider->blockSignals(true); + //muteButton->blockSignals(true); mainSlider->setValue((int)(osh->callbackInfo[idx]->mainVolume * 100)); muteButton->setCheckState((osh->callbackInfo[idx]->muted == false ? Qt::Unchecked : Qt::Checked)); muteButton->setText(osh->callbackInfo[idx]->muted ? STRING_UNMUTE : STRING_MUTE); @@ -97,8 +99,8 @@ EndpointWidget::EndpointWidget(uint64_t idx, EndpointHandler* eph, QWidget *pare } //memcpy(osh->callbackInfo[idx]->caller, osh->getGuid(), sizeof(NGuid)); *osh->callbackInfo[idx]->caller = *osh->getGuid(); - mainSlider->blockSignals(false); - muteButton->blockSignals(false); + //mainSlider->blockSignals(false); + //muteButton->blockSignals(false); }); timer->start(10); @@ -107,17 +109,19 @@ EndpointWidget::EndpointWidget(uint64_t idx, EndpointHandler* eph, QWidget *pare log_debugcpp("ENDPOINT_WIDGETED"); } -void EndpointWidget::updateMute(bool muted){ - //TIP: Blocksignals here to diagnose slider visuals locking when playing DJ with external volume bar. Functionality is restored when mute checkbox is clicked. - //this->blockSignals(true); - this->muteButton->blockSignals(true); - - //this->eph->setMute(osh->getGuid(), muted); - this->muteButton->setChecked(muted); - this->muteButton->setText(this->eph->getMute() ? STRING_UNMUTE : STRING_MUTE); - this->muteButton->blockSignals(false); - //this->blockSignals(false); -} +/* + * void EndpointWidget::updateMute(bool muted){ + * //TIP: Blocksignals here to diagnose slider visuals locking when playing DJ with external volume bar. Functionality is restored when mute checkbox is clicked. + * //this->blockSignals(true); + * this->muteButton->blockSignals(true); + * + * //this->eph->setMute(osh->getGuid(), muted); + * this->muteButton->setChecked(muted); + * this->muteButton->setText(this->eph->getMute() ? STRING_UNMUTE : STRING_MUTE); + * this->muteButton->blockSignals(false); + * //this->blockSignals(false); + * } + */ void EndpointWidget::updateMute(int checked){ bool muted = (checked == 2 ? true : false); @@ -129,34 +133,36 @@ void EndpointWidget::updateMainVolume(int newValue){ this->eph->setVolume(osh->getGuid(), AudioChannel::CHANNEL_MAIN, newValue); } -void EndpointWidget::updateVolume(uint32_t channel, float newValue){ - //this->blockSignals(true); - int newVal = newValue * 100; - if (channel == (uint32_t)AudioChannel::CHANNEL_MAIN) { - //TIP: Above - //this->mainSlider->blockSignals(true); - - if(this->mainSlider->value() != newVal) { - this->mainSlider->blockSignals(true); - this->mainSlider->setValue(newVal); - this->mainSlider->blockSignals(false); - } - return; - } - - 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); -} +/* + * void EndpointWidget::updateVolume(uint32_t channel, float newValue){ + * //this->blockSignals(true); + * int newVal = newValue * 100; + * if (channel == (uint32_t)AudioChannel::CHANNEL_MAIN) { + * //TIP: Above + * //this->mainSlider->blockSignals(true); + * + * if(this->mainSlider->value() != newVal) { + * this->mainSlider->blockSignals(true); + * this->mainSlider->setValue(newVal); + * this->mainSlider->blockSignals(false); + * } + * return; + * } + * + * 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); + * } + */ void EndpointWidget::setIndex(uint64_t idx){ this->idx = idx; diff --git a/src/qt/qtclasses.h b/src/qt/qtclasses.h index 53434b5..3011021 100644 --- a/src/qt/qtclasses.h +++ b/src/qt/qtclasses.h @@ -70,8 +70,8 @@ public: QGridLayout *layout = nullptr; QGridLayout *mainMuteLayout = nullptr; //void updateMainVolume(float newValue); - void updateVolume(uint32_t channel, float newValue); - void updateMute(bool muted); + //void updateVolume(uint32_t channel, float newValue); + //void updateMute(bool muted); //void populateEndpointWidget(EndpointHandler *eph); //void setEndpointHandlers(std::vector *ephs);