cambiada curva de volume de cúbia a cuadrática, en pruebas a ver si es

suficiente.
valuebox de volumen en decibelios.
This commit is contained in:
snt 2024-05-20 20:08:26 +02:00
parent 5d56921aeb
commit f0f6e595fb
3 changed files with 12 additions and 6 deletions

View file

@ -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);

View file

@ -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;
}

View file

@ -1,5 +1,5 @@
#include "slidergroup.h"
#include <cmath>
#include <QWidget>
#include <QVBoxLayout>
@ -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);
}