From f0f6e595fb0797e7eaa365b486a8ed64fbcc4674 Mon Sep 17 00:00:00 2001 From: snt Date: Mon, 20 May 2024 20:08:26 +0200 Subject: [PATCH] =?UTF-8?q?cambiada=20curva=20de=20volume=20de=20c=C3=BAbi?= =?UTF-8?q?a=20a=20cuadr=C3=A1tica,=20en=20pruebas=20a=20ver=20si=20es=20s?= =?UTF-8?q?uficiente.=20valuebox=20de=20volumen=20en=20decibelios.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/audiolayerwidget.cpp | 2 +- src/miniaudioengine.cpp | 2 +- src/slidergroup.cpp | 14 ++++++++++---- 3 files changed, 12 insertions(+), 6 deletions(-) diff --git a/src/audiolayerwidget.cpp b/src/audiolayerwidget.cpp index c3b1f86..3528f50 100644 --- a/src/audiolayerwidget.cpp +++ b/src/audiolayerwidget.cpp @@ -82,7 +82,7 @@ AudioLayerWidget::AudioLayerWidget(QWidget *parent, int layer): m_pan = new SliderGroup("Pan", 0 , 255, 0, NULL); volumeBox->addWidget(m_pan); connect(m_pan, SIGNAL(valueChanged(int)), this, SLOT(panChanged(int))); - m_volume = new SliderGroup("Vol", 0 , 100, 2, NULL); + m_volume = new SliderGroup("Vol", 0, 100, 2, NULL); volumeBox->addWidget(m_volume); connect(m_volume, SIGNAL(valueChanged(int)), this, SLOT(volumeChanged(int))); volumeBox->setSpacing(0); diff --git a/src/miniaudioengine.cpp b/src/miniaudioengine.cpp index 9b2f64a..0599fcc 100644 --- a/src/miniaudioengine.cpp +++ b/src/miniaudioengine.cpp @@ -420,7 +420,7 @@ void MiniAudioEngine::volChanged(int layer, float vol) return; if (vol >= 1) vol = 0.99f; - ma_sound_group_set_fade_in_milliseconds(&m_mae.sounds[layer], -1, pow(vol, 3), FADE_TIME); + ma_sound_group_set_fade_in_milliseconds(&m_mae.sounds[layer], -1, pow(vol, 2), FADE_TIME); m_mae.currentStatus[layer].vol = vol; } diff --git a/src/slidergroup.cpp b/src/slidergroup.cpp index c8e267d..55bfcf7 100644 --- a/src/slidergroup.cpp +++ b/src/slidergroup.cpp @@ -1,5 +1,5 @@ #include "slidergroup.h" - +#include #include #include @@ -39,7 +39,10 @@ SliderGroup::SliderGroup(QString name, valueBox.setFocusPolicy(Qt::NoFocus); valueBox.setButtonSymbols(QAbstractSpinBox::NoButtons); valueBox.setMinimumWidth(50); - valueBox.setRange(min, max); + if (decimals) + valueBox.setRange(-100, 100); + else + valueBox.setRange(min, max); valueBox.setValue(0); valueBox.setDecimals(decimals); valueBox.setObjectName(name); @@ -51,7 +54,7 @@ SliderGroup::SliderGroup(QString name, layout->addWidget(&slider); layout->addWidget(&valueBox); this->setStyleSheet("border: 1px solid #5a4855;" - "width: 50px;" + "width: 60px;" "margin: 0px;" "background-color: #383034;" ); @@ -74,7 +77,10 @@ void SliderGroup::setValue(float value) valueBox.blockSignals(true); if (int(value) != slider.value()) slider.setValue(value); - valueBox.setValue(value); + if (valueBox.decimals()) + valueBox.setValue(value - 100.0f); + else + valueBox.setValue(value); slider.blockSignals(false); valueBox.blockSignals(false); }