Skip to content

Commit

Permalink
fix for GH #26
Browse files Browse the repository at this point in the history
RT, Widgets: issues with the new reverb/chorus settings
  • Loading branch information
pedrolcl committed Dec 1, 2024
1 parent b9e5642 commit eaac60f
Show file tree
Hide file tree
Showing 5 changed files with 88 additions and 72 deletions.
4 changes: 4 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
2024-12-1
* fix for GH #26
RT, Widgets: issues with the new reverb/chorus settings

2024-10-20
* fix for GH #28
ALSA: emitted signal with invalid pointer
Expand Down
2 changes: 1 addition & 1 deletion library/rt-backends/fluidsynth/fluidsynthengine.h
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ class FluidSynthEngine : public QObject
static constexpr qreal DEFAULT_REVERB_SIZE = 0.5;
static constexpr qreal DEFAULT_REVERB_WIDTH = 0.8;

static constexpr qreal DEFAULT_CHORUS_DEPTH = 4.3;
static constexpr qreal DEFAULT_CHORUS_DEPTH = 4.25;
static constexpr qreal DEFAULT_CHORUS_LEVEL = 0.6;
static constexpr int DEFAULT_CHORUS_NR = 3;
static constexpr qreal DEFAULT_CHORUS_SPEED = 0.2;
Expand Down
78 changes: 44 additions & 34 deletions library/widgets/fluidsettingsdialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -84,29 +84,36 @@ FluidSettingsDialog::FluidSettingsDialog(QWidget *parent) :
auto polyphonyValidator = new QIntValidator(1, 65535, this);
ui->polyphony->setValidator(polyphonyValidator);
connect(ui->chorus_depth, &QAbstractSlider::valueChanged, this, [=](int val) {
setWidgetTip(ui->chorus_depth, QString::number(val / 10.0));
//qDebug() << "chorus depth" << val;
setWidgetTip(ui->chorus_depth, QString::number(val / CHORUS_REVERB_VALUE_SCALE, 'f', 2));
});
connect(ui->chorus_level, &QAbstractSlider::valueChanged, this, [=](int val) {
setWidgetTip(ui->chorus_level, QString::number(val / 10.0));
//qDebug() << "chorus level" << val;
setWidgetTip(ui->chorus_level, QString::number(val / CHORUS_REVERB_VALUE_SCALE, 'f', 2));
});
connect(ui->chorus_nr, &QAbstractSlider::valueChanged, this, [=](int val) {
setWidgetTip(ui->chorus_nr, QString::number(val));
});
connect(ui->chorus_speed, &QAbstractSlider::valueChanged, this, [=](int val) {
setWidgetTip(ui->chorus_speed, QString::number(val / 10.0));
//qDebug() << "chorus speed" << val;
setWidgetTip(ui->chorus_speed, QString::number(val / CHORUS_REVERB_VALUE_SCALE, 'f', 2));
});

connect(ui->reverb_damp, &QAbstractSlider::valueChanged, this, [=](int val) {
setWidgetTip(ui->reverb_damp, QString::number(val / 10.0));
//qDebug() << "reverb damp" << val;
setWidgetTip(ui->reverb_damp, QString::number(val / CHORUS_REVERB_VALUE_SCALE, 'f', 2));
});
connect(ui->reverb_level, &QAbstractSlider::valueChanged, this, [=](int val) {
setWidgetTip(ui->reverb_level, QString::number(val / 10.0));
//qDebug() << "reverb level" << val;
setWidgetTip(ui->reverb_level, QString::number(val / CHORUS_REVERB_VALUE_SCALE, 'f', 2));
});
connect(ui->reverb_size, &QAbstractSlider::valueChanged, this, [=](int val) {
setWidgetTip(ui->reverb_size, QString::number(val / 10.0));
//qDebug() << "reverb size" << val;
setWidgetTip(ui->reverb_size, QString::number(val / CHORUS_REVERB_VALUE_SCALE, 'f', 2));
});
connect(ui->reverb_width, &QAbstractSlider::valueChanged, this, [=](int val) {
setWidgetTip(ui->reverb_width, QString::number(val / 10.0));
//qDebug() << "reverb width" << val;
setWidgetTip(ui->reverb_width, QString::number(val / CHORUS_REVERB_VALUE_SCALE, 'f', 2));
});

drumstick::rt::BackendManager man;
Expand Down Expand Up @@ -246,6 +253,7 @@ void FluidSettingsDialog::chkDriverProperties(QSettings *settings)

