various fixes
This commit is contained in:
parent
e278280c4b
commit
24110624fb
9 changed files with 163 additions and 137 deletions
|
|
@ -1,11 +1,11 @@
|
|||
GUID NGuidToGUID(NGuid* guid) {
|
||||
GUID NGuidToGUID(NGuid guid) {
|
||||
GUID msGuid = GUID();
|
||||
msGuid.Data1 = guid->data1;
|
||||
msGuid.Data2 = guid->data2;
|
||||
msGuid.Data3 = guid->data3;
|
||||
msGuid.Data1 = guid->data1;
|
||||
msGuid.Data1 = guid.data1;
|
||||
msGuid.Data2 = guid.data2;
|
||||
msGuid.Data3 = guid.data3;
|
||||
msGuid.Data1 = guid.data1;
|
||||
for (int i = 0; i < 8; i++){
|
||||
msGuid.Data4[i] = guid->data4[i];
|
||||
msGuid.Data4[i] = guid.data4[i];
|
||||
//log_debugcpp("MSGUID DATA4 BYTE " << i << ": ");
|
||||
//log_debugcpp(print_as_binary(8, uint32_t, msGuid.Data4[i]));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -39,7 +39,6 @@ HRESULT EndpointVolumeCallback::QueryInterface(REFIID riid, VOID **ppvInterface)
|
|||
HRESULT EndpointVolumeCallback::OnNotify(PAUDIO_VOLUME_NOTIFICATION_DATA pNotify) {
|
||||
if (pNotify == NULL) return E_INVALIDARG;
|
||||
|
||||
//TODO: el default = objcopy frees?
|
||||
//delete osh->getEndpointHandlers().at(this->ep->getIndex())->getCallbackInfo()->caller;
|
||||
//osh->getEndpointHandlers().at(this->ep->getIndex())->getCallbackInfo()->caller.freeData4();
|
||||
//Could've made a function or = override to hide this within Nguid, but back in cont = bad.
|
||||
|
|
@ -142,7 +141,7 @@ uint8_t Endpoint::getState(){
|
|||
}
|
||||
|
||||
|
||||
void Endpoint::setVolume(NGuid* guid, int channel, float volume) {
|
||||
void Endpoint::setVolume(NGuid guid, int channel, float volume) {
|
||||
//TIP: There used to be log messages here. Now, it's a ghost town.
|
||||
GUID tempMsGuid = NGuidToGUID(guid);
|
||||
if (channel == AudioChannel::CHANNEL_MAIN) {
|
||||
|
|
@ -152,7 +151,7 @@ void Endpoint::setVolume(NGuid* guid, int channel, float volume) {
|
|||
}
|
||||
}
|
||||
|
||||
void Endpoint::setMute(NGuid* guid, bool muted) {
|
||||
void Endpoint::setMute(NGuid guid, bool muted) {
|
||||
GUID tempMsGuid = NGuidToGUID(guid);
|
||||
if(FAILED(endpointVolume->SetMute(muted, &tempMsGuid))) { /* TIP: Above */ };
|
||||
}
|
||||
|
|
@ -197,6 +196,10 @@ void Overseer::initCOMLibrary() {
|
|||
GUID tempGuid;
|
||||
if(FAILED(CoCreateGuid(&tempGuid))) { log_debugcpp("Failed to obtain GUID: " ); };
|
||||
this->guid = GUIDToNGuid(&tempGuid);
|
||||
|
||||
//if(FAILED(CoCreateInstance(__uuidof(CPolicyConfigClient),
|
||||
// NULL, CLSCTX_ALL, __uuidof(IPolicyConfig10), (LPVOID *)&policyConfig))) {exit(-1);}
|
||||
|
||||
//TODO: Release lpguid?
|
||||
//TODO: Uninitialize COM
|
||||
}
|
||||
|
|
@ -244,9 +247,9 @@ void Overseer::reloadEndpoints() {
|
|||
LPWSTR id = nullptr;
|
||||
|
||||
for (unsigned int j = 0; j < numPlaybackEndpoints; j++){
|
||||
std::wstring test = playbackDevices.at(j)->getId();
|
||||
std::wstring eptId = playbackDevices.at(j)->getId();
|
||||
temp->GetId(&id);
|
||||
int comparison = CompareStringEx(LOCALE_NAME_USER_DEFAULT, 0, test.c_str(), -987, id, -987, NULL, NULL, 0);
|
||||
int comparison = CompareStringEx(LOCALE_NAME_USER_DEFAULT, 0, eptId.c_str(), -987, id, -987, NULL, NULL, 0);
|
||||
if (comparison - 2 == 0) {
|
||||
log_wdebugcpp("ola defaul de " << i << " es " << id);
|
||||
playbackDevices.at(j)->setRoles((1 << i));
|
||||
|
|
@ -273,9 +276,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() {
|
||||
|
|
|
|||
|
|
@ -1,16 +1,15 @@
|
|||
#pragma once
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
//done by qt by def #define UNICODE
|
||||
#define _WIN32_WINNT 0x0A00
|
||||
#include <sdkddkver.h>
|
||||
|
||||
//#include "debug.h"
|
||||
/* #include <vector> */
|
||||
/* #include <iostream> */
|
||||
/* #include <wstring> */
|
||||
//done by qt by def #define UNICODE
|
||||
|
||||
#include <Windows.h>
|
||||
#include <mmdeviceapi.h>
|
||||
#include <combaseapi.h>
|
||||
#include <initguid.h>
|
||||
#include <Propidl.h>
|
||||
#include <functiondiscoverykeys_devpkey.h>
|
||||
|
||||
#include <endpointvolume.h>
|
||||
|
|
@ -20,6 +19,8 @@
|
|||
//#include <comip.h>
|
||||
#include <Winerror.h>
|
||||
#include <stringapiset.h>
|
||||
#include "ipolicyconfig.h"
|
||||
#include <Mmreg.h>
|
||||
|
||||
#include "global.h"
|
||||
#include "contclasses.h"
|
||||
|
|
@ -32,10 +33,10 @@ class Endpoint {
|
|||
Endpoint(IMMDevice* endpoint, uint64_t idx);
|
||||
uint64_t getIndex();
|
||||
void setIndex(uint64_t idx);
|
||||
void setVolume(NGuid* guid, int channel, float volume);
|
||||
void setVolume(NGuid guid, int channel, float volume);
|
||||
uint32_t getChannelCount();
|
||||
float getVolume(int channel);
|
||||
void setMute(NGuid* guid, bool muted);
|
||||
void setMute(NGuid guid, bool muted);
|
||||
bool getMute();
|
||||
void setState(uint8_t state);
|
||||
uint8_t getState();
|
||||
|
|
@ -82,7 +83,7 @@ class Overseer {
|
|||
Overseer();
|
||||
std::vector<Endpoint*> getPlaybackEndpoints();
|
||||
void reloadEndpoints();
|
||||
NGuid* getGuid();
|
||||
NGuid getGuid();
|
||||
//~Overseer();
|
||||
//int getDefaultPlaybackEndpoint(Endpoint** defaultEndpoint);
|
||||
//int getDefaultCaptureEndpoint(Endpoint** defaultEndpoint);
|
||||
|
|
@ -94,6 +95,7 @@ class Overseer {
|
|||
NGuid guid;
|
||||
unsigned int numPlaybackEndpoints;
|
||||
IMMDeviceEnumerator *deviceEnumerator;
|
||||
IPolicyConfig *policyConfig;
|
||||
std::vector<Endpoint*> playbackDevices;
|
||||
void initCOMLibrary();
|
||||
//IMMDeviceCollection *deviceCollection;
|
||||
|
|
|
|||
|
|
@ -9,6 +9,18 @@
|
|||
#pragma once
|
||||
|
||||
|
||||
interface DECLSPEC_UUID("CA286FC3-91FD-42C3-8E9B-CAAFA66242E3")
|
||||
IPolicyConfig10;
|
||||
|
||||
interface DECLSPEC_UUID("00000000-0000-0000-C000-000000000046")
|
||||
IPolicyConfig10_1;
|
||||
|
||||
interface DECLSPEC_UUID("F8679F50-850A-41CF-9C72-430F290290C8")
|
||||
IPolicyConfig7;
|
||||
|
||||
/* interface DECLSPEC_UUID("568B9108-44BF-40B4-9006-86AFE5B5A620") */
|
||||
/* IPolicyConfigVista; */
|
||||
|
||||
interface DECLSPEC_UUID("f8679f50-850a-41cf-9c72-430f290290c8")
|
||||
IPolicyConfig;
|
||||
class DECLSPEC_UUID("870af99c-171d-4f9e-af0d-e63df40c2bc9")
|
||||
|
|
@ -86,8 +98,8 @@ public:
|
|||
);
|
||||
|
||||
virtual HRESULT STDMETHODCALLTYPE SetDefaultEndpoint(
|
||||
__in PCWSTR wszDeviceId,
|
||||
__in ERole eRole
|
||||
PCWSTR wszDeviceId,
|
||||
ERole eRole
|
||||
);
|
||||
|
||||
virtual HRESULT STDMETHODCALLTYPE SetEndpointVisibility(
|
||||
|
|
@ -96,85 +108,85 @@ public:
|
|||
);
|
||||
};
|
||||
|
||||
interface DECLSPEC_UUID("568b9108-44bf-40b4-9006-86afe5b5a620")
|
||||
IPolicyConfigVista;
|
||||
class DECLSPEC_UUID("294935CE-F637-4E7C-A41B-AB255460B862")
|
||||
CPolicyConfigVistaClient;
|
||||
// ----------------------------------------------------------------------------
|
||||
// class CPolicyConfigVistaClient
|
||||
// {294935CE-F637-4E7C-A41B-AB255460B862}
|
||||
//
|
||||
// interface IPolicyConfigVista
|
||||
// {568b9108-44bf-40b4-9006-86afe5b5a620}
|
||||
//
|
||||
// Query interface:
|
||||
// CComPtr<IPolicyConfigVista> PolicyConfig;
|
||||
// PolicyConfig.CoCreateInstance(__uuidof(CPolicyConfigVistaClient));
|
||||
//
|
||||
// @compatible: Windows Vista and Later
|
||||
// ----------------------------------------------------------------------------
|
||||
interface IPolicyConfigVista : public IUnknown
|
||||
{
|
||||
public:
|
||||
/* interface DECLSPEC_UUID("568b9108-44bf-40b4-9006-86afe5b5a620") */
|
||||
/* IPolicyConfigVista; */
|
||||
/* class DECLSPEC_UUID("294935CE-F637-4E7C-A41B-AB255460B862") */
|
||||
/* CPolicyConfigVistaClient; */
|
||||
/* // ---------------------------------------------------------------------------- */
|
||||
/* // class CPolicyConfigVistaClient */
|
||||
/* // {294935CE-F637-4E7C-A41B-AB255460B862} */
|
||||
/* // */
|
||||
/* // interface IPolicyConfigVista */
|
||||
/* // {568b9108-44bf-40b4-9006-86afe5b5a620} */
|
||||
/* // */
|
||||
/* // Query interface: */
|
||||
/* // CComPtr<IPolicyConfigVista> PolicyConfig; */
|
||||
/* // PolicyConfig.CoCreateInstance(__uuidof(CPolicyConfigVistaClient)); */
|
||||
/* // */
|
||||
/* // @compatible: Windows Vista and Later */
|
||||
/* // ---------------------------------------------------------------------------- */
|
||||
/* interface IPolicyConfigVista : public IUnknown */
|
||||
/* { */
|
||||
/* public: */
|
||||
|
||||
virtual HRESULT GetMixFormat(
|
||||
PCWSTR,
|
||||
WAVEFORMATEX **
|
||||
); // not available on Windows 7, use method from IPolicyConfig
|
||||
/* virtual HRESULT GetMixFormat( */
|
||||
/* PCWSTR, */
|
||||
/* WAVEFORMATEX ** */
|
||||
/* ); // not available on Windows 7, use method from IPolicyConfig */
|
||||
|
||||
virtual HRESULT STDMETHODCALLTYPE GetDeviceFormat(
|
||||
PCWSTR,
|
||||
INT,
|
||||
WAVEFORMATEX **
|
||||
);
|
||||
/* virtual HRESULT STDMETHODCALLTYPE GetDeviceFormat( */
|
||||
/* PCWSTR, */
|
||||
/* INT, */
|
||||
/* WAVEFORMATEX ** */
|
||||
/* ); */
|
||||
|
||||
virtual HRESULT STDMETHODCALLTYPE SetDeviceFormat(
|
||||
PCWSTR,
|
||||
WAVEFORMATEX *,
|
||||
WAVEFORMATEX *
|
||||
);
|
||||
/* virtual HRESULT STDMETHODCALLTYPE SetDeviceFormat( */
|
||||
/* PCWSTR, */
|
||||
/* WAVEFORMATEX *, */
|
||||
/* WAVEFORMATEX * */
|
||||
/* ); */
|
||||
|
||||
virtual HRESULT STDMETHODCALLTYPE GetProcessingPeriod(
|
||||
PCWSTR,
|
||||
INT,
|
||||
PINT64,
|
||||
PINT64
|
||||
); // not available on Windows 7, use method from IPolicyConfig
|
||||
/* virtual HRESULT STDMETHODCALLTYPE GetProcessingPeriod( */
|
||||
/* PCWSTR, */
|
||||
/* INT, */
|
||||
/* PINT64, */
|
||||
/* PINT64 */
|
||||
/* ); // not available on Windows 7, use method from IPolicyConfig */
|
||||
|
||||
virtual HRESULT STDMETHODCALLTYPE SetProcessingPeriod(
|
||||
PCWSTR,
|
||||
PINT64
|
||||
); // not available on Windows 7, use method from IPolicyConfig
|
||||
/* virtual HRESULT STDMETHODCALLTYPE SetProcessingPeriod( */
|
||||
/* PCWSTR, */
|
||||
/* PINT64 */
|
||||
/* ); // not available on Windows 7, use method from IPolicyConfig */
|
||||
|
||||
virtual HRESULT STDMETHODCALLTYPE GetShareMode(
|
||||
PCWSTR,
|
||||
struct DeviceShareMode *
|
||||
); // not available on Windows 7, use method from IPolicyConfig
|
||||
/* virtual HRESULT STDMETHODCALLTYPE GetShareMode( */
|
||||
/* PCWSTR, */
|
||||
/* struct DeviceShareMode * */
|
||||
/* ); // not available on Windows 7, use method from IPolicyConfig */
|
||||
|
||||
virtual HRESULT STDMETHODCALLTYPE SetShareMode(
|
||||
PCWSTR,
|
||||
struct DeviceShareMode *
|
||||
); // not available on Windows 7, use method from IPolicyConfig
|
||||
/* virtual HRESULT STDMETHODCALLTYPE SetShareMode( */
|
||||
/* PCWSTR, */
|
||||
/* struct DeviceShareMode * */
|
||||
/* ); // not available on Windows 7, use method from IPolicyConfig */
|
||||
|
||||
virtual HRESULT STDMETHODCALLTYPE GetPropertyValue(
|
||||
PCWSTR,
|
||||
const PROPERTYKEY &,
|
||||
PROPVARIANT *
|
||||
);
|
||||
/* virtual HRESULT STDMETHODCALLTYPE GetPropertyValue( */
|
||||
/* PCWSTR, */
|
||||
/* const PROPERTYKEY &, */
|
||||
/* PROPVARIANT * */
|
||||
/* ); */
|
||||
|
||||
virtual HRESULT STDMETHODCALLTYPE SetPropertyValue(
|
||||
PCWSTR,
|
||||
const PROPERTYKEY &,
|
||||
PROPVARIANT *
|
||||
);
|
||||
/* virtual HRESULT STDMETHODCALLTYPE SetPropertyValue( */
|
||||
/* PCWSTR, */
|
||||
/* const PROPERTYKEY &, */
|
||||
/* PROPVARIANT * */
|
||||
/* ); */
|
||||
|
||||
virtual HRESULT STDMETHODCALLTYPE SetDefaultEndpoint(
|
||||
__in PCWSTR wszDeviceId,
|
||||
__in ERole eRole
|
||||
);
|
||||
/* virtual HRESULT STDMETHODCALLTYPE SetDefaultEndpoint( */
|
||||
/* __in PCWSTR wszDeviceId, */
|
||||
/* __in ERole eRole */
|
||||
/* ); */
|
||||
|
||||
virtual HRESULT STDMETHODCALLTYPE SetEndpointVisibility(
|
||||
PCWSTR,
|
||||
INT
|
||||
); // not available on Windows 7, use method from IPolicyConfig
|
||||
};
|
||||
/* virtual HRESULT STDMETHODCALLTYPE SetEndpointVisibility( */
|
||||
/* PCWSTR, */
|
||||
/* INT */
|
||||
/* ); // not available on Windows 7, use method from IPolicyConfig */
|
||||
/* }; */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue