#pragma once #define WIN32_LEAN_AND_MEAN #include "debug.h" #include "global.h" #include #include #include #include #include #include #include #include #include #include //#include //#include #include class EndpointWidget; class EndpointCallback : public IAudioEndpointVolumeCallback { public: EndpointCallback(); ULONG AddRef(); ULONG Release(); HRESULT QueryInterface(REFIID riid, VOID **ppvInterface); HRESULT OnNotify(PAUDIO_VOLUME_NOTIFICATION_DATA update); ~EndpointCallback(); private: ULONG ref; PAUDIO_VOLUME_NOTIFICATION_DATA update; }; class Endpoint { public: Endpoint(IMMDevice* endpoint); void setVolume(int channel, float volume); /* float getLeftChannelVolume(); */ /* float getRightChannelVolume(); */ float getVolume(int channel); void setMute(); bool getMute(); LPWSTR getName(); void setCallback(EndpointCallback *epc); void removeCallback(EndpointCallback *epc); ~Endpoint(); private: IMMDevice* endpoint; IAudioEndpointVolume *endpointVolume ; IPropertyStore *properties; LPWSTR friendlyName; // LPWSTR endpointID = NULL; }; class Overseer { //TODO singleton? public: Overseer(); std::vector getPlaybackEndpoints(); void reloadEndpoints(); LPGUID getGuid(); //~Overseer(); //int getDefaultPlaybackEndpoint(Endpoint** defaultEndpoint); //int getDefaultCaptureEndpoint(Endpoint** defaultEndpoint); //int getCaptureEndpoints(std::vector *captureEndpoints); //IMMDeviceEnumerator** setOrigin(); ~Overseer(); private: LPGUID guid; unsigned int numPlaybackEndpoints; IMMDeviceEnumerator *deviceEnumerator; std::vector playbackDevices; void initCOMLibrary(); //IMMDeviceCollection *deviceCollection; //int numCaptureEndpoints; //std::vector *captureDevices; };