fixed back->front channel bar desync
This commit is contained in:
parent
d024179011
commit
a6eb546e6d
4 changed files with 22 additions and 12 deletions
|
|
@ -39,9 +39,9 @@ EndpointWidget::EndpointWidget(uint64_t idx, EndpointHandler* eph, QWidget *pare
|
|||
osh->callbackInfo[idx]->muted = eph->getMute();
|
||||
muteButton->setCheckState((eph->getMute() == false ? Qt::Unchecked : Qt::Checked));
|
||||
muteButton->setText(eph->getMute() ? STRING_UNMUTE : STRING_MUTE);
|
||||
float volume = eph->getVolume(ENDPOINT_MASTER_VOLUME) * 100;
|
||||
float volume = eph->getVolume(AudioChannel::CHANNEL_MAIN) * 100;
|
||||
//TODO: APARTE
|
||||
osh->callbackInfo[idx]->mainVolume = eph->getVolume(ENDPOINT_MASTER_VOLUME);
|
||||
osh->callbackInfo[idx]->mainVolume = eph->getVolume(AudioChannel::CHANNEL_MAIN);
|
||||
mainSlider->setValue((int)volume);
|
||||
log_debugcpp("ENDPOINT SET WITH VOLUME " << volume);
|
||||
|
||||
|
|
@ -75,21 +75,30 @@ EndpointWidget::EndpointWidget(uint64_t idx, EndpointHandler* eph, QWidget *pare
|
|||
this->channelLabels.push_back(tmpLb);
|
||||
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)); });
|
||||
//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)); });
|
||||
|
||||
}
|
||||
|
||||
QTimer *timer = new QTimer(this);
|
||||
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->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);
|
||||
for(uint32_t i = 0; i < osh->callbackInfo[idx]->channels; i++){
|
||||
this->channelSliders.at(i)->setValue((int)(osh->callbackInfo[idx]->channelVolumes[i] * 100));
|
||||
this->channelLabels.at(i)->setText(QString::number((int)(osh->callbackInfo[idx]->channelVolumes[i] * 100)));
|
||||
this->channelSliders.at(i)->blockSignals(true);
|
||||
this->channelSliders.at(i)->setValue((int)(osh->callbackInfo[idx]->channelVolumes[i] * 100));
|
||||
this->channelLabels.at(i)->setText(QString::number((int)(osh->callbackInfo[idx]->channelVolumes[i] * 100)));
|
||||
this->channelSliders.at(i)->blockSignals(false);
|
||||
}
|
||||
//memcpy(osh->callbackInfo[idx]->caller, osh->getGuid(), sizeof(NGuid));
|
||||
*osh->callbackInfo[idx]->caller = *osh->getGuid();
|
||||
mainSlider->blockSignals(false);
|
||||
muteButton->blockSignals(false);
|
||||
});
|
||||
timer->start(10);
|
||||
|
||||
|
|
@ -117,7 +126,7 @@ void EndpointWidget::updateMute(int checked){
|
|||
}
|
||||
|
||||
void EndpointWidget::updateMainVolume(int newValue){
|
||||
this->eph->setVolume(osh->getGuid(), ENDPOINT_MASTER_VOLUME, newValue);
|
||||
this->eph->setVolume(osh->getGuid(), AudioChannel::CHANNEL_MAIN, newValue);
|
||||
}
|
||||
|
||||
void EndpointWidget::updateVolume(uint32_t channel, float newValue){
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue