code cleanup; channels callback coalesced again

This commit is contained in:
Hane 2023-08-15 17:03:23 +02:00
commit 729f01a189
6 changed files with 58 additions and 55 deletions

View file

@ -6,8 +6,8 @@
Overseer OverseerHandler::os;
EndpointHandler::EndpointHandler(uint64_t idx) {
std::vector<Endpoint*> endpoints = osh->getPlaybackEndpoints();
this->ep = endpoints.at(idx);
//std::vector<Endpoint*> endpoints = osh->getPlaybackEndpoints().at(idx);
this->ep = osh->getPlaybackEndpoints().at(idx);
epc = new EndpointCallback(ep);
//epName = ep->getName();
ep->setCallback(epc);
@ -25,7 +25,6 @@ uint64_t EndpointHandler::getIndex(){
return idx;
}
/*
* -1 for master volume
*/
@ -101,20 +100,6 @@ void OverseerHandler::setEndpointHandlers(std::vector<EndpointHandler*> ephs){
this->endpointHandlers = ephs;
}
void OverseerHandler::setEndpointWidgets(std::vector<EndpointWidget*> ews){
this->endpointWidgets = ews;
}
void OverseerHandler::updateMuteCallback(uint64_t idx, bool muted){
updateFrontMuteCallback(idx, muted);
}
void OverseerHandler::updateMainVolumeCallback(uint64_t idx, float newVal){
log_debugcpp("mainvolcallback float: " << newVal);
updateFrontVolumeCallback(idx, AudioChannel::CHANNEL_MAIN, newVal);
}
void OverseerHandler::setFrontVolumeCallback(std::function<void(uint64_t, uint32_t, float)> f) {
this->updateFrontVolumeCallback = f;
}
@ -123,11 +108,27 @@ void OverseerHandler::setFrontMuteCallback(std::function<void(uint64_t, bool)> f
this->updateFrontMuteCallback = f;
}
void OverseerHandler::updateChannelVolumeCallback(uint64_t idx, uint32_t channel, float newVal){
void OverseerHandler::updateMuteCallback(uint64_t idx, bool muted){
updateFrontMuteCallback(idx, muted);
}
/*
* void OverseerHandler::updateMainVolumeCallback(uint64_t idx, float newVal){
*
* }
*/
void OverseerHandler::updateVolumeCallback(uint64_t idx, uint32_t channel, float newVal){
if (channel == AudioChannel::CHANNEL_MAIN) {
log_debugcpp("mainvolcallback float: " << newVal);
updateFrontVolumeCallback(idx, AudioChannel::CHANNEL_MAIN, newVal);
return;
}
log_debugcpp("channel: " << channel << " volcallback float: " << newVal);
// convert channel to bitmask
int i = 0;
uint32_t i = 0;
while (i < channel)
i++;
uint32_t mask = (1 << i);