global h, slidy boi starts where it should, name

This commit is contained in:
Hane 2023-02-10 22:48:46 +01:00
commit e61c600019
10 changed files with 77 additions and 16 deletions

View file

@ -3,12 +3,35 @@
Endpoint::Endpoint(IMMDevice* ep){
this->endpoint = ep;
if(FAILED(endpoint->Activate(IID_IAudioEndpointVolume, CLSCTX_ALL, NULL, (void**)&endpointVolume))) { log_debugcpp("si"); };
//Obtaining friendly name: IPropertyStore creates PROPVARIANT per field
// hr = endpointPtr->GetId(&endpointID);
endpoint->OpenPropertyStore(STGM_READ, &properties);
PROPVARIANT pv;
properties->GetValue(PKEY_Device_FriendlyName , &pv);
friendlyName = pv.pwszVal;
}
LPWSTR Endpoint::getName(){
return friendlyName;
}
float Endpoint::getVolume(){
float volume;
if(FAILED(endpointVolume->GetMasterVolumeLevelScalar(&volume))) { log_debugcpp("si");}
return volume;
}
void Endpoint::setVolume(float volume) {
if(FAILED(endpointVolume->SetMasterVolumeLevelScalar(volume, NULL))) { log_debugcpp("si"); };
}
//Endpoint::~Endpoint(){
// free(friendlyName);
// properties->Release();
// endpointVolume->Release();
// endpoint->Release();
//}
void Overseer::initCOMLibrary(){
if(FAILED(CoInitializeEx(NULL, COINIT_APARTMENTTHREADED))) { log_debugcpp("si"); };
@ -67,6 +90,13 @@ std::vector<Endpoint*> Overseer::getPlaybackEndpoints() {
return playbackDevices;
}
//Overseer::~Overseer(){
// deviceEnumerator->Release();
// for(unsigned long long i = 0; i < playbackDevices.size(); i++){
//delete(playbackDevices.at(i));
//}
//}
//int Overseer::getCaptureEndpoints(std::vector<Endpoint*> *captureEndpoints);
//IMMDeviceEnumerator** Overseer::setOrigin();