void FluidSettingsDialog::setWidgetTip(QWidget *w, const QString &tip)
{
//qDebug() << Q_FUNC_INFO << tip;
w->setToolTip(tip);
QToolTip::showText(w->parentWidget()->mapToGlobal(w->pos()), tip);
}
Expand Down Expand Up @@ -300,20 +308,22 @@ void FluidSettingsDialog::readSettings()
ui->polyphony->setText( settings->value(QSTR_POLYPHONY, DEFAULT_POLYPHONY).toString() );
ui->soundFont->setText( settings->value(QSTR_INSTRUMENTSDEFINITION, m_defSoundFont).toString() );

ui->chorus_depth->setValue(settings->value(QSTR_CHORUS_DEPTH, DEFAULT_CHORUS_DEPTH).toFloat()
* 10);
ui->chorus_level->setValue(settings->value(QSTR_CHORUS_LEVEL, DEFAULT_CHORUS_LEVEL).toFloat()
* 10);
ui->chorus_depth->setValue(settings->value(QSTR_CHORUS_DEPTH, DEFAULT_CHORUS_DEPTH).toDouble()
* CHORUS_REVERB_VALUE_SCALE);
ui->chorus_level->setValue(settings->value(QSTR_CHORUS_LEVEL, DEFAULT_CHORUS_LEVEL).toDouble()
* CHORUS_REVERB_VALUE_SCALE);
ui->chorus_nr->setValue(settings->value(QSTR_CHORUS_NR, DEFAULT_CHORUS_NR).toInt());
ui->chorus_speed->setValue(settings->value(QSTR_CHORUS_SPEED, DEFAULT_CHORUS_SPEED).toFloat()
* 10);

ui->reverb_damp->setValue(settings->value(QSTR_REVERB_DAMP, DEFAULT_REVERB_DAMP).toFloat() * 10);
ui->reverb_level->setValue(settings->value(QSTR_REVERB_LEVEL, DEFAULT_REVERB_LEVEL).toFloat()
* 10);
ui->reverb_size->setValue(settings->value(QSTR_REVERB_SIZE, DEFAULT_REVERB_SIZE).toFloat() * 10);
ui->reverb_width->setValue(settings->value(QSTR_REVERB_WIDTH, DEFAULT_REVERB_WIDTH).toFloat()
* 10);
ui->chorus_speed->setValue(settings->value(QSTR_CHORUS_SPEED, DEFAULT_CHORUS_SPEED).toDouble()
* CHORUS_REVERB_VALUE_SCALE);

ui->reverb_damp->setValue(settings->value(QSTR_REVERB_DAMP, DEFAULT_REVERB_DAMP).toDouble()
* CHORUS_REVERB_VALUE_SCALE);
ui->reverb_level->setValue(settings->value(QSTR_REVERB_LEVEL, DEFAULT_REVERB_LEVEL).toDouble()
* CHORUS_REVERB_VALUE_SCALE);
ui->reverb_size->setValue(settings->value(QSTR_REVERB_SIZE, DEFAULT_REVERB_SIZE).toDouble()
* CHORUS_REVERB_VALUE_SCALE);
ui->reverb_width->setValue(settings->value(QSTR_REVERB_WIDTH, DEFAULT_REVERB_WIDTH).toDouble()
* CHORUS_REVERB_VALUE_SCALE);

ui->chorus->setChecked(settings->value(QSTR_CHORUS, DEFAULT_CHORUS).toInt() != 0);
ui->reverb->setChecked(settings->value(QSTR_REVERB, DEFAULT_REVERB).toInt() != 0);
Expand Down Expand Up @@ -363,14 +373,14 @@ void FluidSettingsDialog::writeSettings()
gain = ui->gain->text().toDouble();
polyphony = ui->polyphony->text().toInt();

chorus_depth = ui->chorus_depth->value() / 10.0;
chorus_level = ui->chorus_level->value() / 10.0;
chorus_depth = ui->chorus_depth->value() / CHORUS_REVERB_VALUE_SCALE;
chorus_level = ui->chorus_level->value() / CHORUS_REVERB_VALUE_SCALE;
chorus_nr = ui->chorus_nr->value();
chorus_speed = ui->chorus_speed->value() / 10.0;
reverb_damp = ui->reverb_damp->value() / 10.0;
reverb_level = ui->reverb_level->value() / 10.0;
reverb_size = ui->reverb_size->value() / 10.0;
reverb_width = ui->reverb_width->value() / 10.0;
chorus_speed = ui->chorus_speed->value() / CHORUS_REVERB_VALUE_SCALE;
reverb_damp = ui->reverb_damp->value() / CHORUS_REVERB_VALUE_SCALE;
reverb_level = ui->reverb_level->value() / CHORUS_REVERB_VALUE_SCALE;
reverb_size = ui->reverb_size->value() / CHORUS_REVERB_VALUE_SCALE;
reverb_width = ui->reverb_width->value() / CHORUS_REVERB_VALUE_SCALE;

settings->beginGroup(QSTR_PREFERENCES);
settings->setValue(QSTR_INSTRUMENTSDEFINITION, soundFont);
Expand Down Expand Up @@ -408,14 +418,14 @@ void FluidSettingsDialog::restoreDefaults()
ui->gain->setText(QString::number(DEFAULT_GAIN));
ui->polyphony->setText(QString::number(DEFAULT_POLYPHONY));
ui->soundFont->setText(m_defSoundFont);
ui->chorus_depth->setValue(DEFAULT_CHORUS_DEPTH * 10);
ui->chorus_level->setValue(DEFAULT_CHORUS_LEVEL * 10);
ui->chorus_depth->setValue(DEFAULT_CHORUS_DEPTH * CHORUS_REVERB_VALUE_SCALE);
ui->chorus_level->setValue(DEFAULT_CHORUS_LEVEL * CHORUS_REVERB_VALUE_SCALE);
ui->chorus_nr->setValue(DEFAULT_CHORUS_NR);
ui->chorus_speed->setValue(DEFAULT_CHORUS_SPEED * 10);
ui->reverb_damp->setValue(DEFAULT_REVERB_DAMP * 10);
ui->reverb_level->setValue(DEFAULT_REVERB_LEVEL * 10);
ui->reverb_size->setValue(DEFAULT_REVERB_SIZE * 10);
ui->reverb_width->setValue(DEFAULT_REVERB_WIDTH * 10);
ui->chorus_speed->setValue(DEFAULT_CHORUS_SPEED * CHORUS_REVERB_VALUE_SCALE);
ui->reverb_damp->setValue(DEFAULT_REVERB_DAMP * CHORUS_REVERB_VALUE_SCALE);
ui->reverb_level->setValue(DEFAULT_REVERB_LEVEL * CHORUS_REVERB_VALUE_SCALE);
ui->reverb_size->setValue(DEFAULT_REVERB_SIZE * CHORUS_REVERB_VALUE_SCALE);
ui->reverb_width->setValue(DEFAULT_REVERB_WIDTH * CHORUS_REVERB_VALUE_SCALE);
ui->chorus->setChecked(DEFAULT_CHORUS != 0);
ui->reverb->setChecked(DEFAULT_REVERB != 0);
initBuffer();
Expand Down
16 changes: 9 additions & 7 deletions library/widgets/fluidsettingsdialog.h
Original file line number Diff line number Diff line change
Expand Up @@ -96,15 +96,17 @@ public Q_SLOTS:
static const int DEFAULT_POLYPHONY = 256;
static const QString QSTR_PULSEAUDIO;

static constexpr qreal DEFAULT_CHORUS_DEPTH = 4.3;
static constexpr qreal DEFAULT_CHORUS_LEVEL = 0.6;
static constexpr qreal DEFAULT_CHORUS_DEPTH = 4.25;
static constexpr qreal DEFAULT_CHORUS_LEVEL = 0.60;
static constexpr int DEFAULT_CHORUS_NR = 3;
static constexpr qreal DEFAULT_CHORUS_SPEED = 0.2;
static constexpr qreal DEFAULT_CHORUS_SPEED = 0.20;

static constexpr qreal DEFAULT_REVERB_DAMP = 0.3;
static constexpr qreal DEFAULT_REVERB_LEVEL = 0.7;
static constexpr qreal DEFAULT_REVERB_SIZE = 0.5;
static constexpr qreal DEFAULT_REVERB_WIDTH = 0.8;
static constexpr qreal DEFAULT_REVERB_DAMP = 0.30;
static constexpr qreal DEFAULT_REVERB_LEVEL = 0.70;
static constexpr qreal DEFAULT_REVERB_SIZE = 0.50;
static constexpr qreal DEFAULT_REVERB_WIDTH = 0.80;

static constexpr qreal CHORUS_REVERB_VALUE_SCALE = 100.0;

private:
QString defaultAudioDriver() const;
Expand Down
60 changes: 30 additions & 30 deletions library/widgets/fluidsettingsdialog.ui
Original file line number Diff line number Diff line change
Expand Up @@ -17,20 +17,20 @@
<item row="2" column="0">
<widget class="QDialogButtonBox" name="buttonBox">
<property name="orientation">
<enum>Qt::Horizontal</enum>
<enum>Qt::Orientation::Horizontal</enum>
</property>
<property name="standardButtons">
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok|QDialogButtonBox::RestoreDefaults</set>
<set>QDialogButtonBox::StandardButton::Cancel|QDialogButtonBox::StandardButton::Ok|QDialogButtonBox::StandardButton::RestoreDefaults</set>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QFrame" name="frame">
<property name="frameShape">
<enum>QFrame::StyledPanel</enum>
<enum>QFrame::Shape::StyledPanel</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Raised</enum>
<enum>QFrame::Shadow::Raised</enum>
</property>
<layout class="QGridLayout" name="gridLayout_2">
<item row="0" column="0">
Expand Down Expand Up @@ -217,13 +217,13 @@
<item row="0" column="0">
<widget class="QDial" name="chorus_depth">
<property name="toolTip">
<string notr="true">4.2</string>
<string notr="true">4.25</string>
</property>
<property name="maximum">
<number>2560</number>
<number>25600</number>
</property>
<property name="value">
<number>42</number>
<number>425</number>
</property>
<property name="notchesVisible">
<bool>true</bool>
Expand All @@ -236,10 +236,10 @@
<string notr="true">0.6</string>
</property>
<property name="maximum">
<number>100</number>
<number>1000</number>
</property>
<property name="value">
<number>6</number>
<number>60</number>
</property>
<property name="notchesVisible">
<bool>true</bool>
Expand Down Expand Up @@ -268,10 +268,10 @@
<number>1</number>
</property>
<property name="maximum">
<number>50</number>
<number>500</number>
</property>
<property name="value">
<number>2</number>
<number>20</number>
</property>
<property name="notchesVisible">
<bool>true</bool>
Expand All @@ -287,7 +287,7 @@
<string>Depth</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
<set>Qt::AlignmentFlag::AlignCenter</set>
</property>
</widget>
</item>
Expand All @@ -300,7 +300,7 @@
<string>Level</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
<set>Qt::AlignmentFlag::AlignCenter</set>
</property>
</widget>
</item>
Expand All @@ -313,7 +313,7 @@
<string>NR</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
<set>Qt::AlignmentFlag::AlignCenter</set>
</property>
</widget>
</item>
Expand All @@ -326,7 +326,7 @@
<string>Speed</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
<set>Qt::AlignmentFlag::AlignCenter</set>
</property>
</widget>
</item>
Expand All @@ -345,13 +345,13 @@
<string notr="true">0.3</string>
</property>
<property name="maximum">
<number>10</number>
<number>100</number>
</property>
<property name="pageStep">
<number>1</number>
<number>10</number>
</property>
<property name="value">
<number>3</number>
<number>30</number>
</property>
<property name="notchesVisible">
<bool>true</bool>
Expand All @@ -364,13 +364,13 @@
<string notr="true">0.7</string>
</property>
<property name="maximum">
<number>10</number>
<number>100</number>
</property>
<property name="pageStep">
<number>1</number>
<number>10</number>
</property>
<property name="value">
<number>7</number>
<number>70</number>
</property>
<property name="notchesVisible">
<bool>true</bool>
Expand All @@ -383,13 +383,13 @@
<string notr="true">0.5</string>
</property>
<property name="maximum">
<number>10</number>
<number>100</number>
</property>
<property name="pageStep">
<number>1</number>
<number>10</number>
</property>
<property name="value">
<number>5</number>
<number>50</number>
</property>
<property name="notchesVisible">
<bool>true</bool>
Expand All @@ -402,10 +402,10 @@
<string notr="true">0.8</string>
</property>
<property name="maximum">
<number>1000</number>
<number>100</number>
</property>
<property name="value">
<number>8</number>
<number>80</number>
</property>
<property name="notchesVisible">
<bool>true</bool>
Expand All @@ -421,7 +421,7 @@
<string>Damp</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
<set>Qt::AlignmentFlag::AlignCenter</set>
</property>
</widget>
</item>
Expand All @@ -434,7 +434,7 @@
<string>Level</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
<set>Qt::AlignmentFlag::AlignCenter</set>
</property>
</widget>
</item>
Expand All @@ -447,7 +447,7 @@
<string>Size</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
<set>Qt::AlignmentFlag::AlignCenter</set>
</property>
</widget>
</item>
Expand All @@ -460,7 +460,7 @@
<string>Width</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
<set>Qt::AlignmentFlag::AlignCenter</set>
</property>
</widget>
</item>
Expand Down

0 comments on commit eaac60f

Please sign in to comment.