wip: fixed wrong index for epw creation

This commit is contained in:
Hane 2024-04-24 02:03:07 +02:00
commit 4756a00156
4 changed files with 32 additions and 14 deletions

View file

@ -231,14 +231,14 @@ HRESULT EndpointSituationCallback::OnPropertyValueChanged(LPCWSTR pwstrDeviceId,
Endpoint::Endpoint(IMMDevice* ep, uint64_t idx){
this->endpoint = ep;
this->idx = idx;
/*
* It can't multiflag, it's that stupid. MS momento.
* Only shows most relevant flag according to MS, i.e. 0110 sends 0010
*/
//todo: preguntitas owindows dword no es uint32_t even tho mingw mingas
if(FAILED(endpoint->GetState(&this->endpointState))) {exit(-2);};
if(this->endpointState == EndpointState::ENDPOINT_ACTIVE) {
activateEndpointVolume();
}
@ -250,7 +250,7 @@ Endpoint::Endpoint(IMMDevice* ep, uint64_t idx){
// CLSCTX_ALL, NULL, (void**)&endpointPeakMeter))) { log_debugcpp("peakbros..."); }
//todo:: atexit into exit Gather ID
//todo: atexit into exit Gather ID
LPWSTR tempString = nullptr;
if (FAILED(endpoint->GetId(&tempString))) {exit(-1);};
endpointId = std::wstring(tempString);
@ -259,10 +259,10 @@ Endpoint::Endpoint(IMMDevice* ep, uint64_t idx){
endpoint->OpenPropertyStore(STGM_READ, &properties);
this->updateName();
this->setFlow();
if (this->flow == Flows::FLOW_PLAYBACK) {
activateEndpointSessions();
log_debugcpp("plays back");
}
}
@ -277,7 +277,8 @@ void Endpoint::updateName() {
store_name(PKEY_Device_FriendlyName, pv, friendlyName);
store_name(PKEY_Device_DeviceDesc, pv, descriptionName);
store_name(PKEY_DeviceInterface_FriendlyName, pv, deviceName);
#undef store_name
#undef store_name
log_wdebugcpp(L"Endpoint name: " + friendlyName);
}
void Endpoint::activateEndpointSessions() {
@ -511,6 +512,7 @@ void Endpoint::setFlow() {
EDataFlow MSflow;
HRESULT vafllar = flowGetter->GetDataFlow(&MSflow);
this->flow = (MSflow == EDataFlow::eRender ? Flows::FLOW_PLAYBACK : Flows::FLOW_CAPTURE);
log_debugcpp("Endpoint flow: " + std::to_string(flow));
flowGetter->Release();
}
@ -584,13 +586,12 @@ void Overseer::reloadEndpoints(Flows flow) {
if(numEndpoints == 0) { log_debugcpp("si"); };
/*
* Retrieving actual endpoints and storing them on their own class
* Retrieving actual endpoints and storing them on their own collection
*/
IMMDevice *temp;
for (unsigned int i = 0; i < numEndpoints; i++){
if(deviceCollection->Item(i, &temp) != 0) { log_debugcpp("si"); };
Endpoint *endpoint = new Endpoint(temp, i);
if (flow == Flows::FLOW_PLAYBACK)
this->playbackDevices.push_back(endpoint);
else
@ -626,9 +627,8 @@ void Overseer::reloadEndpoints(Flows flow) {
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(L"ola defaul playback de "
+ std::to_wstring(i) + L" es " + id);
playbackDevices.at(j)->assignRoles((Roles)(1 << i));
log_wdebugcpp(L"ola defaul playback de " + std::to_wstring(i) + L" es " + id);
playbackDevices.at(j)->assignRoles((Roles)(1 << i));
}
}
} else {