failed attempt at redrawing
This commit is contained in:
parent
308a0486b6
commit
c28ec1f11d
8 changed files with 142 additions and 25 deletions
|
|
@ -1,5 +1,50 @@
|
|||
#include <backlasses.h>
|
||||
|
||||
ULONG EndpointCallback::AddRef(){
|
||||
return InterlockedIncrement(&ref);
|
||||
}
|
||||
|
||||
ULONG EndpointCallback::Release(){
|
||||
ULONG tempRef = InterlockedDecrement(&ref);
|
||||
if (tempRef == 0) {
|
||||
delete this;
|
||||
}
|
||||
return tempRef;
|
||||
}
|
||||
|
||||
HRESULT EndpointCallback::QueryInterface(REFIID riid, VOID **ppvInterface) {
|
||||
if (IID_IUnknown == riid)
|
||||
{
|
||||
AddRef();
|
||||
*ppvInterface = (IUnknown*)this;
|
||||
}
|
||||
else if (__uuidof(IAudioEndpointVolumeCallback) == riid)
|
||||
{
|
||||
AddRef();
|
||||
*ppvInterface = (IAudioEndpointVolumeCallback*)this;
|
||||
}
|
||||
else
|
||||
{
|
||||
*ppvInterface = NULL;
|
||||
return E_NOINTERFACE;
|
||||
}
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT EndpointCallback::OnNotify(PAUDIO_VOLUME_NOTIFICATION_DATA pNotify) {
|
||||
if (pNotify == NULL) return E_INVALIDARG;
|
||||
|
||||
LPGUID guid = osh->getOverseer()->getGuid();
|
||||
if (pNotify->guidEventContext != *guid) {
|
||||
osh->parseExternalEndpointCallback(this, pNotify);
|
||||
}
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
/* EndpointCallback::~EndpointCallback(){
|
||||
* PAUDIO_VOLUME_NOTIFICATION_DATA->Release();
|
||||
* } */
|
||||
|
||||
Endpoint::Endpoint(IMMDevice* ep){
|
||||
this->endpoint = ep;
|
||||
if(FAILED(endpoint->Activate(IID_IAudioEndpointVolume, CLSCTX_ALL, NULL, (void**)&endpointVolume))) { log_debugcpp("si"); };
|
||||
|
|
@ -66,6 +111,13 @@ void Endpoint::setMute() {
|
|||
if(FAILED(endpointVolume->SetMute((mut == false ? 1 : 0), NULL))) { log_debugcpp("si"); };
|
||||
}
|
||||
|
||||
void Endpoint::setCallback(EndpointCallback *epc){
|
||||
endpointVolume->RegisterControlChangeNotify((IAudioEndpointVolumeCallback*)*epc);
|
||||
}
|
||||
|
||||
void Endpoint::removeCallback(EndpointCallback *epc){
|
||||
endpointVolume->UnregisterControlChangeNotify((IAudioEndpointVolumeCallback*)*epc);
|
||||
}
|
||||
|
||||
Endpoint::~Endpoint(){
|
||||
log_debugcpp("cum");
|
||||
|
|
@ -87,6 +139,8 @@ void Overseer::initCOMLibrary(){
|
|||
(void**)&deviceEnumerator)) )
|
||||
{ log_debugcpp("si"); };
|
||||
|
||||
if(FAILED(CoCreateGuid(guid))) { log_debugcpp("guyyyyyy"); };
|
||||
|
||||
}
|
||||
|
||||
void Overseer::reloadEndpoints() {
|
||||
|
|
@ -129,6 +183,10 @@ Overseer::Overseer(){
|
|||
|
||||
//int Overseer::getDefaultCaptureEndpoint(Endpoint** defaultEndpoint);
|
||||
|
||||
LPGUID Overseer::getGuid() {
|
||||
return guid;
|
||||
}
|
||||
|
||||
std::vector<Endpoint*> Overseer::getPlaybackEndpoints() {
|
||||
return playbackDevices;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue