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"
|
||||
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
|
||||
|
|
|
|||
|
|
@ -228,10 +228,10 @@ HRESULT EndpointSituationCallback::OnPropertyValueChanged(LPCWSTR pwstrDeviceId,
|
|||
return S_OK;
|
||||
}
|
||||
|
||||
Endpoint::Endpoint(IMMDevice* ep, uint64_t idx){
|
||||
Endpoint::Endpoint(IMMDevice* ep, IPolicyConfig7* policyConfig, uint64_t idx){
|
||||
this->endpoint = ep;
|
||||
this->idx = idx;
|
||||
|
||||
this->policyConfig = policyConfig;
|
||||
/*
|
||||
* It can't multiflag, it's that stupid. MS momento.
|
||||
* 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){
|
||||
//todo: otro exe momento
|
||||
STARTUPINFOEXW startupConfig;
|
||||
PROCESS_INFORMATION processInfo;
|
||||
SecureZeroMemory(&startupConfig, sizeof(STARTUPINFOEXW));
|
||||
SecureZeroMemory(&startupConfig.StartupInfo, sizeof(STARTUPINFOW));
|
||||
startupConfig.StartupInfo.cb = sizeof(STARTUPINFOEXW);
|
||||
SecureZeroMemory(&processInfo, sizeof(PROCESS_INFORMATION));
|
||||
if (!policyConfig) return;
|
||||
|
||||
std::wstring command = L"SoundVolumeView.exe /SetDefault " + endpointId + L" ";
|
||||
std::wstring troublePair = L"1";
|
||||
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;
|
||||
bool allRoles = false;
|
||||
ERole val;
|
||||
switch(role) {
|
||||
case Roles::ROLE_CONSOLE:
|
||||
command += std::to_wstring(0);
|
||||
val = eConsole;
|
||||
break;
|
||||
case Roles::ROLE_MULTIMEDIA:
|
||||
command += std::to_wstring(1);
|
||||
val = eMultimedia;
|
||||
break;
|
||||
case Roles::ROLE_COMMUNICATIONS:
|
||||
command += std::to_wstring(2);
|
||||
val = eCommunications;
|
||||
break;
|
||||
default:
|
||||
allRoles = true;
|
||||
break;
|
||||
}
|
||||
|
||||
if(CreateProcessW(
|
||||
NULL,
|
||||
(wchar_t*)command.c_str(),
|
||||
NULL,
|
||||
NULL,
|
||||
false,
|
||||
CREATE_UNICODE_ENVIRONMENT,
|
||||
NULL,
|
||||
NULL,
|
||||
(LPSTARTUPINFOW)&startupConfig,
|
||||
&processInfo
|
||||
) == true) {
|
||||
WaitForSingleObject(processInfo.hProcess, INFINITE );
|
||||
CloseHandle(processInfo.hProcess);
|
||||
CloseHandle(processInfo.hThread);
|
||||
}
|
||||
if (allRoles) {
|
||||
policyConfig->SetDefaultEndpoint(endpointId.c_str(), eMultimedia);
|
||||
//policyConfig->SetDefaultEndpoint(endpointId.c_str(), eConsole);
|
||||
policyConfig->SetDefaultEndpoint(endpointId.c_str(), eCommunications);
|
||||
}
|
||||
policyConfig->SetDefaultEndpoint(endpointId.c_str(), val);
|
||||
}
|
||||
|
||||
void Endpoint::assignRoles(Roles role){
|
||||
|
|
@ -599,7 +559,7 @@ void Overseer::reloadEndpoints(Flows flow) {
|
|||
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);
|
||||
Endpoint *endpoint = new Endpoint(temp, policyConfig, i);
|
||||
if (flow == Flows::FLOW_PLAYBACK)
|
||||
this->playbackDevices.push_back(endpoint);
|
||||
else
|
||||
|
|
@ -608,16 +568,6 @@ void Overseer::reloadEndpoints(Flows flow) {
|
|||
}
|
||||
|
||||
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
|
||||
|
|
@ -670,7 +620,7 @@ Endpoint* Overseer::addEndpoint(std::wstring endpointId, /* out */Flows* flow =
|
|||
if(FAILED(deviceEnumerator->GetDevice((LPCWSTR)endpointId.c_str(), &newep)))
|
||||
log_debugcpp("ay caramba con la hot metida.");
|
||||
|
||||
Endpoint *endpoint = new Endpoint(newep);
|
||||
Endpoint *endpoint = new Endpoint(newep, policyConfig);
|
||||
|
||||
Flows getFlow = endpoint->getFlow();
|
||||
if (getFlow == Flows::FLOW_PLAYBACK) {
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ class Session;
|
|||
class Endpoint {
|
||||
|
||||
public:
|
||||
Endpoint(IMMDevice* endpoint, uint64_t idx = 0);
|
||||
Endpoint(IMMDevice* endpoint, IPolicyConfig7* policyConfig, uint64_t idx = 0);
|
||||
//todo: how to forward declare delegate constructors?
|
||||
//Endpoint(IMMDevice* endpoint) : Endpoint(endpoint, 0) {};
|
||||
void reloadEndpointChannels();
|
||||
|
|
@ -69,7 +69,7 @@ class Endpoint {
|
|||
uint64_t idx;
|
||||
//Not implemented in llvm-mingw. Sad! todo: mingw patch
|
||||
IAudioMeterInformation *endpointPeakMeter = nullptr;
|
||||
|
||||
IPolicyConfig7* policyConfig;
|
||||
};
|
||||
|
||||
class EndpointVolumeCallback : public IAudioEndpointVolumeCallback {
|
||||
|
|
@ -128,15 +128,18 @@ class Overseer {
|
|||
~Overseer();
|
||||
|
||||
private:
|
||||
void initCOMLibrary();
|
||||
|
||||
NGuid guid;
|
||||
|
||||
IMMDeviceEnumerator *deviceEnumerator;
|
||||
EndpointSituationCallback epsc;
|
||||
//IPolicyConfig *policyConfig;
|
||||
|
||||
std::vector<Endpoint*> playbackDevices;
|
||||
std::vector<Endpoint*> captureDevices;
|
||||
void initCOMLibrary();
|
||||
|
||||
IPolicyConfig7* policyConfig;
|
||||
friend class Endpoint;
|
||||
//IMMDeviceCollection *deviceCollection;
|
||||
//int numCaptureEndpoints;
|
||||
//std::vector<Endpoint*> *captureDevices;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue