code cleanup, ready to debug
This commit is contained in:
parent
b15e5d6df7
commit
1a9f141087
2 changed files with 53 additions and 47 deletions
|
|
@ -77,15 +77,17 @@ EndpointWidget::EndpointWidget(uint64_t idx, EndpointHandler* eph, QWidget *pare
|
||||||
layout->addWidget(tmpLb, 2, i);
|
layout->addWidget(tmpLb, 2, i);
|
||||||
//TODO: check if there's a need to prevent deadlocks; probably this will eventually turn into its own func
|
//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.
|
//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);
|
timer = new QTimer(this);
|
||||||
connect(timer, &QTimer::timeout, [this, idx](){
|
connect(timer, &QTimer::timeout, [this, idx](){
|
||||||
if (memcmp(osh->callbackInfo[idx]->caller, osh->getGuid(), sizeof(NGuid)) == 0) return;
|
if (memcmp(osh->callbackInfo[idx]->caller, osh->getGuid(), sizeof(NGuid)) == 0) return;
|
||||||
mainSlider->blockSignals(true);
|
//mainSlider->blockSignals(true);
|
||||||
muteButton->blockSignals(true);
|
//muteButton->blockSignals(true);
|
||||||
mainSlider->setValue((int)(osh->callbackInfo[idx]->mainVolume * 100));
|
mainSlider->setValue((int)(osh->callbackInfo[idx]->mainVolume * 100));
|
||||||
muteButton->setCheckState((osh->callbackInfo[idx]->muted == false ? Qt::Unchecked : Qt::Checked));
|
muteButton->setCheckState((osh->callbackInfo[idx]->muted == false ? Qt::Unchecked : Qt::Checked));
|
||||||
muteButton->setText(osh->callbackInfo[idx]->muted ? STRING_UNMUTE : STRING_MUTE);
|
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));
|
//memcpy(osh->callbackInfo[idx]->caller, osh->getGuid(), sizeof(NGuid));
|
||||||
*osh->callbackInfo[idx]->caller = *osh->getGuid();
|
*osh->callbackInfo[idx]->caller = *osh->getGuid();
|
||||||
mainSlider->blockSignals(false);
|
//mainSlider->blockSignals(false);
|
||||||
muteButton->blockSignals(false);
|
//muteButton->blockSignals(false);
|
||||||
});
|
});
|
||||||
timer->start(10);
|
timer->start(10);
|
||||||
|
|
||||||
|
|
@ -107,17 +109,19 @@ EndpointWidget::EndpointWidget(uint64_t idx, EndpointHandler* eph, QWidget *pare
|
||||||
log_debugcpp("ENDPOINT_WIDGETED");
|
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.
|
* void EndpointWidget::updateMute(bool muted){
|
||||||
//this->blockSignals(true);
|
* //TIP: Blocksignals here to diagnose slider visuals locking when playing DJ with external volume bar. Functionality is restored when mute checkbox is clicked.
|
||||||
this->muteButton->blockSignals(true);
|
* //this->blockSignals(true);
|
||||||
|
* this->muteButton->blockSignals(true);
|
||||||
//this->eph->setMute(osh->getGuid(), muted);
|
*
|
||||||
this->muteButton->setChecked(muted);
|
* //this->eph->setMute(osh->getGuid(), muted);
|
||||||
this->muteButton->setText(this->eph->getMute() ? STRING_UNMUTE : STRING_MUTE);
|
* this->muteButton->setChecked(muted);
|
||||||
this->muteButton->blockSignals(false);
|
* this->muteButton->setText(this->eph->getMute() ? STRING_UNMUTE : STRING_MUTE);
|
||||||
//this->blockSignals(false);
|
* this->muteButton->blockSignals(false);
|
||||||
}
|
* //this->blockSignals(false);
|
||||||
|
* }
|
||||||
|
*/
|
||||||
|
|
||||||
void EndpointWidget::updateMute(int checked){
|
void EndpointWidget::updateMute(int checked){
|
||||||
bool muted = (checked == 2 ? true : false);
|
bool muted = (checked == 2 ? true : false);
|
||||||
|
|
@ -129,34 +133,36 @@ void EndpointWidget::updateMainVolume(int newValue){
|
||||||
this->eph->setVolume(osh->getGuid(), AudioChannel::CHANNEL_MAIN, newValue);
|
this->eph->setVolume(osh->getGuid(), AudioChannel::CHANNEL_MAIN, newValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
void EndpointWidget::updateVolume(uint32_t channel, float newValue){
|
/*
|
||||||
//this->blockSignals(true);
|
* void EndpointWidget::updateVolume(uint32_t channel, float newValue){
|
||||||
int newVal = newValue * 100;
|
* //this->blockSignals(true);
|
||||||
if (channel == (uint32_t)AudioChannel::CHANNEL_MAIN) {
|
* int newVal = newValue * 100;
|
||||||
//TIP: Above
|
* if (channel == (uint32_t)AudioChannel::CHANNEL_MAIN) {
|
||||||
//this->mainSlider->blockSignals(true);
|
* //TIP: Above
|
||||||
|
* //this->mainSlider->blockSignals(true);
|
||||||
if(this->mainSlider->value() != newVal) {
|
*
|
||||||
this->mainSlider->blockSignals(true);
|
* if(this->mainSlider->value() != newVal) {
|
||||||
this->mainSlider->setValue(newVal);
|
* this->mainSlider->blockSignals(true);
|
||||||
this->mainSlider->blockSignals(false);
|
* this->mainSlider->setValue(newVal);
|
||||||
}
|
* this->mainSlider->blockSignals(false);
|
||||||
return;
|
* }
|
||||||
}
|
* 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) {
|
* for (size_t i = 0; i < sizeof(uint32_t) * 8 && i < channelSliders.size(); ++i) {
|
||||||
//this->channelSliders.at(i)->blockSignals(true);
|
* 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)->setValue(newVal);
|
||||||
|
* this->channelLabels.at(i)->setText(QString::number((int)(newValue * 100)));
|
||||||
//this->channelSliders.at(i)->blockSignals(false);
|
*
|
||||||
}
|
* //this->channelSliders.at(i)->blockSignals(false);
|
||||||
}
|
* }
|
||||||
|
* }
|
||||||
//this->blockSignals(false);
|
*
|
||||||
}
|
* //this->blockSignals(false);
|
||||||
|
* }
|
||||||
|
*/
|
||||||
|
|
||||||
void EndpointWidget::setIndex(uint64_t idx){
|
void EndpointWidget::setIndex(uint64_t idx){
|
||||||
this->idx = idx;
|
this->idx = idx;
|
||||||
|
|
|
||||||
|
|
@ -70,8 +70,8 @@ public:
|
||||||
QGridLayout *layout = nullptr;
|
QGridLayout *layout = nullptr;
|
||||||
QGridLayout *mainMuteLayout = nullptr;
|
QGridLayout *mainMuteLayout = nullptr;
|
||||||
//void updateMainVolume(float newValue);
|
//void updateMainVolume(float newValue);
|
||||||
void updateVolume(uint32_t channel, float newValue);
|
//void updateVolume(uint32_t channel, float newValue);
|
||||||
void updateMute(bool muted);
|
//void updateMute(bool muted);
|
||||||
|
|
||||||
//void populateEndpointWidget(EndpointHandler *eph);
|
//void populateEndpointWidget(EndpointHandler *eph);
|
||||||
//void setEndpointHandlers(std::vector<EndpointHandler*> *ephs);
|
//void setEndpointHandlers(std::vector<EndpointHandler*> *ephs);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue