140 lines
4.5 KiB
C++
140 lines
4.5 KiB
C++
#pragma once
|
|
|
|
#include "global.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<float> channelVolumes;
|
|
bool updateName = false;
|
|
};
|
|
|
|
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);
|
|
|
|
/* sessions */
|
|
size_t getSessionCount();
|
|
std::vector<SessionHandler*> getSessionHandlers();
|
|
void createNewSession();
|
|
Endpoint* getEndpoint();
|
|
|
|
/*Session*/
|
|
void addSessionSendFront(Session* session);
|
|
void setAddSessionWidgetFunction(std::function<void(SessionHandler*)> addSessionWidget);
|
|
void setRemoveSessionWidgetFunction(std::function<void(SessionHandler*)> removeSessionWidget);
|
|
void sendSessionToFront(SessionHandler* sh);
|
|
void removeSessionFromFront(SessionHandler* sh);
|
|
|
|
~EndpointHandler();
|
|
private:
|
|
std::vector<Session*> 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<SessionHandler*> sessionHandlers;
|
|
std::function<void(SessionHandler*)> addSessionWidget;
|
|
std::function<void(SessionHandler*)> removeSessionWidget;
|
|
//QSlider *slidy;
|
|
};
|
|
|
|
class OverseerHandler {
|
|
|
|
public:
|
|
OverseerHandler();
|
|
void openControlPanel();
|
|
|
|
void setChangeFrontDefaultsFunction(std::function<void(Roles, std::wstring)> changeFrontDefaults);
|
|
void changeFrontDefaultsCallback(Roles role, std::wstring endpointId);
|
|
|
|
void updateFrontEndpointName(Endpoint* ep);
|
|
//void setReviseEndpointShowingFunction(std::function<void(std::wstring, EndpointState)> reviseEndpointShowing);
|
|
void reviseEndpointShowing(std::wstring endpointId, EndpointState state);
|
|
void setRemoveEndpointWidgetFunction(std::function<void(uint64_t)> removeEndpointWidget);
|
|
void setAddEndpointWidgetFunction(std::function<void(EndpointHandler*)> addEndpointWidget);
|
|
|
|
void setEndpointHandlers(std::vector<EndpointHandler*> ephs);
|
|
std::vector<EndpointHandler*> getPlaybackEndpointHandlers();
|
|
std::vector<EndpointHandler*> getCaptureEndpointHandlers();
|
|
std::vector<Endpoint*> getPlaybackEndpoints();
|
|
std::vector<Endpoint*> 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<void(float)> changeSessionVolume);
|
|
* void setSessionVolume(float newValue, );
|
|
*/
|
|
|
|
private:
|
|
Overseer *os;
|
|
std::vector<EndpointHandler*> playbackEndpointHandlers;
|
|
std::vector<EndpointHandler*> captureEndpointHandlers;
|
|
std::function<void(Roles, std::wstring /* endpointid */)> changeFrontDefaults;
|
|
std::function<void(uint64_t /* epw id */)> removeEndpointWidget;
|
|
std::function<void(EndpointHandler*)> addEndpointWidget;
|
|
|
|
/* Session's */
|
|
std::function<void(float)> changeSessionVolume;
|
|
//std::function<void(uint64_t /* device */, uint32_t /* channel */, float /* value */)> updateFrontVolumeCallback;
|
|
//std::function<void(uint64_t /* device */, bool /* mute */)> updateFrontMuteCallback;
|
|
|
|
};
|