broken: play dj outside, get it stuck
This commit is contained in:
parent
67626a34e4
commit
bea0a2af94
5 changed files with 58 additions and 12 deletions
|
|
@ -38,8 +38,16 @@ HRESULT EndpointCallback::QueryInterface(REFIID riid, VOID **ppvInterface) {
|
||||||
|
|
||||||
HRESULT EndpointCallback::OnNotify(PAUDIO_VOLUME_NOTIFICATION_DATA pNotify) {
|
HRESULT EndpointCallback::OnNotify(PAUDIO_VOLUME_NOTIFICATION_DATA pNotify) {
|
||||||
if (pNotify == NULL) return E_INVALIDARG;
|
if (pNotify == NULL) return E_INVALIDARG;
|
||||||
|
|
||||||
|
float extraChannelVol[pNotify->nChannels];
|
||||||
|
bool multiChannel = false;
|
||||||
AUDIO_VOLUME_NOTIFICATION_DATA eventData = *pNotify;
|
AUDIO_VOLUME_NOTIFICATION_DATA eventData = *pNotify;
|
||||||
|
if(pNotify->nChannels > 1) {
|
||||||
|
multiChannel = true;
|
||||||
|
for (UINT i = 0; i < pNotify->nChannels; i++){
|
||||||
|
extraChannelVol[i] = pNotify->afChannelVolumes[i];
|
||||||
|
}
|
||||||
|
}
|
||||||
NGuid* guid = osh->getGuid();
|
NGuid* guid = osh->getGuid();
|
||||||
|
|
||||||
if (memcmp(guid, &eventData, sizeof(*guid)) == 0) {
|
if (memcmp(guid, &eventData, sizeof(*guid)) == 0) {
|
||||||
|
|
@ -47,12 +55,18 @@ HRESULT EndpointCallback::OnNotify(PAUDIO_VOLUME_NOTIFICATION_DATA pNotify) {
|
||||||
} else {
|
} else {
|
||||||
log_debugcpp("Onnanokotify says Stored: " << guid->data1);
|
log_debugcpp("Onnanokotify says Stored: " << guid->data1);
|
||||||
log_debugcpp("Onnanokotify says Grace of God: " << eventData.guidEventContext.Data1);
|
log_debugcpp("Onnanokotify says Grace of God: " << eventData.guidEventContext.Data1);
|
||||||
|
osh->toggleFrontEvents(this->ep->getIndex(), false);
|
||||||
osh->updateMuteCallback(this->ep->getIndex(), eventData.bMuted);
|
osh->updateMuteCallback(this->ep->getIndex(), eventData.bMuted);
|
||||||
osh->updateMainVolumeCallback(this->ep->getIndex(), eventData.fMasterVolume);
|
osh->updateMainVolumeCallback(this->ep->getIndex(), eventData.fMasterVolume);
|
||||||
log_debugcpp("Onnanokotify says Reported Channel Qty: " << eventData.nChannels);
|
log_debugcpp("Onnanokotify says Reported Channel Qty: " << eventData.nChannels);
|
||||||
for(UINT i = 0; i < eventData.nChannels; i++) {
|
|
||||||
osh->updateChannelVolumeCallback(this->ep->getIndex(), (uint32_t)i, eventData.afChannelVolumes[i]);
|
if(multiChannel)
|
||||||
}
|
for(UINT i = 0; i < eventData.nChannels; i++) {
|
||||||
|
osh->updateChannelVolumeCallback(this->ep->getIndex(), (uint32_t)i, extraChannelVol[i]);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
osh->updateChannelVolumeCallback(this->ep->getIndex(), (uint32_t)0, pNotify->afChannelVolumes[0]);
|
||||||
|
osh->toggleFrontEvents(this->ep->getIndex(), true);
|
||||||
}
|
}
|
||||||
|
|
||||||
return S_OK;
|
return S_OK;
|
||||||
|
|
@ -130,10 +144,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 == ENDPOINT_MASTER_VOLUME) {
|
||||||
if(FAILED(endpointVolume->SetMasterVolumeLevelScalar(volume, &tempMsGuid))) { log_debugcpp("si"); };
|
if(FAILED(endpointVolume->SetMasterVolumeLevelScalar(volume, &tempMsGuid))) { log_debugcpp("MASTER VOLUME FAILED"); };
|
||||||
} else {
|
} else {
|
||||||
log_debugcpp("channel being updated: " << channel);
|
log_debugcpp("Channel being updated: " << channel);
|
||||||
if(FAILED(endpointVolume->SetChannelVolumeLevelScalar(channel, volume, &tempMsGuid))) { log_debugcpp("si"); };
|
if(FAILED(endpointVolume->SetChannelVolumeLevelScalar(channel, volume, &tempMsGuid))) { log_debugcpp("CHANNEL "<< channel <<" VOLUME FAILED"); };
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -144,7 +158,7 @@ void Endpoint::setMute(NGuid* guid, bool muted) {
|
||||||
//log_debugcpp("translate to BOOL as " << mut);
|
//log_debugcpp("translate to BOOL as " << mut);
|
||||||
//TODO: use new funcs
|
//TODO: use new funcs
|
||||||
GUID tempMsGuid = NGuidToGUID(guid);
|
GUID tempMsGuid = NGuidToGUID(guid);
|
||||||
if(FAILED(endpointVolume->SetMute(muted, &tempMsGuid))) { log_debugcpp("si"); };
|
if(FAILED(endpointVolume->SetMute(muted, &tempMsGuid))) { log_debugcpp("MUTE FAILED"); };
|
||||||
}
|
}
|
||||||
|
|
||||||
void Endpoint::setCallback(EndpointCallback *epc){
|
void Endpoint::setCallback(EndpointCallback *epc){
|
||||||
|
|
|
||||||
|
|
@ -100,7 +100,6 @@ void OverseerHandler::reloadEndpointHandlers(){
|
||||||
//setEndpointHandlers(ephs);
|
//setEndpointHandlers(ephs);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
NGuid* OverseerHandler::getGuid() {
|
NGuid* OverseerHandler::getGuid() {
|
||||||
return this->os.getGuid();
|
return this->os.getGuid();
|
||||||
}
|
}
|
||||||
|
|
@ -128,7 +127,16 @@ void OverseerHandler::updateMainVolumeCallback(uint64_t idx, float newVal){
|
||||||
|
|
||||||
void OverseerHandler::updateChannelVolumeCallback(uint64_t idx, uint32_t channel, float newVal){
|
void OverseerHandler::updateChannelVolumeCallback(uint64_t idx, uint32_t channel, float newVal){
|
||||||
//int translatedNewVal = newVal * 100;
|
//int translatedNewVal = newVal * 100;
|
||||||
|
|
||||||
log_debugcpp("chanel: " << channel << " volcallback float: " << newVal);
|
log_debugcpp("chanel: " << channel << " volcallback float: " << newVal);
|
||||||
epwChannelVolumeFunc f = &EndpointWidget::updateChannelVolume;
|
epwChannelVolumeFunc f = &EndpointWidget::updateChannelVolume;
|
||||||
std::invoke(f, endpointWidgets.at(idx), channel, newVal);
|
std::invoke(f, endpointWidgets.at(idx), channel, newVal);
|
||||||
|
|
||||||
|
//TODO: Soy retrasado
|
||||||
|
//endpointWidgets.at(idx)->updateChannelVolume(channel, newVal);
|
||||||
|
}
|
||||||
|
|
||||||
|
void OverseerHandler::toggleFrontEvents(uint64_t idx, bool active) {
|
||||||
|
epwToggleFrontFunc f = &EndpointWidget::toggleFrontEvents;
|
||||||
|
std::invoke(f, endpointWidgets.at(idx), active);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -40,6 +40,7 @@ public:
|
||||||
|
|
||||||
void setVolume(NGuid* guid, int channel, int value);
|
void setVolume(NGuid* guid, int channel, int value);
|
||||||
void setMute(NGuid* guid, bool muted);
|
void setMute(NGuid* guid, bool muted);
|
||||||
|
|
||||||
~EndpointHandler();
|
~EndpointHandler();
|
||||||
private:
|
private:
|
||||||
uint64_t idx;
|
uint64_t idx;
|
||||||
|
|
@ -65,7 +66,7 @@ public:
|
||||||
void updateMuteCallback(uint64_t idx, bool muted);
|
void updateMuteCallback(uint64_t idx, bool muted);
|
||||||
void updateMainVolumeCallback(uint64_t idx, float newVal);
|
void updateMainVolumeCallback(uint64_t idx, float newVal);
|
||||||
void updateChannelVolumeCallback(uint64_t idx, uint32_t channel, float newVal);
|
void updateChannelVolumeCallback(uint64_t idx, uint32_t channel, float newVal);
|
||||||
|
void toggleFrontEvents(uint64_t idx, bool active);
|
||||||
//void parseExternalEndpointCallback(EndpointCallback *epc, PAUDIO_VOLUME_NOTIFICATION_DATA pNotify);
|
//void parseExternalEndpointCallback(EndpointCallback *epc, PAUDIO_VOLUME_NOTIFICATION_DATA pNotify);
|
||||||
//static Overseer* getOverseer();
|
//static Overseer* getOverseer();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -73,9 +73,12 @@ EndpointWidget::EndpointWidget(EndpointHandler* eph, QWidget *parent) : QWidget(
|
||||||
|
|
||||||
void EndpointWidget::updateMute(bool muted){
|
void EndpointWidget::updateMute(bool muted){
|
||||||
log_debugcpp("cliqui callboqui cloqui");
|
log_debugcpp("cliqui callboqui cloqui");
|
||||||
|
//TODO: Here to diagnose slider visuals locking when playing DJ with external volume bar. Functionality is restored when mute checkbox is clicked.
|
||||||
|
//this->muteButton->blockSignals(true);
|
||||||
this->eph->setMute(osh->getGuid(), muted);
|
this->eph->setMute(osh->getGuid(), muted);
|
||||||
this->muteButton->setChecked(eph->getMute() ? true : false);
|
this->muteButton->setChecked(eph->getMute() ? true : false);
|
||||||
this->muteButton->setText(this->eph->getMute() ? STRING_UNMUTE : STRING_MUTE);
|
this->muteButton->setText(this->eph->getMute() ? STRING_UNMUTE : STRING_MUTE);
|
||||||
|
//this->muteButton->blockSignals(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
void EndpointWidget::updateMute(int checked){
|
void EndpointWidget::updateMute(int checked){
|
||||||
|
|
@ -88,25 +91,42 @@ void EndpointWidget::updateMute(int checked){
|
||||||
}
|
}
|
||||||
|
|
||||||
void EndpointWidget::updateMainVolume(int newValue){
|
void EndpointWidget::updateMainVolume(int newValue){
|
||||||
log_debugcpp("updateMainVolume slot");
|
log_debugcpp("updateMainVolume slot.");
|
||||||
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::updateMainVolume(float newValue){
|
||||||
int newVal = newValue * 100;
|
int newVal = newValue * 100;
|
||||||
|
log_debugcpp("mainvolcallback int: " << newVal);
|
||||||
|
//this->mainSlider->blockSignals(true);
|
||||||
|
//TODO: Above
|
||||||
if(this->mainSlider->value() != newVal) {
|
if(this->mainSlider->value() != newVal) {
|
||||||
this->mainSlider->setValue(newVal);
|
this->mainSlider->setValue(newVal);
|
||||||
}
|
}
|
||||||
|
//this->mainSlider->blockSignals(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
void EndpointWidget::updateChannelVolume(uint32_t channel, float newValue){
|
void EndpointWidget::updateChannelVolume(uint32_t channel, float newValue){
|
||||||
int newVal = newValue * 100;
|
int newVal = newValue * 100;
|
||||||
|
log_debugcpp("chanel: " << channel << " volcallback int: " << newVal);
|
||||||
|
//TODO: Above
|
||||||
|
//this->channelSliders.at(channel)->blockSignals(true);
|
||||||
if(this->channelSliders.at(channel)->value() != newVal) {
|
if(this->channelSliders.at(channel)->value() != newVal) {
|
||||||
this->channelSliders.at(channel)->setValue(newVal);
|
this->channelSliders.at(channel)->setValue(newVal);
|
||||||
this->channelLabels.at(channel)->setText(QString::number((int)(newValue * 100)));
|
this->channelLabels.at(channel)->setText(QString::number((int)(newValue * 100)));
|
||||||
}
|
}
|
||||||
|
//this->channelSliders.at(channel)->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){
|
void EndpointWidget::setIndex(uint64_t idx){
|
||||||
this->idx = idx;
|
this->idx = idx;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -71,6 +71,7 @@ public:
|
||||||
void updateMainVolume(float newValue);
|
void updateMainVolume(float newValue);
|
||||||
void updateChannelVolume(uint32_t channel, float newValue);
|
void updateChannelVolume(uint32_t channel, float newValue);
|
||||||
void updateMute(bool muted);
|
void updateMute(bool muted);
|
||||||
|
void toggleFrontEvents(bool active);
|
||||||
|
|
||||||
//void populateEndpointWidget(EndpointHandler *eph);
|
//void populateEndpointWidget(EndpointHandler *eph);
|
||||||
//void setEndpointHandlers(std::vector<EndpointHandler*> *ephs);
|
//void setEndpointHandlers(std::vector<EndpointHandler*> *ephs);
|
||||||
|
|
@ -93,6 +94,8 @@ private:
|
||||||
typedef void (EndpointWidget::*epwMuteFunc)(bool muted);
|
typedef void (EndpointWidget::*epwMuteFunc)(bool muted);
|
||||||
typedef void (EndpointWidget::*epwMainVolumeFunc)(float newValue);
|
typedef void (EndpointWidget::*epwMainVolumeFunc)(float newValue);
|
||||||
typedef void (EndpointWidget::*epwChannelVolumeFunc)(uint32_t channel, float newValue);
|
typedef void (EndpointWidget::*epwChannelVolumeFunc)(uint32_t channel, float newValue);
|
||||||
|
typedef void (EndpointWidget::*epwToggleFrontFunc)(bool active);
|
||||||
|
|
||||||
|
|
||||||
class MainWindow : public QMainWindow {
|
class MainWindow : public QMainWindow {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue