Refactored program structure
This commit is contained in:
parent
e43e4c0569
commit
80685f1a21
10 changed files with 140 additions and 96 deletions
|
|
@ -1,11 +1,13 @@
|
|||
#pragma once
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
//done by qt by def #define UNICODE
|
||||
|
||||
#include "debug.h"
|
||||
//#include "debug.h"
|
||||
#include "global.h"
|
||||
#include <vector>
|
||||
#include <iostream>
|
||||
#include <wstring>
|
||||
#include "contclasses.h"
|
||||
/* #include <vector> */
|
||||
/* #include <iostream> */
|
||||
/* #include <wstring> */
|
||||
|
||||
#include <Windows.h>
|
||||
#include <mmdeviceapi.h>
|
||||
|
|
@ -20,24 +22,9 @@
|
|||
//#include <comip.h>
|
||||
#include <Winerror.h>
|
||||
|
||||
//class EndpointWidget;
|
||||
#include "contclasses.h"
|
||||
|
||||
class EndpointCallback : public IAudioEndpointVolumeCallback {
|
||||
|
||||
public:
|
||||
EndpointCallback(Endpoint* ep);
|
||||
|
||||
ULONG AddRef();
|
||||
ULONG Release();
|
||||
HRESULT QueryInterface(REFIID riid, VOID **ppvInterface);
|
||||
HRESULT OnNotify(PAUDIO_VOLUME_NOTIFICATION_DATA update);
|
||||
~EndpointCallback();
|
||||
|
||||
private:
|
||||
ULONG ref = 1;
|
||||
Endpoint* ep;
|
||||
PAUDIO_VOLUME_NOTIFICATION_DATA update;
|
||||
};
|
||||
class EndpointCallback;
|
||||
|
||||
class Endpoint {
|
||||
|
||||
|
|
@ -51,7 +38,7 @@ class Endpoint {
|
|||
float getVolume(int channel);
|
||||
void setMute();
|
||||
bool getMute();
|
||||
LPWSTR getName();
|
||||
std::wstring getName();
|
||||
void setCallback(EndpointCallback *epc);
|
||||
void removeCallback(EndpointCallback *epc);
|
||||
~Endpoint();
|
||||
|
|
@ -65,13 +52,30 @@ class Endpoint {
|
|||
// LPWSTR endpointID = NULL;
|
||||
};
|
||||
|
||||
class EndpointCallback : public IAudioEndpointVolumeCallback {
|
||||
|
||||
public:
|
||||
EndpointCallback(Endpoint* ep);
|
||||
|
||||
ULONG AddRef();
|
||||
ULONG Release();
|
||||
HRESULT QueryInterface(REFIID riid, VOID **ppvInterface);
|
||||
HRESULT OnNotify(PAUDIO_VOLUME_NOTIFICATION_DATA update);
|
||||
//~EndpointCallback();
|
||||
|
||||
private:
|
||||
ULONG ref = 1;
|
||||
Endpoint* ep;
|
||||
//PAUDIO_VOLUME_NOTIFICATION_DATA update;
|
||||
};
|
||||
|
||||
class Overseer {
|
||||
//TODO singleton?
|
||||
public:
|
||||
Overseer();
|
||||
std::vector<Endpoint*> getPlaybackEndpoints();
|
||||
void reloadEndpoints();
|
||||
LPGUID getGuid();
|
||||
NGuid getGuid();
|
||||
//~Overseer();
|
||||
//int getDefaultPlaybackEndpoint(Endpoint** defaultEndpoint);
|
||||
//int getDefaultCaptureEndpoint(Endpoint** defaultEndpoint);
|
||||
|
|
@ -80,7 +84,7 @@ class Overseer {
|
|||
~Overseer();
|
||||
|
||||
private:
|
||||
LPGUID guid;
|
||||
NGuid guid;
|
||||
unsigned int numPlaybackEndpoints;
|
||||
IMMDeviceEnumerator *deviceEnumerator;
|
||||
std::vector<Endpoint*> playbackDevices;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue