guid sent and validated for mute
This commit is contained in:
parent
44461afdc4
commit
c8d64481e8
7 changed files with 72 additions and 65 deletions
|
|
@ -1,4 +1,5 @@
|
|||
#include <backlasses.h>
|
||||
#include <backfuncs.h>
|
||||
|
||||
EndpointCallback::EndpointCallback(Endpoint* ep){
|
||||
this->ep = ep;
|
||||
|
|
@ -37,14 +38,17 @@ HRESULT EndpointCallback::QueryInterface(REFIID riid, VOID **ppvInterface) {
|
|||
|
||||
HRESULT EndpointCallback::OnNotify(PAUDIO_VOLUME_NOTIFICATION_DATA pNotify) {
|
||||
if (pNotify == NULL) return E_INVALIDARG;
|
||||
/*
|
||||
* AUDIO_VOLUME_NOTIFICATION_DATA eventData = *pNotify;
|
||||
* LPGUID guid = osh->getOverseer()->getGuid();
|
||||
*
|
||||
* if (eventData.guidEventContext != *guid) {
|
||||
* osh->parseExternalEndpointCallback(this, eventData);
|
||||
* }
|
||||
*/
|
||||
|
||||
AUDIO_VOLUME_NOTIFICATION_DATA eventData = *pNotify;
|
||||
NGuid* guid = osh->getGuid();
|
||||
|
||||
if (memcmp(guid, &eventData, sizeof(guid)) == 0) {
|
||||
log_debugcpp("perlitas");
|
||||
} else {
|
||||
log_debugcpp("Onnanokotify says Stored: " << guid->data1);
|
||||
log_debugcpp("Onnanokotify says Grace of God: " << eventData.guidEventContext.Data1);
|
||||
}
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
|
|
@ -119,12 +123,14 @@ void Endpoint::setVolume(int channel, float volume) {
|
|||
}
|
||||
}
|
||||
|
||||
void Endpoint::setMute() {
|
||||
void Endpoint::setMute(NGuid* guid) {
|
||||
BOOL mut;
|
||||
//log_debugcpp("bool mute arrives as " << mut);
|
||||
if(FAILED(endpointVolume->GetMute(&mut))) { log_debugcpp("si"); }
|
||||
log_debugcpp("translate to BOOL as " << mut);
|
||||
if(FAILED(endpointVolume->SetMute((mut == false ? 1 : 0), NULL))) { log_debugcpp("si"); };
|
||||
log_debugcpp("translate to BOOL as " << mut);
|
||||
//TODO: use new funcs
|
||||
GUID tempMsGuid = NGuidToGUID(guid);
|
||||
if(FAILED(endpointVolume->SetMute((mut == false ? 1 : 0), &tempMsGuid))) { log_debugcpp("si"); };
|
||||
}
|
||||
|
||||
void Endpoint::setCallback(EndpointCallback *epc){
|
||||
|
|
@ -142,8 +148,7 @@ Endpoint::~Endpoint(){
|
|||
endpoint->Release();
|
||||
}
|
||||
|
||||
|
||||
void Overseer::initCOMLibrary(){
|
||||
void Overseer::initCOMLibrary() {
|
||||
if(FAILED(CoInitializeEx(NULL, COINIT_APARTMENTTHREADED | COINIT_DISABLE_OLE1DDE))) {
|
||||
log_debugcpp("si"); };
|
||||
|
||||
|
|
@ -155,30 +160,13 @@ void Overseer::initCOMLibrary(){
|
|||
(void**)&deviceEnumerator)) )
|
||||
{ log_debugcpp("si"); };
|
||||
|
||||
|
||||
GUID tempGuid;
|
||||
/*
|
||||
* HRESULT her = CoCreateGuid(&tempGuid);
|
||||
* std::bitset<32> bon(her);
|
||||
* //if (hr == EPT_S_CANT_CREATE)
|
||||
* log_debugcpp("Failed to obtain GUID: " /\*<< std::hex *\/<< her << std::dec << " " << bon);
|
||||
*/
|
||||
if(FAILED(CoCreateGuid(&tempGuid))) { log_debugcpp("Failed to obtain GUID: " ); };
|
||||
|
||||
|
||||
this->guid.data1 = tempGuid.Data1;
|
||||
this->guid.data2 = tempGuid.Data2;
|
||||
this->guid.data3 = tempGuid.Data3;
|
||||
for (int i = 0; i < 8; i++){
|
||||
this->guid.data4[i] = tempGuid.Data4[i];
|
||||
log_debugcpp("GUID DATA4 BYTE " << i << ": ");
|
||||
log_debugcpp(print_as_binary(8, uint32_t, this->guid.data4[i]));
|
||||
}
|
||||
log_debugcpp("GUID DATA1: " << this->guid.data1);
|
||||
log_debugcpp("GUID DATA2: " << this->guid.data2);
|
||||
log_debugcpp("GUID DATA3: " << this->guid.data3);
|
||||
this->guid = GUIDToNGuid(&tempGuid);
|
||||
|
||||
//TODO: Release lpguid?
|
||||
//TODO: Uninitialize COM
|
||||
}
|
||||
|
||||
void Overseer::reloadEndpoints() {
|
||||
|
|
@ -224,8 +212,8 @@ Overseer::Overseer(){
|
|||
//int Overseer::getDefaultCaptureEndpoint(Endpoint** defaultEndpoint);
|
||||
|
||||
//TODO guid
|
||||
NGuid Overseer::getGuid() {
|
||||
return guid;
|
||||
NGuid* Overseer::getGuid() {
|
||||
return &guid;
|
||||
}
|
||||
|
||||
std::vector<Endpoint*> Overseer::getPlaybackEndpoints() {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue