mixer/src/cont/contclasses.h
2024-02-07 16:55:44 +01:00

80 lines
1.8 KiB
C++

#pragma once
//#define invoke_mem_fn(object,ptrToMember) ((object).*(ptrToMember))
//#define pinvoke_mem_fn(object,ptrToMember) ((object)->*(ptrToMember))
class EndpointWidget;
class Endpoint;
class EndpointCallback;
class Overseer;
enum AudioChannel {
CHANNEL_LEFT = (1 << 0),
CHANNEL_RIGHT = (1 << 1),
CHANNEL_MAIN = ~0,
};
struct NGuid {
uint32_t data1;
uint16_t data2;
uint16_t data3;
unsigned char data4[8];
};
struct BackEndpointCallbackInfo {
NGuid caller;
bool muted;
float mainVolume;
size_t channels;
std::vector<float> channelVolumes;
};
class EndpointHandler {
public:
EndpointHandler(uint64_t idx);
//TODO: get();
Endpoint *ep = nullptr;
EndpointCallback *epc = nullptr;
//std::wstring epName;
BackEndpointCallbackInfo* getCallbackInfo();
uint32_t getChannelCount();
void setIndex(uint64_t idx);
uint64_t getIndex();
void setVolume(int channel, float volume);
std::wstring getName();
float getVolume(int channel);
bool getMute();
void setVolume(NGuid* guid, int channel, int value);
void setMute(NGuid* guid, bool muted);
~EndpointHandler();
private:
uint64_t idx;
BackEndpointCallbackInfo callbackInfo;
//QSlider *slidy;
};
class OverseerHandler {
public:
//OverseerHandler();
void setEndpointHandlers(std::vector<EndpointHandler*> ephs);
std::vector<EndpointHandler*> getEndpointHandlers();
std::vector<Endpoint*> getPlaybackEndpoints();
uint64_t getPlaybackEndpointsCount();
void reloadEndpointHandlers();
NGuid* getGuid();
private:
static Overseer os;
std::vector<EndpointHandler*> endpointHandlers;
//std::function<void(uint64_t /* device */, uint32_t /* channel */, float /* value */)> updateFrontVolumeCallback;
//std::function<void(uint64_t /* device */, bool /* mute */)> updateFrontMuteCallback;
};