channels added to front programmatically
This commit is contained in:
parent
679ad34f84
commit
cb81b49367
6 changed files with 78 additions and 35 deletions
|
|
@ -58,9 +58,11 @@ HRESULT EndpointCallback::OnNotify(PAUDIO_VOLUME_NOTIFICATION_DATA pNotify) {
|
|||
* PAUDIO_VOLUME_NOTIFICATION_DATA->Release();
|
||||
* } */
|
||||
|
||||
Endpoint::Endpoint(IMMDevice* ep){
|
||||
Endpoint::Endpoint(IMMDevice* ep, uint64_t idx){
|
||||
this->endpoint = ep;
|
||||
this->idx = idx;
|
||||
if(FAILED(endpoint->Activate(IID_IAudioEndpointVolume, CLSCTX_ALL, NULL, (void**)&endpointVolume))) { log_debugcpp("si"); };
|
||||
if (FAILED(endpointVolume->GetChannelCount(&channelCount))) log_debugcpp("get channel count fail");
|
||||
//Obtaining friendly name: IPropertyStore creates PROPVARIANT per field
|
||||
// hr = endpointPtr->GetId(&endpointID);
|
||||
endpoint->OpenPropertyStore(STGM_READ, &properties);
|
||||
|
|
@ -92,6 +94,10 @@ float Endpoint::getVolume(int channel){
|
|||
return volume;
|
||||
}
|
||||
|
||||
uint32_t Endpoint::getChannelCount(){
|
||||
return (uint32_t)channelCount;
|
||||
}
|
||||
|
||||
|
||||
bool Endpoint::getMute(){
|
||||
BOOL mut;
|
||||
|
|
@ -122,6 +128,7 @@ void Endpoint::setVolume(NGuid* guid, int channel, float volume) {
|
|||
if (channel == ENDPOINT_MASTER_VOLUME) {
|
||||
if(FAILED(endpointVolume->SetMasterVolumeLevelScalar(volume, &tempMsGuid))) { log_debugcpp("si"); };
|
||||
} else {
|
||||
log_debugcpp("channel being updated: " << channel);
|
||||
if(FAILED(endpointVolume->SetChannelVolumeLevelScalar(channel, volume, &tempMsGuid))) { log_debugcpp("si"); };
|
||||
}
|
||||
}
|
||||
|
|
@ -165,9 +172,7 @@ void Overseer::initCOMLibrary() {
|
|||
|
||||
GUID tempGuid;
|
||||
if(FAILED(CoCreateGuid(&tempGuid))) { log_debugcpp("Failed to obtain GUID: " ); };
|
||||
|
||||
this->guid = GUIDToNGuid(&tempGuid);
|
||||
|
||||
//TODO: Release lpguid?
|
||||
//TODO: Uninitialize COM
|
||||
}
|
||||
|
|
@ -188,8 +193,8 @@ void Overseer::reloadEndpoints() {
|
|||
for (unsigned int i = 0; i < numPlaybackEndpoints; i++){
|
||||
IMMDevice *temp;
|
||||
if(deviceCollection->Item(i, &temp) != 0) { log_debugcpp("si"); };
|
||||
Endpoint *endpoint = new Endpoint(temp);
|
||||
endpoint->setIndex(i);
|
||||
Endpoint *endpoint = new Endpoint(temp, i);
|
||||
//endpoint->setIndex(i);
|
||||
this->playbackDevices.push_back(endpoint);
|
||||
//TODO: le porblemx std::cout << "ola" << std::endl;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue