removed SVV.exe
This commit is contained in:
parent
6ebe2604e7
commit
c1665b33e2
4 changed files with 27 additions and 76 deletions
Binary file not shown.
|
|
@ -1,5 +1,3 @@
|
||||||
taskkill /F /IM "qtest.exe"
|
taskkill /F /IM "qtest.exe"
|
||||||
qmake -o build\Makefile .\qtest.pro
|
qmake -o build\Makefile .\qtest.pro
|
||||||
copy /Y /B .\assets\SoundVolumeView.exe .\build\debug
|
|
||||||
copy /Y /B .\assets\SoundVolumeView.exe .\build\release
|
|
||||||
mingw32-make.exe -C .\build -f Makefile
|
mingw32-make.exe -C .\build -f Makefile
|
||||||
|
|
|
||||||
|
|
@ -228,10 +228,10 @@ HRESULT EndpointSituationCallback::OnPropertyValueChanged(LPCWSTR pwstrDeviceId,
|
||||||
return S_OK;
|
return S_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
Endpoint::Endpoint(IMMDevice* ep, uint64_t idx){
|
Endpoint::Endpoint(IMMDevice* ep, IPolicyConfig7* policyConfig, uint64_t idx){
|
||||||
this->endpoint = ep;
|
this->endpoint = ep;
|
||||||
this->idx = idx;
|
this->idx = idx;
|
||||||
|
this->policyConfig = policyConfig;
|
||||||
/*
|
/*
|
||||||
* It can't multiflag, it's that stupid. MS momento.
|
* It can't multiflag, it's that stupid. MS momento.
|
||||||
* Only shows most relevant flag according to MS, i.e. 0110 sends 0010
|
* Only shows most relevant flag according to MS, i.e. 0110 sends 0010
|
||||||
|
|
@ -434,70 +434,30 @@ Roles Endpoint::getRoles(){
|
||||||
}
|
}
|
||||||
|
|
||||||
void Endpoint::setRoles(Roles role){
|
void Endpoint::setRoles(Roles role){
|
||||||
//todo: otro exe momento
|
if (!policyConfig) return;
|
||||||
STARTUPINFOEXW startupConfig;
|
|
||||||
PROCESS_INFORMATION processInfo;
|
|
||||||
SecureZeroMemory(&startupConfig, sizeof(STARTUPINFOEXW));
|
|
||||||
SecureZeroMemory(&startupConfig.StartupInfo, sizeof(STARTUPINFOW));
|
|
||||||
startupConfig.StartupInfo.cb = sizeof(STARTUPINFOEXW);
|
|
||||||
SecureZeroMemory(&processInfo, sizeof(PROCESS_INFORMATION));
|
|
||||||
|
|
||||||
std::wstring command = L"SoundVolumeView.exe /SetDefault " + endpointId + L" ";
|
bool allRoles = false;
|
||||||
std::wstring troublePair = L"1";
|
ERole val;
|
||||||
switch (role) {
|
switch(role) {
|
||||||
case Roles::ROLE_ALL:
|
|
||||||
/*
|
|
||||||
* console or multimedia, one sends both, at least for now;
|
|
||||||
* either cos of ms or dis guy;
|
|
||||||
* no choice but to treat them as one for now.
|
|
||||||
* command += L"all"; and nothing else would've been nice...
|
|
||||||
*/
|
|
||||||
troublePair = command + troublePair;
|
|
||||||
if(CreateProcessW(
|
|
||||||
NULL,
|
|
||||||
(wchar_t*)troublePair.c_str(),
|
|
||||||
NULL,
|
|
||||||
NULL,
|
|
||||||
false,
|
|
||||||
CREATE_UNICODE_ENVIRONMENT,
|
|
||||||
NULL,
|
|
||||||
NULL,
|
|
||||||
(LPSTARTUPINFOW)&startupConfig,
|
|
||||||
&processInfo
|
|
||||||
) == true) {
|
|
||||||
WaitForSingleObject(processInfo.hProcess, INFINITE );
|
|
||||||
CloseHandle(processInfo.hProcess);
|
|
||||||
CloseHandle(processInfo.hThread);
|
|
||||||
}
|
|
||||||
command += L"2";
|
|
||||||
break;
|
|
||||||
case Roles::ROLE_CONSOLE:
|
case Roles::ROLE_CONSOLE:
|
||||||
command += std::to_wstring(0);
|
val = eConsole;
|
||||||
break;
|
break;
|
||||||
case Roles::ROLE_MULTIMEDIA:
|
case Roles::ROLE_MULTIMEDIA:
|
||||||
command += std::to_wstring(1);
|
val = eMultimedia;
|
||||||
break;
|
break;
|
||||||
case Roles::ROLE_COMMUNICATIONS:
|
case Roles::ROLE_COMMUNICATIONS:
|
||||||
command += std::to_wstring(2);
|
val = eCommunications;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
allRoles = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
if (allRoles) {
|
||||||
if(CreateProcessW(
|
policyConfig->SetDefaultEndpoint(endpointId.c_str(), eMultimedia);
|
||||||
NULL,
|
//policyConfig->SetDefaultEndpoint(endpointId.c_str(), eConsole);
|
||||||
(wchar_t*)command.c_str(),
|
policyConfig->SetDefaultEndpoint(endpointId.c_str(), eCommunications);
|
||||||
NULL,
|
}
|
||||||
NULL,
|
policyConfig->SetDefaultEndpoint(endpointId.c_str(), val);
|
||||||
false,
|
|
||||||
CREATE_UNICODE_ENVIRONMENT,
|
|
||||||
NULL,
|
|
||||||
NULL,
|
|
||||||
(LPSTARTUPINFOW)&startupConfig,
|
|
||||||
&processInfo
|
|
||||||
) == true) {
|
|
||||||
WaitForSingleObject(processInfo.hProcess, INFINITE );
|
|
||||||
CloseHandle(processInfo.hProcess);
|
|
||||||
CloseHandle(processInfo.hThread);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Endpoint::assignRoles(Roles role){
|
void Endpoint::assignRoles(Roles role){
|
||||||
|
|
@ -599,7 +559,7 @@ void Overseer::reloadEndpoints(Flows flow) {
|
||||||
IMMDevice *temp;
|
IMMDevice *temp;
|
||||||
for (unsigned int i = 0; i < numEndpoints; i++){
|
for (unsigned int i = 0; i < numEndpoints; i++){
|
||||||
if(deviceCollection->Item(i, &temp) != 0) { log_debugcpp("si"); };
|
if(deviceCollection->Item(i, &temp) != 0) { log_debugcpp("si"); };
|
||||||
Endpoint *endpoint = new Endpoint(temp, i);
|
Endpoint *endpoint = new Endpoint(temp, policyConfig, i);
|
||||||
if (flow == Flows::FLOW_PLAYBACK)
|
if (flow == Flows::FLOW_PLAYBACK)
|
||||||
this->playbackDevices.push_back(endpoint);
|
this->playbackDevices.push_back(endpoint);
|
||||||
else
|
else
|
||||||
|
|
@ -608,16 +568,6 @@ void Overseer::reloadEndpoints(Flows flow) {
|
||||||
}
|
}
|
||||||
|
|
||||||
deviceCollection->Release();
|
deviceCollection->Release();
|
||||||
//IPolicyConfig7 test
|
|
||||||
/*
|
|
||||||
* deviceEnumerator->GetDefaultAudioEndpoint(MSflow, ERole::eCommunications, &temp);
|
|
||||||
* LPWSTR tempString = nullptr;
|
|
||||||
* temp->GetId(&tempString);
|
|
||||||
* HRESULT hre = policyConfig->SetDefaultEndpoint(
|
|
||||||
* tempString,
|
|
||||||
* ERole::eMultimedia
|
|
||||||
* );
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Discerning default endpoints per role
|
* Discerning default endpoints per role
|
||||||
|
|
@ -670,7 +620,7 @@ Endpoint* Overseer::addEndpoint(std::wstring endpointId, /* out */Flows* flow =
|
||||||
if(FAILED(deviceEnumerator->GetDevice((LPCWSTR)endpointId.c_str(), &newep)))
|
if(FAILED(deviceEnumerator->GetDevice((LPCWSTR)endpointId.c_str(), &newep)))
|
||||||
log_debugcpp("ay caramba con la hot metida.");
|
log_debugcpp("ay caramba con la hot metida.");
|
||||||
|
|
||||||
Endpoint *endpoint = new Endpoint(newep);
|
Endpoint *endpoint = new Endpoint(newep, policyConfig);
|
||||||
|
|
||||||
Flows getFlow = endpoint->getFlow();
|
Flows getFlow = endpoint->getFlow();
|
||||||
if (getFlow == Flows::FLOW_PLAYBACK) {
|
if (getFlow == Flows::FLOW_PLAYBACK) {
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,7 @@ class Session;
|
||||||
class Endpoint {
|
class Endpoint {
|
||||||
|
|
||||||
public:
|
public:
|
||||||
Endpoint(IMMDevice* endpoint, uint64_t idx = 0);
|
Endpoint(IMMDevice* endpoint, IPolicyConfig7* policyConfig, uint64_t idx = 0);
|
||||||
//todo: how to forward declare delegate constructors?
|
//todo: how to forward declare delegate constructors?
|
||||||
//Endpoint(IMMDevice* endpoint) : Endpoint(endpoint, 0) {};
|
//Endpoint(IMMDevice* endpoint) : Endpoint(endpoint, 0) {};
|
||||||
void reloadEndpointChannels();
|
void reloadEndpointChannels();
|
||||||
|
|
@ -69,7 +69,7 @@ class Endpoint {
|
||||||
uint64_t idx;
|
uint64_t idx;
|
||||||
//Not implemented in llvm-mingw. Sad! todo: mingw patch
|
//Not implemented in llvm-mingw. Sad! todo: mingw patch
|
||||||
IAudioMeterInformation *endpointPeakMeter = nullptr;
|
IAudioMeterInformation *endpointPeakMeter = nullptr;
|
||||||
|
IPolicyConfig7* policyConfig;
|
||||||
};
|
};
|
||||||
|
|
||||||
class EndpointVolumeCallback : public IAudioEndpointVolumeCallback {
|
class EndpointVolumeCallback : public IAudioEndpointVolumeCallback {
|
||||||
|
|
@ -128,15 +128,18 @@ class Overseer {
|
||||||
~Overseer();
|
~Overseer();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
void initCOMLibrary();
|
||||||
|
|
||||||
NGuid guid;
|
NGuid guid;
|
||||||
|
|
||||||
IMMDeviceEnumerator *deviceEnumerator;
|
IMMDeviceEnumerator *deviceEnumerator;
|
||||||
EndpointSituationCallback epsc;
|
EndpointSituationCallback epsc;
|
||||||
//IPolicyConfig *policyConfig;
|
|
||||||
std::vector<Endpoint*> playbackDevices;
|
std::vector<Endpoint*> playbackDevices;
|
||||||
std::vector<Endpoint*> captureDevices;
|
std::vector<Endpoint*> captureDevices;
|
||||||
void initCOMLibrary();
|
|
||||||
IPolicyConfig7* policyConfig;
|
IPolicyConfig7* policyConfig;
|
||||||
|
friend class Endpoint;
|
||||||
//IMMDeviceCollection *deviceCollection;
|
//IMMDeviceCollection *deviceCollection;
|
||||||
//int numCaptureEndpoints;
|
//int numCaptureEndpoints;
|
||||||
//std::vector<Endpoint*> *captureDevices;
|
//std::vector<Endpoint*> *captureDevices;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue