wip partial refactor
This commit is contained in:
parent
ad34a38f38
commit
bc82ec72ed
7 changed files with 114 additions and 53 deletions
|
|
@ -1,5 +1,9 @@
|
|||
#include <backlasses.h>
|
||||
|
||||
EndpointCallback::EndpointCallback(Endpoint* ep){
|
||||
this.ep = ep;
|
||||
}
|
||||
|
||||
ULONG EndpointCallback::AddRef(){
|
||||
return InterlockedIncrement(&ref);
|
||||
}
|
||||
|
|
@ -33,10 +37,11 @@ HRESULT EndpointCallback::QueryInterface(REFIID riid, VOID **ppvInterface) {
|
|||
|
||||
HRESULT EndpointCallback::OnNotify(PAUDIO_VOLUME_NOTIFICATION_DATA pNotify) {
|
||||
if (pNotify == NULL) return E_INVALIDARG;
|
||||
|
||||
LPGUID guid = osh->getOverseer()->getGuid();
|
||||
if (pNotify->guidEventContext != *guid) {
|
||||
osh->parseExternalEndpointCallback(this, pNotify);
|
||||
AUDIO_VOLUME_NOTIFICATION_DATA eventData = *pNotify;
|
||||
LPGUID guid = osh->getOverseer()->getGuid();
|
||||
|
||||
if (eventData.guidEventContext != *guid) {
|
||||
osh->parseExternalEndpointCallback(this, eventData);
|
||||
}
|
||||
return S_OK;
|
||||
}
|
||||
|
|
@ -56,6 +61,15 @@ Endpoint::Endpoint(IMMDevice* ep){
|
|||
friendlyName = pv.pwszVal;
|
||||
}
|
||||
|
||||
void Endpoint::setIndex(uint64_t idx){
|
||||
this.idx = idx;
|
||||
}
|
||||
|
||||
uint64_t Endpoint::getIndex(){
|
||||
return idx;
|
||||
}
|
||||
|
||||
|
||||
LPWSTR Endpoint::getName(){
|
||||
return friendlyName;
|
||||
}
|
||||
|
|
@ -112,11 +126,11 @@ void Endpoint::setMute() {
|
|||
}
|
||||
|
||||
void Endpoint::setCallback(EndpointCallback *epc){
|
||||
endpointVolume->RegisterControlChangeNotify((IAudioEndpointVolumeCallback*)*epc);
|
||||
endpointVolume->RegisterControlChangeNotify((IAudioEndpointVolumeCallback*)epc);
|
||||
}
|
||||
|
||||
void Endpoint::removeCallback(EndpointCallback *epc){
|
||||
endpointVolume->UnregisterControlChangeNotify((IAudioEndpointVolumeCallback*)*epc);
|
||||
endpointVolume->UnregisterControlChangeNotify((IAudioEndpointVolumeCallback*)epc);
|
||||
}
|
||||
|
||||
Endpoint::~Endpoint(){
|
||||
|
|
@ -160,6 +174,7 @@ void Overseer::reloadEndpoints() {
|
|||
IMMDevice *temp;
|
||||
if(deviceCollection->Item(i, &temp) != 0) { log_debugcpp("si"); };
|
||||
Endpoint *endpoint = new Endpoint(temp);
|
||||
endpoint->setIndex(i);
|
||||
this->playbackDevices.push_back(endpoint);
|
||||
//TODO: le porblemx std::cout << "ola" << std::endl;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue