various fixes
This commit is contained in:
parent
e278280c4b
commit
24110624fb
9 changed files with 163 additions and 137 deletions
|
|
@ -1,7 +1,7 @@
|
||||||
QMAKE_CXXFLAGS += --target=x86_64-w64-mingw32 -g -gcodeview
|
QMAKE_CXXFLAGS += --target=x86_64-w64-mingw32 -g -gcodeview
|
||||||
#QMAKE_LINK += clang++
|
|
||||||
QMAKE_LFLAGS += --target=x86_64-w64-mingw32 -g -Wl,-pdb= -v
|
QMAKE_LFLAGS += --target=x86_64-w64-mingw32 -g -Wl,-pdb= -v
|
||||||
|
LIBS += -LC:/capybara/libclang/x86_64-w64-mingw32/lib -lWinmm -lodbc32 -lodbccp32 -luuid -loleaut32 -lole32 -lshell32 -ladvapi32 -lcomdlg32 -lwinspool -lgdi32 -luser32 -lkernel32
|
||||||
|
#"kernel32.lib" "user32.lib" "gdi32.lib" "winspool.lib" "comdlg32.lib" "advapi32.lib" "shell32.lib" "ole32.lib" "oleaut32.lib" "uuid.lib" "odbc32.lib" "odbccp32.lib" -luuid -loleaut32 -lole32 -lshell32 -ladvapi32 -lcomdlg32 -lwinspool -lgdi32 -luser32 -lkernel32
|
||||||
DEFINES += DEBUG
|
DEFINES += DEBUG
|
||||||
CONFIG += debug console
|
CONFIG += debug console
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,11 +1,11 @@
|
||||||
GUID NGuidToGUID(NGuid* guid) {
|
GUID NGuidToGUID(NGuid guid) {
|
||||||
GUID msGuid = GUID();
|
GUID msGuid = GUID();
|
||||||
msGuid.Data1 = guid->data1;
|
msGuid.Data1 = guid.data1;
|
||||||
msGuid.Data2 = guid->data2;
|
msGuid.Data2 = guid.data2;
|
||||||
msGuid.Data3 = guid->data3;
|
msGuid.Data3 = guid.data3;
|
||||||
msGuid.Data1 = guid->data1;
|
msGuid.Data1 = guid.data1;
|
||||||
for (int i = 0; i < 8; i++){
|
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("MSGUID DATA4 BYTE " << i << ": ");
|
||||||
//log_debugcpp(print_as_binary(8, uint32_t, msGuid.Data4[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) {
|
HRESULT EndpointVolumeCallback::OnNotify(PAUDIO_VOLUME_NOTIFICATION_DATA pNotify) {
|
||||||
if (pNotify == NULL) return E_INVALIDARG;
|
if (pNotify == NULL) return E_INVALIDARG;
|
||||||
|
|
||||||
//TODO: el default = objcopy frees?
|
|
||||||
//delete osh->getEndpointHandlers().at(this->ep->getIndex())->getCallbackInfo()->caller;
|
//delete osh->getEndpointHandlers().at(this->ep->getIndex())->getCallbackInfo()->caller;
|
||||||
//osh->getEndpointHandlers().at(this->ep->getIndex())->getCallbackInfo()->caller.freeData4();
|
//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.
|
//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.
|
//TIP: There used to be log messages here. Now, it's a ghost town.
|
||||||
GUID tempMsGuid = NGuidToGUID(guid);
|
GUID tempMsGuid = NGuidToGUID(guid);
|
||||||
if (channel == AudioChannel::CHANNEL_MAIN) {
|
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);
|
GUID tempMsGuid = NGuidToGUID(guid);
|
||||||
if(FAILED(endpointVolume->SetMute(muted, &tempMsGuid))) { /* TIP: Above */ };
|
if(FAILED(endpointVolume->SetMute(muted, &tempMsGuid))) { /* TIP: Above */ };
|
||||||
}
|
}
|
||||||
|
|
@ -197,6 +196,10 @@ void Overseer::initCOMLibrary() {
|
||||||
GUID tempGuid;
|
GUID tempGuid;
|
||||||
if(FAILED(CoCreateGuid(&tempGuid))) { log_debugcpp("Failed to obtain GUID: " ); };
|
if(FAILED(CoCreateGuid(&tempGuid))) { log_debugcpp("Failed to obtain GUID: " ); };
|
||||||
this->guid = GUIDToNGuid(&tempGuid);
|
this->guid = GUIDToNGuid(&tempGuid);
|
||||||
|
|
||||||
|
//if(FAILED(CoCreateInstance(__uuidof(CPolicyConfigClient),
|
||||||
|
// NULL, CLSCTX_ALL, __uuidof(IPolicyConfig10), (LPVOID *)&policyConfig))) {exit(-1);}
|
||||||
|
|
||||||
//TODO: Release lpguid?
|
//TODO: Release lpguid?
|
||||||
//TODO: Uninitialize COM
|
//TODO: Uninitialize COM
|
||||||
}
|
}
|
||||||
|
|
@ -244,9 +247,9 @@ void Overseer::reloadEndpoints() {
|
||||||
LPWSTR id = nullptr;
|
LPWSTR id = nullptr;
|
||||||
|
|
||||||
for (unsigned int j = 0; j < numPlaybackEndpoints; j++){
|
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);
|
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) {
|
if (comparison - 2 == 0) {
|
||||||
log_wdebugcpp("ola defaul de " << i << " es " << id);
|
log_wdebugcpp("ola defaul de " << i << " es " << id);
|
||||||
playbackDevices.at(j)->setRoles((1 << i));
|
playbackDevices.at(j)->setRoles((1 << i));
|
||||||
|
|
@ -273,9 +276,8 @@ Overseer::Overseer(){
|
||||||
|
|
||||||
//int Overseer::getDefaultCaptureEndpoint(Endpoint** defaultEndpoint);
|
//int Overseer::getDefaultCaptureEndpoint(Endpoint** defaultEndpoint);
|
||||||
|
|
||||||
//TODO guid
|
NGuid Overseer::getGuid() {
|
||||||
NGuid* Overseer::getGuid() {
|
return guid;
|
||||||
return &guid;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<Endpoint*> Overseer::getPlaybackEndpoints() {
|
std::vector<Endpoint*> Overseer::getPlaybackEndpoints() {
|
||||||
|
|
|
||||||
|
|
@ -1,16 +1,15 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
#define WIN32_LEAN_AND_MEAN
|
#define WIN32_LEAN_AND_MEAN
|
||||||
//done by qt by def #define UNICODE
|
#define _WIN32_WINNT 0x0A00
|
||||||
|
#include <sdkddkver.h>
|
||||||
|
|
||||||
//#include "debug.h"
|
//done by qt by def #define UNICODE
|
||||||
/* #include <vector> */
|
|
||||||
/* #include <iostream> */
|
|
||||||
/* #include <wstring> */
|
|
||||||
|
|
||||||
#include <Windows.h>
|
#include <Windows.h>
|
||||||
#include <mmdeviceapi.h>
|
#include <mmdeviceapi.h>
|
||||||
#include <combaseapi.h>
|
#include <combaseapi.h>
|
||||||
#include <initguid.h>
|
#include <initguid.h>
|
||||||
|
#include <Propidl.h>
|
||||||
#include <functiondiscoverykeys_devpkey.h>
|
#include <functiondiscoverykeys_devpkey.h>
|
||||||
|
|
||||||
#include <endpointvolume.h>
|
#include <endpointvolume.h>
|
||||||
|
|
@ -20,6 +19,8 @@
|
||||||
//#include <comip.h>
|
//#include <comip.h>
|
||||||
#include <Winerror.h>
|
#include <Winerror.h>
|
||||||
#include <stringapiset.h>
|
#include <stringapiset.h>
|
||||||
|
#include "ipolicyconfig.h"
|
||||||
|
#include <Mmreg.h>
|
||||||
|
|
||||||
#include "global.h"
|
#include "global.h"
|
||||||
#include "contclasses.h"
|
#include "contclasses.h"
|
||||||
|
|
@ -32,10 +33,10 @@ class Endpoint {
|
||||||
Endpoint(IMMDevice* endpoint, uint64_t idx);
|
Endpoint(IMMDevice* endpoint, uint64_t idx);
|
||||||
uint64_t getIndex();
|
uint64_t getIndex();
|
||||||
void setIndex(uint64_t idx);
|
void setIndex(uint64_t idx);
|
||||||
void setVolume(NGuid* guid, int channel, float volume);
|
void setVolume(NGuid guid, int channel, float volume);
|
||||||
uint32_t getChannelCount();
|
uint32_t getChannelCount();
|
||||||
float getVolume(int channel);
|
float getVolume(int channel);
|
||||||
void setMute(NGuid* guid, bool muted);
|
void setMute(NGuid guid, bool muted);
|
||||||
bool getMute();
|
bool getMute();
|
||||||
void setState(uint8_t state);
|
void setState(uint8_t state);
|
||||||
uint8_t getState();
|
uint8_t getState();
|
||||||
|
|
@ -82,7 +83,7 @@ class Overseer {
|
||||||
Overseer();
|
Overseer();
|
||||||
std::vector<Endpoint*> getPlaybackEndpoints();
|
std::vector<Endpoint*> getPlaybackEndpoints();
|
||||||
void reloadEndpoints();
|
void reloadEndpoints();
|
||||||
NGuid* getGuid();
|
NGuid getGuid();
|
||||||
//~Overseer();
|
//~Overseer();
|
||||||
//int getDefaultPlaybackEndpoint(Endpoint** defaultEndpoint);
|
//int getDefaultPlaybackEndpoint(Endpoint** defaultEndpoint);
|
||||||
//int getDefaultCaptureEndpoint(Endpoint** defaultEndpoint);
|
//int getDefaultCaptureEndpoint(Endpoint** defaultEndpoint);
|
||||||
|
|
@ -94,6 +95,7 @@ class Overseer {
|
||||||
NGuid guid;
|
NGuid guid;
|
||||||
unsigned int numPlaybackEndpoints;
|
unsigned int numPlaybackEndpoints;
|
||||||
IMMDeviceEnumerator *deviceEnumerator;
|
IMMDeviceEnumerator *deviceEnumerator;
|
||||||
|
IPolicyConfig *policyConfig;
|
||||||
std::vector<Endpoint*> playbackDevices;
|
std::vector<Endpoint*> playbackDevices;
|
||||||
void initCOMLibrary();
|
void initCOMLibrary();
|
||||||
//IMMDeviceCollection *deviceCollection;
|
//IMMDeviceCollection *deviceCollection;
|
||||||
|
|
|
||||||
|
|
@ -9,6 +9,18 @@
|
||||||
#pragma once
|
#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")
|
interface DECLSPEC_UUID("f8679f50-850a-41cf-9c72-430f290290c8")
|
||||||
IPolicyConfig;
|
IPolicyConfig;
|
||||||
class DECLSPEC_UUID("870af99c-171d-4f9e-af0d-e63df40c2bc9")
|
class DECLSPEC_UUID("870af99c-171d-4f9e-af0d-e63df40c2bc9")
|
||||||
|
|
@ -86,8 +98,8 @@ public:
|
||||||
);
|
);
|
||||||
|
|
||||||
virtual HRESULT STDMETHODCALLTYPE SetDefaultEndpoint(
|
virtual HRESULT STDMETHODCALLTYPE SetDefaultEndpoint(
|
||||||
__in PCWSTR wszDeviceId,
|
PCWSTR wszDeviceId,
|
||||||
__in ERole eRole
|
ERole eRole
|
||||||
);
|
);
|
||||||
|
|
||||||
virtual HRESULT STDMETHODCALLTYPE SetEndpointVisibility(
|
virtual HRESULT STDMETHODCALLTYPE SetEndpointVisibility(
|
||||||
|
|
@ -96,85 +108,85 @@ public:
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
interface DECLSPEC_UUID("568b9108-44bf-40b4-9006-86afe5b5a620")
|
/* interface DECLSPEC_UUID("568b9108-44bf-40b4-9006-86afe5b5a620") */
|
||||||
IPolicyConfigVista;
|
/* IPolicyConfigVista; */
|
||||||
class DECLSPEC_UUID("294935CE-F637-4E7C-A41B-AB255460B862")
|
/* class DECLSPEC_UUID("294935CE-F637-4E7C-A41B-AB255460B862") */
|
||||||
CPolicyConfigVistaClient;
|
/* CPolicyConfigVistaClient; */
|
||||||
// ----------------------------------------------------------------------------
|
/* // ---------------------------------------------------------------------------- */
|
||||||
// class CPolicyConfigVistaClient
|
/* // class CPolicyConfigVistaClient */
|
||||||
// {294935CE-F637-4E7C-A41B-AB255460B862}
|
/* // {294935CE-F637-4E7C-A41B-AB255460B862} */
|
||||||
//
|
/* // */
|
||||||
// interface IPolicyConfigVista
|
/* // interface IPolicyConfigVista */
|
||||||
// {568b9108-44bf-40b4-9006-86afe5b5a620}
|
/* // {568b9108-44bf-40b4-9006-86afe5b5a620} */
|
||||||
//
|
/* // */
|
||||||
// Query interface:
|
/* // Query interface: */
|
||||||
// CComPtr<IPolicyConfigVista> PolicyConfig;
|
/* // CComPtr<IPolicyConfigVista> PolicyConfig; */
|
||||||
// PolicyConfig.CoCreateInstance(__uuidof(CPolicyConfigVistaClient));
|
/* // PolicyConfig.CoCreateInstance(__uuidof(CPolicyConfigVistaClient)); */
|
||||||
//
|
/* // */
|
||||||
// @compatible: Windows Vista and Later
|
/* // @compatible: Windows Vista and Later */
|
||||||
// ----------------------------------------------------------------------------
|
/* // ---------------------------------------------------------------------------- */
|
||||||
interface IPolicyConfigVista : public IUnknown
|
/* interface IPolicyConfigVista : public IUnknown */
|
||||||
{
|
/* { */
|
||||||
public:
|
/* public: */
|
||||||
|
|
||||||
virtual HRESULT GetMixFormat(
|
/* virtual HRESULT GetMixFormat( */
|
||||||
PCWSTR,
|
/* PCWSTR, */
|
||||||
WAVEFORMATEX **
|
/* WAVEFORMATEX ** */
|
||||||
); // not available on Windows 7, use method from IPolicyConfig
|
/* ); // not available on Windows 7, use method from IPolicyConfig */
|
||||||
|
|
||||||
virtual HRESULT STDMETHODCALLTYPE GetDeviceFormat(
|
/* virtual HRESULT STDMETHODCALLTYPE GetDeviceFormat( */
|
||||||
PCWSTR,
|
/* PCWSTR, */
|
||||||
INT,
|
/* INT, */
|
||||||
WAVEFORMATEX **
|
/* WAVEFORMATEX ** */
|
||||||
);
|
/* ); */
|
||||||
|
|
||||||
virtual HRESULT STDMETHODCALLTYPE SetDeviceFormat(
|
/* virtual HRESULT STDMETHODCALLTYPE SetDeviceFormat( */
|
||||||
PCWSTR,
|
/* PCWSTR, */
|
||||||
WAVEFORMATEX *,
|
/* WAVEFORMATEX *, */
|
||||||
WAVEFORMATEX *
|
/* WAVEFORMATEX * */
|
||||||
);
|
/* ); */
|
||||||
|
|
||||||
virtual HRESULT STDMETHODCALLTYPE GetProcessingPeriod(
|
/* virtual HRESULT STDMETHODCALLTYPE GetProcessingPeriod( */
|
||||||
PCWSTR,
|
/* PCWSTR, */
|
||||||
INT,
|
/* INT, */
|
||||||
PINT64,
|
/* PINT64, */
|
||||||
PINT64
|
/* PINT64 */
|
||||||
); // not available on Windows 7, use method from IPolicyConfig
|
/* ); // not available on Windows 7, use method from IPolicyConfig */
|
||||||
|
|
||||||
virtual HRESULT STDMETHODCALLTYPE SetProcessingPeriod(
|
/* virtual HRESULT STDMETHODCALLTYPE SetProcessingPeriod( */
|
||||||
PCWSTR,
|
/* PCWSTR, */
|
||||||
PINT64
|
/* PINT64 */
|
||||||
); // not available on Windows 7, use method from IPolicyConfig
|
/* ); // not available on Windows 7, use method from IPolicyConfig */
|
||||||
|
|
||||||
virtual HRESULT STDMETHODCALLTYPE GetShareMode(
|
/* virtual HRESULT STDMETHODCALLTYPE GetShareMode( */
|
||||||
PCWSTR,
|
/* PCWSTR, */
|
||||||
struct DeviceShareMode *
|
/* struct DeviceShareMode * */
|
||||||
); // not available on Windows 7, use method from IPolicyConfig
|
/* ); // not available on Windows 7, use method from IPolicyConfig */
|
||||||
|
|
||||||
virtual HRESULT STDMETHODCALLTYPE SetShareMode(
|
/* virtual HRESULT STDMETHODCALLTYPE SetShareMode( */
|
||||||
PCWSTR,
|
/* PCWSTR, */
|
||||||
struct DeviceShareMode *
|
/* struct DeviceShareMode * */
|
||||||
); // not available on Windows 7, use method from IPolicyConfig
|
/* ); // not available on Windows 7, use method from IPolicyConfig */
|
||||||
|
|
||||||
virtual HRESULT STDMETHODCALLTYPE GetPropertyValue(
|
/* virtual HRESULT STDMETHODCALLTYPE GetPropertyValue( */
|
||||||
PCWSTR,
|
/* PCWSTR, */
|
||||||
const PROPERTYKEY &,
|
/* const PROPERTYKEY &, */
|
||||||
PROPVARIANT *
|
/* PROPVARIANT * */
|
||||||
);
|
/* ); */
|
||||||
|
|
||||||
virtual HRESULT STDMETHODCALLTYPE SetPropertyValue(
|
/* virtual HRESULT STDMETHODCALLTYPE SetPropertyValue( */
|
||||||
PCWSTR,
|
/* PCWSTR, */
|
||||||
const PROPERTYKEY &,
|
/* const PROPERTYKEY &, */
|
||||||
PROPVARIANT *
|
/* PROPVARIANT * */
|
||||||
);
|
/* ); */
|
||||||
|
|
||||||
virtual HRESULT STDMETHODCALLTYPE SetDefaultEndpoint(
|
/* virtual HRESULT STDMETHODCALLTYPE SetDefaultEndpoint( */
|
||||||
__in PCWSTR wszDeviceId,
|
/* __in PCWSTR wszDeviceId, */
|
||||||
__in ERole eRole
|
/* __in ERole eRole */
|
||||||
);
|
/* ); */
|
||||||
|
|
||||||
virtual HRESULT STDMETHODCALLTYPE SetEndpointVisibility(
|
/* virtual HRESULT STDMETHODCALLTYPE SetEndpointVisibility( */
|
||||||
PCWSTR,
|
/* PCWSTR, */
|
||||||
INT
|
/* INT */
|
||||||
); // not available on Windows 7, use method from IPolicyConfig
|
/* ); // not available on Windows 7, use method from IPolicyConfig */
|
||||||
};
|
/* }; */
|
||||||
|
|
|
||||||
|
|
@ -2,9 +2,6 @@
|
||||||
#include "contclasses.h"
|
#include "contclasses.h"
|
||||||
//TODO: pragma once
|
//TODO: pragma once
|
||||||
|
|
||||||
//TODO: ?????
|
|
||||||
Overseer OverseerHandler::os;
|
|
||||||
|
|
||||||
EndpointHandler::EndpointHandler(uint64_t idx) {
|
EndpointHandler::EndpointHandler(uint64_t idx) {
|
||||||
//std::vector<Endpoint*> endpoints = osh->getPlaybackEndpoints().at(idx);
|
//std::vector<Endpoint*> endpoints = osh->getPlaybackEndpoints().at(idx);
|
||||||
this->ep = osh->getPlaybackEndpoints().at(idx);
|
this->ep = osh->getPlaybackEndpoints().at(idx);
|
||||||
|
|
@ -39,13 +36,13 @@ uint64_t EndpointHandler::getIndex(){
|
||||||
/*
|
/*
|
||||||
* -1 for master volume
|
* -1 for master volume
|
||||||
*/
|
*/
|
||||||
void EndpointHandler::setVolume(NGuid* guid, int channel, int value){
|
void EndpointHandler::setVolume(NGuid guid, int channel, int value){
|
||||||
if (channel == AudioChannel::CHANNEL_MAIN)
|
if (channel == AudioChannel::CHANNEL_MAIN)
|
||||||
ep->setVolume(guid, channel, (float)value / 100);
|
ep->setVolume(guid, channel, (float)value / 100);
|
||||||
else ep->setVolume(guid, channel, (float)value / 100);
|
else ep->setVolume(guid, channel, (float)value / 100);
|
||||||
}
|
}
|
||||||
|
|
||||||
void EndpointHandler::setMute(NGuid* guid, bool muted){
|
void EndpointHandler::setMute(NGuid guid, bool muted){
|
||||||
ep->setMute(guid, muted);
|
ep->setMute(guid, muted);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -79,8 +76,12 @@ EndpointHandler::~EndpointHandler() {
|
||||||
delete ep;
|
delete ep;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
OverseerHandler::OverseerHandler() {
|
||||||
|
this->os = new Overseer();
|
||||||
|
}
|
||||||
|
|
||||||
std::vector<Endpoint*> OverseerHandler::getPlaybackEndpoints() {
|
std::vector<Endpoint*> OverseerHandler::getPlaybackEndpoints() {
|
||||||
return this->os.getPlaybackEndpoints();
|
return this->os->getPlaybackEndpoints();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -89,7 +90,7 @@ std::vector<EndpointHandler*> OverseerHandler::getEndpointHandlers(){
|
||||||
}
|
}
|
||||||
|
|
||||||
uint64_t OverseerHandler::getPlaybackEndpointsCount(){
|
uint64_t OverseerHandler::getPlaybackEndpointsCount(){
|
||||||
return this->os.getPlaybackEndpoints().size();
|
return this->os->getPlaybackEndpoints().size();
|
||||||
}
|
}
|
||||||
|
|
||||||
void OverseerHandler::reloadEndpointHandlers(){
|
void OverseerHandler::reloadEndpointHandlers(){
|
||||||
|
|
@ -113,8 +114,8 @@ void OverseerHandler::reloadEndpointHandlers(){
|
||||||
//setEndpointHandlers(ephs);
|
//setEndpointHandlers(ephs);
|
||||||
}
|
}
|
||||||
|
|
||||||
NGuid* OverseerHandler::getGuid() {
|
NGuid OverseerHandler::getGuid() {
|
||||||
return this->os.getGuid();
|
return this->os->getGuid();
|
||||||
}
|
}
|
||||||
|
|
||||||
void OverseerHandler::setEndpointHandlers(std::vector<EndpointHandler*> ephs){
|
void OverseerHandler::setEndpointHandlers(std::vector<EndpointHandler*> ephs){
|
||||||
|
|
|
||||||
|
|
@ -30,7 +30,7 @@ enum Roles {
|
||||||
ROLE_CONSOLE = (1 << 0),
|
ROLE_CONSOLE = (1 << 0),
|
||||||
ROLE_MULTIMEDIA = (1 << 1),
|
ROLE_MULTIMEDIA = (1 << 1),
|
||||||
ROLE_COMMUNICATIONS = (1 << 2),
|
ROLE_COMMUNICATIONS = (1 << 2),
|
||||||
ROLE_ALL = (7 << 0),
|
ROLE_ALL = 0x07,
|
||||||
};
|
};
|
||||||
|
|
||||||
struct NGuid {
|
struct NGuid {
|
||||||
|
|
@ -79,8 +79,8 @@ public:
|
||||||
uint8_t getState();
|
uint8_t getState();
|
||||||
uint8_t getRoles();
|
uint8_t getRoles();
|
||||||
|
|
||||||
void setVolume(NGuid* guid, int channel, int value);
|
void setVolume(NGuid guid, int channel, int value);
|
||||||
void setMute(NGuid* guid, bool muted);
|
void setMute(NGuid guid, bool muted);
|
||||||
void setState(uint8_t state);
|
void setState(uint8_t state);
|
||||||
|
|
||||||
~EndpointHandler();
|
~EndpointHandler();
|
||||||
|
|
@ -94,16 +94,16 @@ private:
|
||||||
class OverseerHandler {
|
class OverseerHandler {
|
||||||
|
|
||||||
public:
|
public:
|
||||||
//OverseerHandler();
|
OverseerHandler();
|
||||||
void setEndpointHandlers(std::vector<EndpointHandler*> ephs);
|
void setEndpointHandlers(std::vector<EndpointHandler*> ephs);
|
||||||
std::vector<EndpointHandler*> getEndpointHandlers();
|
std::vector<EndpointHandler*> getEndpointHandlers();
|
||||||
std::vector<Endpoint*> getPlaybackEndpoints();
|
std::vector<Endpoint*> getPlaybackEndpoints();
|
||||||
uint64_t getPlaybackEndpointsCount();
|
uint64_t getPlaybackEndpointsCount();
|
||||||
void reloadEndpointHandlers();
|
void reloadEndpointHandlers();
|
||||||
NGuid* getGuid();
|
NGuid getGuid();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static Overseer os;
|
Overseer *os;
|
||||||
std::vector<EndpointHandler*> endpointHandlers;
|
std::vector<EndpointHandler*> endpointHandlers;
|
||||||
|
|
||||||
//std::function<void(uint64_t /* device */, uint32_t /* channel */, float /* value */)> updateFrontVolumeCallback;
|
//std::function<void(uint64_t /* device */, uint32_t /* channel */, float /* value */)> updateFrontVolumeCallback;
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,6 @@ EndpointWidget::EndpointWidget(uint64_t idx, EndpointHandler* eph, QWidget *pare
|
||||||
log_debugcpp("olaW");
|
log_debugcpp("olaW");
|
||||||
if (parent == nullptr) { log_debugcpp("owo?"); }
|
if (parent == nullptr) { log_debugcpp("owo?"); }
|
||||||
|
|
||||||
|
|
||||||
defaultRolesCheckBoxes = {
|
defaultRolesCheckBoxes = {
|
||||||
{Roles::ROLE_ALL, new QCheckBox()},
|
{Roles::ROLE_ALL, new QCheckBox()},
|
||||||
{Roles::ROLE_CONSOLE, new QCheckBox()},
|
{Roles::ROLE_CONSOLE, new QCheckBox()},
|
||||||
|
|
@ -68,14 +67,22 @@ EndpointWidget::EndpointWidget(uint64_t idx, EndpointHandler* eph, QWidget *pare
|
||||||
|
|
||||||
uint8_t assignedRoles = eph->getRoles();
|
uint8_t assignedRoles = eph->getRoles();
|
||||||
defaultRolesCheckBoxes.at(Roles::ROLE_ALL)->setCheckState(assignedRoles == Roles::ROLE_ALL ? Qt::Checked : Qt::Unchecked);
|
defaultRolesCheckBoxes.at(Roles::ROLE_ALL)->setCheckState(assignedRoles == Roles::ROLE_ALL ? Qt::Checked : Qt::Unchecked);
|
||||||
/*
|
defaultRolesCheckBoxes.at(Roles::ROLE_ALL)->setText(STRING_ROLE_ALL);
|
||||||
* {ROLE_ALL, new QCheckBox(this)},
|
|
||||||
* {ROLE_CONSOLE, new QCheckBox(this)},
|
defaultRolesCheckBoxes.at(Roles::ROLE_CONSOLE)->setCheckState(assignedRoles & Roles::ROLE_CONSOLE ? Qt::Checked : Qt::Unchecked);
|
||||||
* {ROLE_MULTIMEDIA, new QCheckBox(this)},
|
defaultRolesCheckBoxes.at(Roles::ROLE_CONSOLE)->setText(STRING_ROLE_CONSOLE);
|
||||||
* {ROLE_COMMUNICATIONS, new QCheckBox(this)}
|
|
||||||
* };
|
defaultRolesCheckBoxes.at(Roles::ROLE_MULTIMEDIA)->setCheckState(assignedRoles & Roles::ROLE_MULTIMEDIA ? Qt::Checked : Qt::Unchecked);
|
||||||
*/
|
defaultRolesCheckBoxes.at(Roles::ROLE_MULTIMEDIA)->setText(STRING_ROLE_MULTIMEDIA);
|
||||||
|
|
||||||
|
defaultRolesCheckBoxes.at(Roles::ROLE_COMMUNICATIONS)->setCheckState(assignedRoles & Roles::ROLE_COMMUNICATIONS ? Qt::Checked : Qt::Unchecked);
|
||||||
|
defaultRolesCheckBoxes.at(Roles::ROLE_COMMUNICATIONS)->setText(STRING_ROLE_COMMUNICATIONS);
|
||||||
|
|
||||||
|
defaultRolesCheckBoxes.at(Roles::ROLE_ALL)->setText(STRING_ROLE_ALL);
|
||||||
layout->addWidget(defaultRolesCheckBoxes.at(Roles::ROLE_ALL), 3, 0);
|
layout->addWidget(defaultRolesCheckBoxes.at(Roles::ROLE_ALL), 3, 0);
|
||||||
|
layout->addWidget(defaultRolesCheckBoxes.at(Roles::ROLE_CONSOLE), 3, 1);
|
||||||
|
layout->addWidget(defaultRolesCheckBoxes.at(Roles::ROLE_MULTIMEDIA), 3, 2);
|
||||||
|
layout->addWidget(defaultRolesCheckBoxes.at(Roles::ROLE_COMMUNICATIONS), 3, 3);
|
||||||
|
|
||||||
|
|
||||||
//Polling time
|
//Polling time
|
||||||
|
|
@ -97,14 +104,14 @@ EndpointWidget::EndpointWidget(uint64_t idx, EndpointHandler* eph, QWidget *pare
|
||||||
//memcpy(osh->callbackInfo[idx]->caller, osh->getGuid(), sizeof(NGuid));
|
//memcpy(osh->callbackInfo[idx]->caller, osh->getGuid(), sizeof(NGuid));
|
||||||
|
|
||||||
//TODO: el default = objcopy frees?
|
//TODO: el default = objcopy frees?
|
||||||
eph->getCallbackInfo()->caller = *osh->getGuid();
|
eph->getCallbackInfo()->caller = osh->getGuid();
|
||||||
mainSlider->blockSignals(false);
|
mainSlider->blockSignals(false);
|
||||||
muteButton->blockSignals(false);
|
muteButton->blockSignals(false);
|
||||||
});
|
});
|
||||||
timer->start(10);
|
timer->start(10);
|
||||||
|
|
||||||
layout->addItem(new QSpacerItem(1, 1, QSizePolicy::Minimum, QSizePolicy::MinimumExpanding), 3, 0);
|
layout->addItem(new QSpacerItem(1, 1, QSizePolicy::Minimum, QSizePolicy::MinimumExpanding), 4, 0);
|
||||||
layout->addItem(new QSpacerItem(1, 1, QSizePolicy::Minimum, QSizePolicy::MinimumExpanding), 3, 1);
|
layout->addItem(new QSpacerItem(1, 1, QSizePolicy::Minimum, QSizePolicy::MinimumExpanding), 4, 1);
|
||||||
log_debugcpp("ENDPOINT_WIDGETED");
|
log_debugcpp("ENDPOINT_WIDGETED");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -230,7 +237,7 @@ void MainWindow::reloadEndpointWidgets() {
|
||||||
size_t i = 0;
|
size_t i = 0;
|
||||||
for (; i < (osh->getEndpointHandlers().size()); i++) {
|
for (; i < (osh->getEndpointHandlers().size()); i++) {
|
||||||
log_debugcpp("EPWidget creation");
|
log_debugcpp("EPWidget creation");
|
||||||
osh->getEndpointHandlers().at(i)->getCallbackInfo()->caller = *osh->getGuid();
|
osh->getEndpointHandlers().at(i)->getCallbackInfo()->caller = osh->getGuid();
|
||||||
EndpointWidget *epw = new EndpointWidget(i, osh->getEndpointHandlers().at(i), widget);
|
EndpointWidget *epw = new EndpointWidget(i, osh->getEndpointHandlers().at(i), widget);
|
||||||
//TODO: ALWAYS PUSH BACK??? PSZ CHANGE DIS WHEN IMPLEMENTING DYN ENDPOINT DET
|
//TODO: ALWAYS PUSH BACK??? PSZ CHANGE DIS WHEN IMPLEMENTING DYN ENDPOINT DET
|
||||||
ews.push_back(epw);
|
ews.push_back(epw);
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,7 @@
|
||||||
#include "qtclasses.h"
|
#include "qtclasses.h"
|
||||||
#include "global.h"
|
#include "global.h"
|
||||||
|
|
||||||
OverseerHandler *osh = new OverseerHandler();
|
OverseerHandler *osh = nullptr;
|
||||||
|
|
||||||
QApplication* createApplication(int &argc, char *argv[])
|
QApplication* createApplication(int &argc, char *argv[])
|
||||||
{
|
{
|
||||||
|
|
@ -44,6 +44,8 @@ int main (int argc, char* argv[]) {
|
||||||
startSingleInstanceServer("Mixer");
|
startSingleInstanceServer("Mixer");
|
||||||
else exit(0);
|
else exit(0);
|
||||||
|
|
||||||
|
osh = new OverseerHandler();
|
||||||
|
|
||||||
//INIT CONT
|
//INIT CONT
|
||||||
log_debugcpp("main init");
|
log_debugcpp("main init");
|
||||||
osh->reloadEndpointHandlers();
|
osh->reloadEndpointHandlers();
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue