wip: heap corruption (3rd item main volume)
This commit is contained in:
parent
60e3178e9a
commit
14fae226bc
6 changed files with 107 additions and 52 deletions
|
|
@ -184,11 +184,9 @@ Endpoint::Endpoint(IMMDevice* ep, uint64_t idx){
|
|||
//todo: preguntitas owindows dword no es uint32_t even tho mingw mingas
|
||||
if(FAILED(endpoint->GetState(&this->endpointState))) {exit(-1);};
|
||||
|
||||
if (this->endpointState == DEVICE_STATE_ACTIVE) {
|
||||
if(FAILED(endpoint->Activate(IID_IAudioEndpointVolume, CLSCTX_ALL, NULL, (void**)&endpointVolume))) { /* log_debugcpp("si"); */ };
|
||||
activateEndpointVolume();
|
||||
|
||||
if (FAILED(endpointVolume->GetChannelCount(&channelCount))) {};/* log_debugcpp("get channel count fail"); */
|
||||
}
|
||||
reloadEndpointChannels();
|
||||
|
||||
//todo:: atexit into exit Gather ID
|
||||
LPWSTR tempString = nullptr;
|
||||
|
|
@ -206,6 +204,17 @@ Endpoint::Endpoint(IMMDevice* ep, uint64_t idx){
|
|||
friendlyName = std::wstring(pv.pwszVal);
|
||||
}
|
||||
|
||||
void Endpoint::activateEndpointVolume() {
|
||||
if (this->endpointVolume == nullptr)
|
||||
if(FAILED(endpoint->Activate(IID_IAudioEndpointVolume, CLSCTX_ALL, NULL, (void**)&this->endpointVolume))) { log_debugcpp(std::string("no endpointVolume (IAudioEndpointVolume)")); };
|
||||
}
|
||||
|
||||
void Endpoint::reloadEndpointChannels() {
|
||||
if (this->endpointState == DEVICE_STATE_ACTIVE) {
|
||||
if (FAILED(endpointVolume->GetChannelCount(&channelCount))) {};/* log_debugcpp("get channel count fail"); */
|
||||
}
|
||||
}
|
||||
|
||||
void Endpoint::setIndex(uint64_t idx){
|
||||
this->idx = idx;
|
||||
}
|
||||
|
|
@ -246,6 +255,8 @@ bool Endpoint::getMute(){
|
|||
|
||||
void Endpoint::setState(uint8_t state){
|
||||
this->endpointState = state;
|
||||
if(state == EndpointState::ENDPOINT_ACTIVE)
|
||||
this->reloadEndpointChannels();
|
||||
}
|
||||
|
||||
size_t Endpoint::getState(){
|
||||
|
|
@ -264,10 +275,13 @@ void Endpoint::setVolume(NGuid guid, int channel, float volume) {
|
|||
|
||||
void Endpoint::setMute(NGuid guid, bool muted) {
|
||||
GUID tempMsGuid = NGuidToGUID(guid);
|
||||
if(FAILED(endpointVolume->SetMute(muted, &tempMsGuid))) { /* TIP: Above */ };
|
||||
if(FAILED(endpointVolume->SetMute(muted, &tempMsGuid))) { log_wdebugcpp(std::wstring(L"EndpointVolume null?")); };
|
||||
}
|
||||
|
||||
void Endpoint::setVolumeCallback(EndpointVolumeCallback *epc){
|
||||
if(endpointVolume == nullptr) {
|
||||
this->activateEndpointVolume();
|
||||
}
|
||||
endpointVolume->RegisterControlChangeNotify((IAudioEndpointVolumeCallback*)epc);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue