almost captured, only to hotplug. such is life...
This commit is contained in:
parent
8268c63835
commit
b81cde0f2a
6 changed files with 235 additions and 63 deletions
|
|
@ -33,6 +33,8 @@ class Endpoint {
|
|||
|
||||
public:
|
||||
Endpoint(IMMDevice* endpoint, uint64_t idx);
|
||||
//todo: how to forward declare delegate constructors?
|
||||
Endpoint(IMMDevice* endpoint) : Endpoint(endpoint, 0) {};
|
||||
void reloadEndpointChannels();
|
||||
uint64_t getIndex();
|
||||
void setIndex(uint64_t idx);
|
||||
|
|
@ -47,6 +49,8 @@ class Endpoint {
|
|||
void setRoles(Roles role);
|
||||
void assignRoles(Roles role);
|
||||
void removeRoles(Roles role);
|
||||
void setFlow();
|
||||
Flows getFlow();
|
||||
std::wstring getId();
|
||||
std::wstring getName();
|
||||
void setVolumeCallback(EndpointVolumeCallback *epc);
|
||||
|
|
@ -58,13 +62,17 @@ class Endpoint {
|
|||
|
||||
uint32_t channelCount = 0;
|
||||
IMMDevice* endpoint;
|
||||
IAudioEndpointVolume *endpointVolume = nullptr;
|
||||
Flows flow;
|
||||
IAudioEndpointVolume *endpointVolume = nullptr;
|
||||
IPropertyStore *properties;
|
||||
std::wstring friendlyName;
|
||||
std::wstring endpointId;
|
||||
unsigned long endpointState;
|
||||
Roles endpointRoles = (Roles)0;
|
||||
uint64_t idx;
|
||||
/* Not implemented in llvm-mingw. Sad!
|
||||
* IAudioMeterInformation *endpointPeakMeter = nullptr;
|
||||
*/
|
||||
};
|
||||
|
||||
class EndpointVolumeCallback : public IAudioEndpointVolumeCallback {
|
||||
|
|
@ -95,11 +103,12 @@ class EndpointSituationCallback : public IMMNotificationClient {
|
|||
HRESULT OnDeviceStateChanged(LPCWSTR pwstrDeviceId, DWORD dwNewState);
|
||||
HRESULT OnPropertyValueChanged(LPCWSTR pwstrDeviceId, const PROPERTYKEY key);
|
||||
|
||||
void fill(IMMDeviceEnumerator *deviceEnumerator, std::vector<Endpoint*> playbackDevices);
|
||||
void fill(IMMDeviceEnumerator *deviceEnumerator, std::vector<Endpoint*> playbackDevices, std::vector<Endpoint*> captureDevices);
|
||||
private:
|
||||
ULONG ref = 1;
|
||||
IMMDeviceEnumerator *deviceEnumerator;
|
||||
std::vector<Endpoint*> playbackDevices;
|
||||
std::vector<Endpoint*> captureDevices;
|
||||
};
|
||||
|
||||
class Overseer {
|
||||
|
|
@ -107,7 +116,10 @@ class Overseer {
|
|||
public:
|
||||
Overseer();
|
||||
std::vector<Endpoint*> getPlaybackEndpoints();
|
||||
void reloadEndpoints();
|
||||
std::vector<Endpoint*> getCaptureEndpoints();
|
||||
|
||||
void reloadEndpoints(Flows flow);
|
||||
Endpoint* addEndpoint(std::wstring endpointId, /* out */ Flows* flow);
|
||||
NGuid getGuid();
|
||||
//void setEndpointStatusCallback();
|
||||
//void setEndpointStatusCallback();
|
||||
|
|
@ -121,11 +133,12 @@ class Overseer {
|
|||
|
||||
private:
|
||||
NGuid guid;
|
||||
unsigned int numPlaybackEndpoints;
|
||||
|
||||
IMMDeviceEnumerator *deviceEnumerator;
|
||||
EndpointSituationCallback epsc;
|
||||
//IPolicyConfig *policyConfig;
|
||||
std::vector<Endpoint*> playbackDevices;
|
||||
std::vector<Endpoint*> captureDevices;
|
||||
void initCOMLibrary();
|
||||
//IMMDeviceCollection *deviceCollection;
|
||||
//int numCaptureEndpoints;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue