fixed 1px gaps/removed unnecesary com call

This commit is contained in:
Hane 2024-12-18 00:44:33 +01:00
commit 801adbb17e
2 changed files with 9 additions and 18 deletions

View file

@ -128,7 +128,6 @@ HRESULT EndpointNewSessionCallback::QueryInterface(REFIID riid, VOID **ppvInterf
HRESULT EndpointNewSessionCallback::OnSessionCreated(IAudioSessionControl *NewSession) {
if (eph->getFlow() == Flows::FLOW_CAPTURE) return S_OK;
HRESULT result = CoInitializeEx(NULL, COINIT_APARTMENTTHREADED | COINIT_DISABLE_OLE1DDE);
IAudioSessionControl2* sessionControl;
//ISimmpleAudioVolume* sessionVolume;
if (FAILED(NewSession->QueryInterface(__uuidof(IAudioSessionControl2), (void**)&sessionControl))) { log_wdebugcpp(L"no nueva sesion......"); };
@ -139,9 +138,6 @@ HRESULT EndpointNewSessionCallback::OnSessionCreated(IAudioSessionControl *NewSe
eph->addSessionSendFront(newSession);
}
if (result == S_OK)
CoUninitialize();
return S_OK;
}
@ -296,7 +292,7 @@ HRESULT EndpointSituationCallback::OnDeviceRemoved(LPCWSTR pwstrDeviceId) {
HRESULT EndpointSituationCallback::OnDeviceStateChanged(LPCWSTR pwstrDeviceId, DWORD dwNewState) {
std::wstring endpointId = std::wstring(pwstrDeviceId);
switch (dwNewState){
switch (dwNewState) {
case DEVICE_STATE_ACTIVE:
osh->reviseEndpointShowing(endpointId, EndpointState::ENDPOINT_ACTIVE);
break;
@ -389,12 +385,6 @@ void Endpoint::activateEndpointSessions() {
for (int i = 0; i < sessionCount; i++) {
IAudioSessionControl* sessionControlTmp;
sessionEnumerator->GetSession(i, (IAudioSessionControl**)&sessionControlTmp);
/*todo: borrar when donezo
* float test2;
* IAudioMeterInformation* ttmp = (IAudioMeterInformation*)sessionControlTmp;
* ttmp->GetPeakValue(&test2);
*/
IAudioSessionControl2* sessionControl;
sessionControlTmp->QueryInterface(__uuidof(IAudioSessionControl2), (void**)&sessionControl);
sessionControl->AddRef();
@ -566,7 +556,6 @@ void Endpoint::removeRoles(Roles role){
void Endpoint::setFlow() {
IMMEndpoint* flowGetter;
//this should be as simple as writing IID_IMMEndpoint, but it just won't find the macro, so I reimpl it. Sad.
if(FAILED(this->endpoint->QueryInterface(__uuidof(IMMEndpoint), (void**)&flowGetter)))
{ log_debugcpp("no flow..."); }
EDataFlow MSflow;
@ -790,7 +779,8 @@ ProcessedNativeEvent Overseer::processTopLevelWindowMessage(void* msg) {
MSG *message = static_cast<MSG *>(msg);
switch(message->message) {
case WM_SETTINGCHANGE:
if(!wcscmp(((wchar_t*)message->lParam), L"ImmersiveColorSet"))
//TODO: This looks like a future pain point. Ex handler would come in clutch
if(message->lParam && !wcscmp(((wchar_t*)message->lParam), L"ImmersiveColorSet"))
return updateColors();
break;
default:

View file

@ -225,7 +225,7 @@ QRect MainWindow::setSizePosition(QScreen* screen, int width, int height) {
QRect availableRes = screen->availableGeometry();
int arx1, arx2, ary1, ary2;
availableRes.getCoords(&arx1, &ary1, &arx2, &ary2);
log_debugcpp("Available res: " + std::to_string(arx1) + " " + std::to_string(arx2)+" " + std::to_string(ary1) + " " + std::to_string(ary2));
log_debugcpp("Available res: " + std::to_string(arx1) + " " + std::to_string(arx2)+" " + std::to_string(ary1) + " " + std::to_string(ary2);)
if(height > (ary2 - ary1)) height = (ary2 - ary1);
log_debugcpp("Height res: " + std::to_string(height));
@ -242,15 +242,15 @@ QRect MainWindow::setSizePosition(QScreen* screen, int width, int height) {
switch (pos) {
case SpawnPos::UP | SpawnPos::RIGHT:
this->addToolBar(Qt::BottomToolBarArea, mainMenuBar);
return QRect((arx2 - width), ary1, width, height);
return QRect((arx2 - width + 1), ary1, width, height);
break;
case SpawnPos::DOWN | SpawnPos::LEFT:
this->addToolBar(Qt::TopToolBarArea, mainMenuBar);
return QRect(arx1, (ary2-height), width, height);
return QRect(arx1, (ary2 - height + 1), width, height);
break;
case SpawnPos::DOWN | SpawnPos::RIGHT:
this->addToolBar(Qt::TopToolBarArea, mainMenuBar);
return QRect((arx2 - width), (ary2-height), width, height);
return QRect((arx2 - width + 1), (ary2 - height + 1), width, height);
break;
default:
this->addToolBar(Qt::BottomToolBarArea, mainMenuBar);
@ -414,6 +414,7 @@ SessionWidget::SessionWidget(uint64_t idx, SessionHandler* sh, QWidget *parent)
mainSlider->setValue((int)((sh->getVolumeInfo()->mainVolume + roundingFactor) * 100));
mainSlider->setPeakValue(sh->getPeakVolume());
mainSlider->update();
//log_wdebugcpp(L"Session: " + sh->getName() + L" peak value: " + std::to_wstring(sh->getPeakVolume()));
muteButton->setCheckState((sh->getVolumeInfo()->muted == false ? Qt::Unchecked : Qt::Checked));
muteButton->setText(sh->getVolumeInfo()->muted ? STRING_UNMUTE : STRING_MUTE);
//memcpy(osh->callbackInfo[idx]->caller, osh->getGuid(), sizeof(NGuid));