more code cleanup; changed define for channel enum

This commit is contained in:
Hane 2023-08-15 18:06:55 +02:00
commit 966cf91a23
4 changed files with 20 additions and 24 deletions

View file

@ -76,6 +76,7 @@ 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);
@ -97,26 +98,20 @@ void EndpointWidget::updateMainVolume(int newValue){
this->eph->setVolume(osh->getGuid(), ENDPOINT_MASTER_VOLUME, newValue);
}
void EndpointWidget::updateMainVolume(float newValue){
//this->blockSignals(true);
int newVal = newValue * 100;
log_debugcpp("mainvolcallback int: " << newVal);
//this->mainSlider->blockSignals(true);
if(this->mainSlider->value() != newVal) {
this->mainSlider->setValue(newVal);
}
//this->mainSlider->blockSignals(false);
//this->blockSignals(false);
}
void EndpointWidget::updateChannelVolume(uint32_t channel, float newValue){
void EndpointWidget::updateVolume(uint32_t channel, float newValue){
//this->blockSignals(true);
if (channel == (uint32_t)AudioChannel::CHANNEL_MAIN)
updateMainVolume(newValue);
int newVal = newValue * 100;
log_debugcpp("chanel: " << channel << " volcallback int: " << newVal);
if (channel == (uint32_t)AudioChannel::CHANNEL_MAIN) {
log_debugcpp("mainvolcallback int: " << newVal);
//this->mainSlider->blockSignals(true);
if(this->mainSlider->value() != newVal) {
this->mainSlider->setValue(newVal);
}
return;
}
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) {
@ -179,7 +174,7 @@ void MainWindow::reloadEndpointWidgets() {
osh->setFrontVolumeCallback([this](uint64_t device, uint32_t channel, float value) {
if (device < ews.size())
ews[device]->updateChannelVolume(channel, value);
ews[device]->updateVolume(channel, value);
});
osh->setFrontMuteCallback([this](uint64_t device, bool muted) {
if (device < ews.size())