polling data source vector'd and moved to eph

This commit is contained in:
Hane 2023-08-22 18:28:09 +02:00
commit 7bc65a13b0
4 changed files with 41 additions and 53 deletions

View file

@ -38,17 +38,21 @@ HRESULT EndpointCallback::QueryInterface(REFIID riid, VOID **ppvInterface) {
HRESULT EndpointCallback::OnNotify(PAUDIO_VOLUME_NOTIFICATION_DATA pNotify) {
if (pNotify == NULL) return E_INVALIDARG;
memcpy(osh->callbackInfo[this->ep->getIndex()]->caller, &pNotify->guidEventContext,sizeof(NGuid) );
osh->callbackInfo[this->ep->getIndex()]->muted = pNotify->bMuted;
osh->callbackInfo[this->ep->getIndex()]->mainVolume = pNotify->fMasterVolume;
osh->callbackInfo[this->ep->getIndex()]->channels = pNotify->nChannels;
//TODO: MEMORY LEAK. FREE DATA4 FROM NGUID.
//TODO: el default = objcopy frees?
//delete osh->getEndpointHandlers().at(this->ep->getIndex())->getCallbackInfo()->caller;
memcpy(osh->getEndpointHandlers().at(this->ep->getIndex())->getCallbackInfo()->caller, &pNotify->guidEventContext,sizeof(NGuid) );
osh->getEndpointHandlers().at(this->ep->getIndex())->getCallbackInfo()->muted = pNotify->bMuted;
osh->getEndpointHandlers().at(this->ep->getIndex())->getCallbackInfo()->mainVolume = pNotify->fMasterVolume;
osh->getEndpointHandlers().at(this->ep->getIndex())->getCallbackInfo()->channels = pNotify->nChannels;
UINT i = 0;
do {
osh->callbackInfo[this->ep->getIndex()]->channelVolumes[i] = pNotify->afChannelVolumes[i];
osh->getEndpointHandlers().at(this->ep->getIndex())->getCallbackInfo()->channelVolumes[i] = pNotify->afChannelVolumes[i];
} while(i++ < pNotify->nChannels);
return S_OK;
}