fixed xekboxes

This commit is contained in:
Hane 2023-09-08 18:48:51 +02:00
commit 60e3178e9a
7 changed files with 74 additions and 54 deletions

View file

@ -112,7 +112,7 @@ HRESULT EndpointSituationCallback::QueryInterface(REFIID riid, VOID **ppvInterfa
HRESULT EndpointSituationCallback::OnDefaultDeviceChanged(EDataFlow flow, ERole role,LPCWSTR pwstrDeviceId) {
if (flow == EDataFlow::eCapture) return E_INVALIDARG;
Roles nRole;
switch (role) {
case ERole::eConsole:
@ -126,18 +126,19 @@ HRESULT EndpointSituationCallback::OnDefaultDeviceChanged(EDataFlow flow, ERole
break;
}
std::wstring wstringEndpointId = pwstrDeviceId;
log_wdebugcpp(L"we got za defol 4 " + wstringEndpointId);
osh->changeFrontDefaultsCallback(nRole, wstringEndpointId);
return S_OK;
}
HRESULT EndpointSituationCallback::OnDeviceAdded(LPCWSTR pwstrDeviceId) {
log_wdebugcpp(L"ayo we eventing za adin" << pwstrDeviceId);
log_wdebugcpp(L"ayo we eventing za adin " + std::wstring(pwstrDeviceId));
return S_OK;
};
HRESULT EndpointSituationCallback::OnDeviceRemoved(LPCWSTR pwstrDeviceId) {
log_wdebugcpp(L"ayo we eventing za rmovin" << pwstrDeviceId);
log_wdebugcpp(L"ayo we eventing za rmovin " + std::wstring(pwstrDeviceId));
return S_OK;
}
@ -159,13 +160,15 @@ HRESULT EndpointSituationCallback::OnDeviceStateChanged(LPCWSTR pwstrDeviceId, D
HRESULT EndpointSituationCallback::OnPropertyValueChanged(LPCWSTR pwstrDeviceId, const PROPERTYKEY key) {
log_debugcpp(" -->Changed device property " <<
key.fmtid.Data1 << key.fmtid.Data2 << key.fmtid.Data3 << "\n" <<
key.fmtid.Data4[0]<< key.fmtid.Data4[1]<< "\n"<<
key.fmtid.Data4[2]<< key.fmtid.Data4[3] << "\n"<<
key.fmtid.Data4[4]<< key.fmtid.Data4[5] << "\n"<<
key.fmtid.Data4[6]<< key.fmtid.Data4[7]<< "\n"<<
" pid " << key.pid);
/*
* log_debugcpp(" -->Changed device property " +
* key.fmtid.Data1 + key.fmtid.Data2 + key.fmtid.Data3 + "\n" +
* key.fmtid.Data4[0]+ key.fmtid.Data4[1]+ "\n"+
* key.fmtid.Data4[2]+ key.fmtid.Data4[3] + "\n"+
* key.fmtid.Data4[4]+ key.fmtid.Data4[5] + "\n"+
* key.fmtid.Data4[6]+ key.fmtid.Data4[7]+ "\n"+
* " pid " + key.pid);
*/
return S_OK;
}
@ -272,7 +275,7 @@ void Endpoint::removeVolumeCallback(EndpointVolumeCallback *epc){
endpointVolume->UnregisterControlChangeNotify((IAudioEndpointVolumeCallback*)epc);
}
uint8_t Endpoint::getRoles(){
Roles Endpoint::getRoles(){
return this->endpointRoles;
}
@ -343,13 +346,13 @@ void Endpoint::setRoles(Roles role){
}
}
void Endpoint::assignRoles(uint8_t role){
uint8_t roles = endpointRoles | role;
void Endpoint::assignRoles(Roles role){
Roles roles = (Roles)(endpointRoles | role);
this->endpointRoles = roles;
}
void Endpoint::removeRoles(uint8_t role){
uint8_t roles = endpointRoles ^ role;
void Endpoint::removeRoles(Roles role){
Roles roles = (Roles)(endpointRoles ^ role);
this->endpointRoles = roles;
}
@ -361,6 +364,7 @@ Endpoint::~Endpoint(){
}
void Overseer::initCOMLibrary() {
OutputDebugStringW(L"EPWidget creation\n");
if(FAILED(CoInitializeEx(NULL, COINIT_APARTMENTTHREADED | COINIT_DISABLE_OLE1DDE))) {
log_debugcpp("si"); };
@ -405,7 +409,7 @@ void Overseer::reloadEndpoints() {
Endpoint *endpoint = new Endpoint(temp, i);
//endpoint->setIndex(i);
this->playbackDevices.push_back(endpoint);
//TODO: le porblemx std::cout << "ola" << std::endl;
//TODO: le porblemx std::cout + "ola" + std::endl;
}
deviceCollection->Release();
@ -435,8 +439,8 @@ void Overseer::reloadEndpoints() {
temp->GetId(&id);
int comparison = CompareStringEx(LOCALE_NAME_USER_DEFAULT, 0, eptId.c_str(), -987, id, -987, NULL, NULL, 0);
if (comparison - 2 == 0) {
log_wdebugcpp("ola defaul de " << i << " es " << id);
playbackDevices.at(j)->assignRoles((1 << i));
log_wdebugcpp(L"ola defaul de " + std::to_wstring(i) + L" es " + id);
playbackDevices.at(j)->assignRoles((Roles)(1 << i));
}
//uint8_t debg = playbackDevices.at(j)->getRoles();
}