wip: default callback
This commit is contained in:
parent
512a42f954
commit
7f05cc09f6
7 changed files with 230 additions and 15 deletions
|
|
@ -6,6 +6,7 @@
|
|||
//done by qt by def #define UNICODE
|
||||
|
||||
#include <Windows.h>
|
||||
#include <processthreadsapi.h>
|
||||
#include <mmdeviceapi.h>
|
||||
#include <combaseapi.h>
|
||||
#include <initguid.h>
|
||||
|
|
@ -41,7 +42,8 @@ class Endpoint {
|
|||
void setState(uint8_t state);
|
||||
uint8_t getState();
|
||||
uint8_t getRoles();
|
||||
void setRoles(uint8_t role);
|
||||
void setRoles(Roles role);
|
||||
void assignRoles(uint8_t role);
|
||||
std::wstring getId();
|
||||
std::wstring getName();
|
||||
void setVolumeCallback(EndpointVolumeCallback *epc);
|
||||
|
|
@ -77,6 +79,25 @@ class EndpointVolumeCallback : public IAudioEndpointVolumeCallback {
|
|||
Endpoint* ep;
|
||||
};
|
||||
|
||||
class EndpointSituationCallback : public IMMNotificationClient {
|
||||
public:
|
||||
//EndpointSituationCallback(IMMDeviceEnumerator *deviceEnumerator, std::vector<Endpoint*> playbackDevices);
|
||||
ULONG AddRef();
|
||||
ULONG Release();
|
||||
HRESULT QueryInterface(REFIID riid, VOID **ppvInterface);
|
||||
HRESULT OnDefaultDeviceChanged(EDataFlow flow, ERole role, LPCWSTR pwstrDeviceId);
|
||||
HRESULT OnDeviceAdded(LPCWSTR pwstrDeviceId);
|
||||
HRESULT OnDeviceRemoved(LPCWSTR pwstrDeviceId);
|
||||
HRESULT OnDeviceStateChanged(LPCWSTR pwstrDeviceId, DWORD dwNewState);
|
||||
HRESULT OnPropertyValueChanged(LPCWSTR pwstrDeviceId, const PROPERTYKEY key);
|
||||
|
||||
void fill(IMMDeviceEnumerator *deviceEnumerator, std::vector<Endpoint*> playbackDevices);
|
||||
private:
|
||||
ULONG ref = 1;
|
||||
IMMDeviceEnumerator *deviceEnumerator;
|
||||
std::vector<Endpoint*> playbackDevices;
|
||||
};
|
||||
|
||||
class Overseer {
|
||||
//TODO singleton?
|
||||
public:
|
||||
|
|
@ -84,6 +105,9 @@ class Overseer {
|
|||
std::vector<Endpoint*> getPlaybackEndpoints();
|
||||
void reloadEndpoints();
|
||||
NGuid getGuid();
|
||||
//void setEndpointStatusCallback();
|
||||
//void setEndpointStatusCallback();
|
||||
|
||||
//~Overseer();
|
||||
//int getDefaultPlaybackEndpoint(Endpoint** defaultEndpoint);
|
||||
//int getDefaultCaptureEndpoint(Endpoint** defaultEndpoint);
|
||||
|
|
@ -95,7 +119,8 @@ class Overseer {
|
|||
NGuid guid;
|
||||
unsigned int numPlaybackEndpoints;
|
||||
IMMDeviceEnumerator *deviceEnumerator;
|
||||
IPolicyConfig *policyConfig;
|
||||
EndpointSituationCallback epsc;
|
||||
//IPolicyConfig *policyConfig;
|
||||
std::vector<Endpoint*> playbackDevices;
|
||||
void initCOMLibrary();
|
||||
//IMMDeviceCollection *deviceCollection;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue