full functionality restored, slight cleanup
This commit is contained in:
parent
d1f0bcaf26
commit
1797b39b30
5 changed files with 27 additions and 150 deletions
|
|
@ -52,11 +52,10 @@ EndpointWidget::EndpointWidget(uint64_t idx, EndpointHandler* eph, QWidget *pare
|
|||
layout->addWidget(mainSlider, 0, 1);
|
||||
|
||||
|
||||
/*
|
||||
* connect<void(QSlider::*)(int), void(EndpointWidget::*)(int)>(mainSlider, &QSlider::valueChanged, this,&EndpointWidget::updateMainVolume);
|
||||
*/
|
||||
/* connect<void(QCheckBox::*)(int), void(EndpointWidget::*)(int)>(muteButton, &QCheckBox::stateChanged, this, (&EndpointWidget::updateMute));
|
||||
*/
|
||||
|
||||
connect<void(QSlider::*)(int), void(EndpointWidget::*)(int)>(mainSlider, &QSlider::valueChanged, this,&EndpointWidget::updateMainVolume);
|
||||
connect<void(QCheckBox::*)(int), void(EndpointWidget::*)(int)>(muteButton, &QCheckBox::stateChanged, this, (&EndpointWidget::updateMute));
|
||||
|
||||
//TODO: APARTE
|
||||
osh->callbackInfo[idx]->channels = eph->getChannelCount();
|
||||
osh->callbackInfo[idx]->channelVolumes = (float*)calloc(osh->callbackInfo[idx]->channels, sizeof(float));
|
||||
|
|
@ -77,13 +76,13 @@ EndpointWidget::EndpointWidget(uint64_t idx, EndpointHandler* eph, QWidget *pare
|
|||
layout->addWidget(tmp, 1, 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
|
||||
/*
|
||||
* 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)); });
|
||||
|
||||
}
|
||||
|
||||
QTimer *timer = new QTimer(this);
|
||||
connect(timer, &QTimer::timeout, [this, idx](){
|
||||
if (memcmp(osh->callbackInfo[idx]->caller, osh->getGuid(), sizeof(NGuid)) == 0) return;
|
||||
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);
|
||||
|
|
@ -100,8 +99,6 @@ EndpointWidget::EndpointWidget(uint64_t idx, EndpointHandler* eph, QWidget *pare
|
|||
}
|
||||
|
||||
void EndpointWidget::updateMute(bool muted){
|
||||
//TODO: mutex test
|
||||
//log_debugcpp("cliqui callboqui cloqui");
|
||||
//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);
|
||||
|
|
@ -114,17 +111,12 @@ void EndpointWidget::updateMute(bool muted){
|
|||
}
|
||||
|
||||
void EndpointWidget::updateMute(int checked){
|
||||
log_debugcpp("cliqui slOtty cloqui");
|
||||
bool muted = (checked == 2 ? true : false);
|
||||
log_debugcpp("int: " << checked << " bool: " << muted);
|
||||
this->eph->setMute(osh->getGuid(), muted);
|
||||
//this->muteButton->setCheckState();
|
||||
this->muteButton->setText(this->eph->getMute() ? STRING_UNMUTE : STRING_MUTE);
|
||||
}
|
||||
|
||||
void EndpointWidget::updateMainVolume(int newValue){
|
||||
//TODO: mutex test
|
||||
//log_debugcpp("updateMainVolume slot.");
|
||||
this->eph->setVolume(osh->getGuid(), ENDPOINT_MASTER_VOLUME, newValue);
|
||||
}
|
||||
|
||||
|
|
@ -132,8 +124,7 @@ void EndpointWidget::updateVolume(uint32_t channel, float newValue){
|
|||
//this->blockSignals(true);
|
||||
int newVal = newValue * 100;
|
||||
if (channel == (uint32_t)AudioChannel::CHANNEL_MAIN) {
|
||||
//TODO: mutex test
|
||||
//log_debugcpp("mainvolcallback int: " << newVal);
|
||||
//TIP: Above
|
||||
//this->mainSlider->blockSignals(true);
|
||||
|
||||
if(this->mainSlider->value() != newVal) {
|
||||
|
|
@ -143,8 +134,6 @@ void EndpointWidget::updateVolume(uint32_t channel, float newValue){
|
|||
}
|
||||
return;
|
||||
}
|
||||
//TODO: mutex test
|
||||
//log_debugcpp("Cont->Front Channel:: " << channel << " volcallback int: " << newVal);
|
||||
|
||||
for (size_t i = 0; i < sizeof(uint32_t) * 8 && i < channelSliders.size(); ++i) {
|
||||
if (((channel >> i) & 1) && this->channelSliders.at(i)->value() != newVal) {
|
||||
|
|
@ -160,17 +149,6 @@ void EndpointWidget::updateVolume(uint32_t channel, float newValue){
|
|||
//this->blockSignals(false);
|
||||
}
|
||||
|
||||
/*
|
||||
* void EndpointWidget::toggleFrontEvents(bool active){
|
||||
* this->muteButton->blockSignals(active);
|
||||
* this->mainSlider->blockSignals(active);
|
||||
* for(uint32_t i = 0; i < this->channelSliders.size(); i++){
|
||||
* this->channelSliders.at(i)->blockSignals(active);
|
||||
* }
|
||||
* }
|
||||
*/
|
||||
|
||||
|
||||
void EndpointWidget::setIndex(uint64_t idx){
|
||||
this->idx = idx;
|
||||
}
|
||||
|
|
@ -217,14 +195,16 @@ void MainWindow::reloadEndpointWidgets() {
|
|||
|
||||
layout->addItem(new QSpacerItem(1, 1, QSizePolicy::Minimum, QSizePolicy::MinimumExpanding), i, 0);
|
||||
|
||||
osh->setFrontVolumeCallback([this](uint64_t device, uint32_t channel, float value) {
|
||||
if (device < ews.size())
|
||||
ews.at(device)->updateVolume(channel, value);
|
||||
});
|
||||
osh->setFrontMuteCallback([this](uint64_t device, bool muted) {
|
||||
if (device < ews.size())
|
||||
ews.at(device)->updateMute(muted);
|
||||
});
|
||||
/*
|
||||
* osh->setFrontVolumeCallback([this](uint64_t device, uint32_t channel, float value) {
|
||||
* if (device < ews.size())
|
||||
* ews.at(device)->updateVolume(channel, value);
|
||||
* });
|
||||
* osh->setFrontMuteCallback([this](uint64_t device, bool muted) {
|
||||
* if (device < ews.size())
|
||||
* ews.at(device)->updateMute(muted);
|
||||
* });
|
||||
*/
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue