84 lines
2 KiB
C++
84 lines
2 KiB
C++
#pragma once
|
|
#define invoke_mem_fn(object,ptrToMember) ((object).*(ptrToMember))
|
|
#define pinvoke_mem_fn(object,ptrToMember) ((object)->*(ptrToMember))
|
|
|
|
/* #ifndef QTBLESSED */
|
|
/* //#define Q_OBJECT */
|
|
/* class QWidget{}; */
|
|
/* class QMainWindow{}; */
|
|
/* #endif */
|
|
|
|
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];
|
|
};
|
|
|
|
class EndpointHandler {
|
|
|
|
public:
|
|
EndpointHandler(uint64_t idx);
|
|
//TODO: get();
|
|
Endpoint *ep = nullptr;
|
|
EndpointCallback *epc = nullptr;
|
|
//std::wstring epName;
|
|
|
|
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;
|
|
//QSlider *slidy;
|
|
|
|
//signals:
|
|
|
|
|
|
};
|
|
|
|
|
|
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();
|
|
void updateMuteCallback(uint64_t idx, bool muted);
|
|
void setFrontMuteCallback(std::function<void(uint64_t, bool)> f);
|
|
void setFrontVolumeCallback(std::function<void(uint64_t, uint32_t, float)> f);
|
|
//void updateMainVolumeCallback(uint64_t idx, float newVal);
|
|
void updateVolumeCallback(uint64_t idx, uint32_t channel, float newVal);
|
|
|
|
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;
|
|
|
|
};
|