broken: play dj outside, get it stuck

This commit is contained in:
Hane 2023-08-14 16:10:35 +02:00
commit e30ed58c08
5 changed files with 58 additions and 12 deletions

View file

@ -38,8 +38,16 @@ HRESULT EndpointCallback::QueryInterface(REFIID riid, VOID **ppvInterface) {
HRESULT EndpointCallback::OnNotify(PAUDIO_VOLUME_NOTIFICATION_DATA pNotify) {
if (pNotify == NULL) return E_INVALIDARG;
float extraChannelVol[pNotify->nChannels];
bool multiChannel = false;
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();
if (memcmp(guid, &eventData, sizeof(*guid)) == 0) {
@ -47,12 +55,18 @@ HRESULT EndpointCallback::OnNotify(PAUDIO_VOLUME_NOTIFICATION_DATA pNotify) {
} else {
log_debugcpp("Onnanokotify says Stored: " << guid->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->updateMainVolumeCallback(this->ep->getIndex(), eventData.fMasterVolume);
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;
@ -130,10 +144,10 @@ bool Endpoint::getMute(){
void Endpoint::setVolume(NGuid* guid, int channel, float volume) {
GUID tempMsGuid = NGuidToGUID(guid);
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 {
log_debugcpp("channel being updated: " << channel);
if(FAILED(endpointVolume->SetChannelVolumeLevelScalar(channel, volume, &tempMsGuid))) { log_debugcpp("si"); };
log_debugcpp("Channel being updated: " << channel);
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);
//TODO: use new funcs
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){