wip: peak meter visual ratio
This commit is contained in:
parent
dc8951776f
commit
75fdfaa095
3 changed files with 11 additions and 7 deletions
|
|
@ -104,7 +104,6 @@ Session::Session(Endpoint* ep, IAudioSessionControl2* sessionControl, size_t idx
|
|||
if (FAILED(sessionControl->QueryInterface(__uuidof(IAudioMeterInformation), (void**)&meterInformation))) { log_wdebugcpp(L"sPeakbros......"); };
|
||||
//meterInformation = (IAudioMeterInformation*)sessionControl;
|
||||
|
||||
|
||||
AudioSessionState msState;
|
||||
sessionControl->GetState(&msState);
|
||||
switch (msState) {
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
#include "qtclasses.h"
|
||||
#define POLLING_RATE 2
|
||||
|
||||
template <typename T>
|
||||
CustomWidgetEvent<T>::CustomWidgetEvent(QEvent::Type type, T payload) : QEvent(type){
|
||||
|
|
@ -32,10 +33,14 @@ void MeterSlider::paintEvent(QPaintEvent *event) {
|
|||
painter.setClipping(false);
|
||||
painter.setCompositionMode(QPainter::CompositionMode::CompositionMode_Source);
|
||||
float peakLength = (this->width() * (this->peakValue));
|
||||
double stepWidth = (double)this->width() * ((double)this->singleStep() / (this->maximum() - this->minimum()));
|
||||
//Fusion seems to fuck around with bar's height and width
|
||||
//const qreal dpr = painter->device()->devicePixelRatio();
|
||||
QStyleOptionSlider slider = QStyleOptionSlider();
|
||||
QRect test = QApplication::style()->subControlRect(QStyle::CC_Slider, (QStyleOptionComplex*)&slider, QStyle::SC_SliderHandle);
|
||||
painter.fillRect(0, (this->height() / 2) - 3, (this->width() * (this->peakValue)), 4, Qt::green);
|
||||
QStyleOptionSlider slider = QStyleOptionSlider(); //slider.initFrom(this);
|
||||
QRect test = style->subControlRect(QStyle::CC_Slider, (QStyleOptionComplex*)&slider, QStyle::SC_SliderHandle);
|
||||
//QApplication::style()->subControlRect(QStyle::CC_Slider, (QStyleOptionComplex*)&slider, QStyle::SC_SliderHandle);
|
||||
painter.fillRect(0, (this->height() / 2) - 3, (this->width() - ((this->maximum() - this->value()) * stepWidth)) * this->peakValue,
|
||||
4, Qt::green);
|
||||
}
|
||||
|
||||
void ExtendedCheckBox::customEvent(QEvent* ev) {
|
||||
|
|
@ -260,7 +265,7 @@ SessionWidget::SessionWidget(uint64_t idx, SessionHandler* sh, QWidget *parent)
|
|||
mainSlider->blockSignals(false);
|
||||
muteButton->blockSignals(false);
|
||||
});
|
||||
volumePoller->start(2);
|
||||
volumePoller->start(POLLING_RATE);
|
||||
}
|
||||
|
||||
void SessionWidget::calculateSize(uint64_t width, uint64_t height) {
|
||||
|
|
@ -507,7 +512,7 @@ EndpointWidget::EndpointWidget(EndpointHandler* eph, QWidget *parent, uint64_t i
|
|||
mainSlider->blockSignals(false);
|
||||
muteButton->blockSignals(false);
|
||||
});
|
||||
timer->start(2);
|
||||
timer->start(POLLING_RATE);
|
||||
|
||||
/* First Widget batch */
|
||||
for (size_t i = 0; i < eph->getSessionCount(); i++) {
|
||||
|
|
|
|||
|
|
@ -52,7 +52,7 @@ int main (int argc, char* argv[]) {
|
|||
* log_debugcpp(a.toStdString());
|
||||
* }
|
||||
*/
|
||||
QApplication::setStyle("Fusion");
|
||||
//QApplication::setStyle("Fusion");
|
||||
//Check if running
|
||||
//https://stackoverflow.com/questions/48060989/qt-show-application-if-currently-running
|
||||
initialize_file_log();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue