more code cleanup; changed define for channel enum
This commit is contained in:
parent
831dceb89a
commit
03e726f3e6
4 changed files with 20 additions and 24 deletions
|
|
@ -141,10 +141,10 @@ bool Endpoint::getMute(){
|
||||||
|
|
||||||
void Endpoint::setVolume(NGuid* guid, int channel, float volume) {
|
void Endpoint::setVolume(NGuid* guid, int channel, float volume) {
|
||||||
GUID tempMsGuid = NGuidToGUID(guid);
|
GUID tempMsGuid = NGuidToGUID(guid);
|
||||||
if (channel == ENDPOINT_MASTER_VOLUME) {
|
if (channel == AudioChannel::CHANNEL_MAIN) {
|
||||||
if(FAILED(endpointVolume->SetMasterVolumeLevelScalar(volume, &tempMsGuid))) { log_debugcpp("MASTER VOLUME FAILED"); };
|
if(FAILED(endpointVolume->SetMasterVolumeLevelScalar(volume, &tempMsGuid))) { log_debugcpp("MASTER VOLUME FAILED"); };
|
||||||
} else {
|
} else {
|
||||||
log_debugcpp("Channel being updated: " << channel);
|
log_debugcpp("Windows: Channel being updated: " << channel);
|
||||||
if(FAILED(endpointVolume->SetChannelVolumeLevelScalar(channel, volume, &tempMsGuid))) { log_debugcpp("CHANNEL "<< channel <<" VOLUME FAILED"); };
|
if(FAILED(endpointVolume->SetChannelVolumeLevelScalar(channel, volume, &tempMsGuid))) { log_debugcpp("CHANNEL "<< channel <<" VOLUME FAILED"); };
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -119,19 +119,20 @@ void OverseerHandler::updateMuteCallback(uint64_t idx, bool muted){
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void OverseerHandler::updateVolumeCallback(uint64_t idx, uint32_t channel, float newVal){
|
void OverseerHandler::updateVolumeCallback(uint64_t idx, uint32_t channel, float newVal){
|
||||||
if (channel == AudioChannel::CHANNEL_MAIN) {
|
if (channel == (uint32_t)AudioChannel::CHANNEL_MAIN) {
|
||||||
log_debugcpp("mainvolcallback float: " << newVal);
|
log_debugcpp("mainvolcallback float: " << newVal);
|
||||||
updateFrontVolumeCallback(idx, AudioChannel::CHANNEL_MAIN, newVal);
|
updateFrontVolumeCallback(idx, AudioChannel::CHANNEL_MAIN, newVal);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
log_debugcpp("channel: " << channel << " volcallback float: " << newVal);
|
|
||||||
|
|
||||||
// convert channel to bitmask
|
// convert channel to bitmask
|
||||||
uint32_t i = 0;
|
uint32_t i = 0;
|
||||||
while (i < channel)
|
while (i < channel)
|
||||||
i++;
|
i++;
|
||||||
uint32_t mask = (1 << i);
|
uint32_t mask = (1 << i);
|
||||||
|
|
||||||
|
log_debugcpp("Back->Cont Channel: " << mask << " volcallback float: " << newVal);
|
||||||
|
|
||||||
updateFrontVolumeCallback(idx, mask, newVal);
|
updateFrontVolumeCallback(idx, mask, newVal);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -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.
|
//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->blockSignals(true);
|
||||||
//this->muteButton->blockSignals(true);
|
//this->muteButton->blockSignals(true);
|
||||||
|
|
||||||
//this->eph->setMute(osh->getGuid(), muted);
|
//this->eph->setMute(osh->getGuid(), muted);
|
||||||
this->muteButton->setChecked(muted);
|
this->muteButton->setChecked(muted);
|
||||||
this->muteButton->setText(this->eph->getMute() ? STRING_UNMUTE : STRING_MUTE);
|
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);
|
this->eph->setVolume(osh->getGuid(), ENDPOINT_MASTER_VOLUME, newValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
void EndpointWidget::updateMainVolume(float newValue){
|
void EndpointWidget::updateVolume(uint32_t channel, 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){
|
|
||||||
//this->blockSignals(true);
|
//this->blockSignals(true);
|
||||||
if (channel == (uint32_t)AudioChannel::CHANNEL_MAIN)
|
|
||||||
updateMainVolume(newValue);
|
|
||||||
|
|
||||||
int newVal = newValue * 100;
|
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) {
|
for (size_t i = 0; i < sizeof(uint32_t) * 8 && i < channelSliders.size(); ++i) {
|
||||||
if (((channel >> i) & 1) && this->channelSliders.at(i)->value() != newVal) {
|
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) {
|
osh->setFrontVolumeCallback([this](uint64_t device, uint32_t channel, float value) {
|
||||||
if (device < ews.size())
|
if (device < ews.size())
|
||||||
ews[device]->updateChannelVolume(channel, value);
|
ews[device]->updateVolume(channel, value);
|
||||||
});
|
});
|
||||||
osh->setFrontMuteCallback([this](uint64_t device, bool muted) {
|
osh->setFrontMuteCallback([this](uint64_t device, bool muted) {
|
||||||
if (device < ews.size())
|
if (device < ews.size())
|
||||||
|
|
|
||||||
|
|
@ -68,8 +68,8 @@ public:
|
||||||
std::vector<QLabel*> channelLabels;
|
std::vector<QLabel*> channelLabels;
|
||||||
QGridLayout *layout = nullptr;
|
QGridLayout *layout = nullptr;
|
||||||
QGridLayout *mainMuteLayout = nullptr;
|
QGridLayout *mainMuteLayout = nullptr;
|
||||||
void updateMainVolume(float newValue);
|
//void updateMainVolume(float newValue);
|
||||||
void updateChannelVolume(uint32_t channel, float newValue);
|
void updateVolume(uint32_t channel, float newValue);
|
||||||
void updateMute(bool muted);
|
void updateMute(bool muted);
|
||||||
//void toggleFrontEvents(bool active);
|
//void toggleFrontEvents(bool active);
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue