#pragma once #include "global.h" #include "settings.h" #include "contsessionclasses.h" //#define invoke_mem_fn(object,ptrToMember) ((object).*(ptrToMember)) //#define pinvoke_mem_fn(object,ptrToMember) ((object)->*(ptrToMember)) class EndpointWidget; class Endpoint; class EndpointVolumeCallback; class Overseer; class SessionHandler; class EndpointNewSessionCallback; struct BackEndpointVolumeCallbackInfo { NGuid caller; bool muted; float mainVolume; size_t channels; std::vector channelVolumes; bool updateName = false; }; void setConfigDirToDefaults(); class EndpointHandler { public: EndpointHandler(uint64_t idx, Flows flow); void setBackEndpointVolumeCallbackInfoContent(uint8_t state); //todo: replace all getEndpointHandler() //todo: name refactor BackEndpointVolumeCallbackInfo* getCallbackInfo(); uint32_t getChannelCount(); void setIndex(uint64_t idx); uint64_t getIndex(); void setVolume(int channel, float volume); std::wstring getName(); void setName(std::wstring newName); std::wstring getId(); void setFrontVisibilityInfo(EndpointState state, uint64_t frontIdx); uint64_t getFrontVisibilityIndex(); EndpointState getFrontVisibilityState(); Flows getFlow(); float getVolume(int channel); bool getMute(); size_t getState(); uint8_t getRoles(); void setRoles(Roles newRole); void assignRoles(Roles newRole); void removeRoles(Roles newRole); void setVolume(NGuid guid, int channel, int value); void setMute(NGuid guid, bool muted); void setState(uint8_t state); void setState(uint8_t state, uint64_t idx); float getPeakVolume(); /* sessions */ size_t getSessionCount(); std::vector getSessionHandlers(); void createNewSession(); Endpoint* getEndpoint(); /*Session*/ void addSessionSendFront(Session* session); void setAddSessionWidgetFunction(std::function addSessionWidget); void setRemoveSessionWidgetFunction(std::function removeSessionWidget); void sendSessionToFront(SessionHandler* sh); void removeSessionFromFront(SessionHandler* sh); void deleteSessions(); void createSessionHandlers(); std::mutex sessionHandlersMutex; void lockSessionCollections(); void unlockSessionCollections(); ~EndpointHandler(); private: std::vector getSessions(); uint64_t idx; Endpoint *ep = nullptr; EndpointVolumeCallback *epc = nullptr; Flows flow; BackEndpointVolumeCallbackInfo callbackInfo; struct EndpointHandlerFrontVisibility { EndpointState visibility = EndpointState::ENDPOINT_ALL; uint64_t frontIdx = INT_MAX; }; EndpointHandlerFrontVisibility ephfv; EndpointNewSessionCallback* ensc; std::vector sessionHandlers; std::function addSessionWidget; std::function removeSessionWidget; //QSlider *slidy; }; class OverseerHandler { public: OverseerHandler(); static void setSettingsPath(std::string path); static std::string getSettingsPath(); static inline std::string settingsPath; void updateStartupConfig(bool onStartup); void setStartupConfig(bool onStartup); void populateSystemValues(); void openControlPanel(); ProcessedNativeEvent processTopLevelWindowMessage(void* msg); bool isLightMode(); bool isToRunAtStartup(); uint32_t getAccentColor(); //void setChangeFrontDefaultsFunction(std::function changeFrontDefaults); //void changeFrontDefaultsCallback(Roles role, std::wstring endpointId); void roleBucketEntryCallback(Roles role, std::wstring endpointId); void setRoleBucketEntryFunction(std::function roleBucketEntry); void updateFrontEndpointName(Endpoint* ep); //void setReviseEndpointShowingFunction(std::function reviseEndpointShowing); void reviseEndpointShowing(std::wstring endpointId, EndpointState state); void setRemoveEndpointWidgetFunction(std::function removeEndpointWidget); void setAddEndpointWidgetFunction(std::function addEndpointWidget); void setEndpointHandlers(std::vector ephs); std::vector getPlaybackEndpointHandlers(); std::vector getCaptureEndpointHandlers(); std::vector getPlaybackEndpoints(); std::vector getCaptureEndpoints(); void pushBackEndpointHandler(EndpointHandler* eph, Flows flow); uint64_t getPlaybackEndpointsCount(); uint64_t getCaptureEndpointsCount(); void reloadEndpointHandlers(); EndpointHandler* addEndpoint(std::wstring endpointId, Flows *flow); NGuid getGuid(); /* * void setSessionVolumeCallback(std::function changeSessionVolume); * void setSessionVolume(float newValue, ); */ private: Overseer *os; std::vector playbackEndpointHandlers; std::vector captureEndpointHandlers; std::function changeFrontDefaults; std::function removeEndpointWidget; std::function addEndpointWidget; std::function roleBucketEntry; /* Session's */ std::function changeSessionVolume; //std::function updateFrontVolumeCallback; //std::function updateFrontMuteCallback; };