Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ if (POLICY CMP0153)
endif()

project( Drumstick
VERSION 2.11.1
VERSION 2.11.2
LANGUAGES CXX
DESCRIPTION "MIDI C++ Libraries for Qt"
HOMEPAGE_URL "https://drumstick.sourceforge.io"
Expand All @@ -37,7 +37,7 @@ include(SCMRevision)
include(CTest)
include(GNUInstallDirs)

set(RELEASE_DATE "August 22, 2026")
#set(RELEASE_DATE "August 22, 2026")
set(EXECUTABLE_OUTPUT_PATH ${PROJECT_BINARY_DIR}/bin)
set(LIBRARY_OUTPUT_PATH ${PROJECT_BINARY_DIR}/lib)

Expand Down
8 changes: 8 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
2026-09-05
* RT, Fluidsynth backend: default gain control option
* Widgets: update Fluidsynth configuration dialog

2026-09-03
* RT, sonivox backend: gain control option
* Widgets: update Sonivox configuration dialog

2026-08-22
* Release 2.11.1

Expand Down
10 changes: 10 additions & 0 deletions library/rt-backends/eassynth/synthcontroller.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -183,5 +183,15 @@ QString SynthController::getSoundFont()
return m_renderer->getSoundFont();
}

int SynthController::getDefaultGain()
{
return m_renderer->defaultGain();
}

void SynthController::setDefaultGain(const int newValue)
{
m_renderer->setDefaultGain(newValue);
}

} // namespace rt
} // namespace drumstick
4 changes: 3 additions & 1 deletion library/rt-backends/eassynth/synthcontroller.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ namespace rt {
Q_PROPERTY(bool status READ getStatus)
Q_PROPERTY(QString libversion READ getLibVersion)
Q_PROPERTY(QString soundfont READ getSoundFont)
Q_PROPERTY(int defaultGain READ getDefaultGain WRITE setDefaultGain)

public:
explicit SynthController(QObject *parent = nullptr);
Expand Down Expand Up @@ -80,7 +81,8 @@ namespace rt {
bool getStatus();
QString getLibVersion();
QString getSoundFont();
int getDefaultGain();
void setDefaultGain(const int newValue);
};

}}
#endif // SYNTHCONTROLLER_H
27 changes: 25 additions & 2 deletions library/rt-backends/eassynth/synthrenderer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ const QString SynthRenderer::QSTR_CHORUSAMT = QStringLiteral("ChorusAmt");
const QString SynthRenderer::QSTR_SONIVOXEAS = QStringLiteral("SonivoxEAS");
const QString SynthRenderer::QSTR_SOUNDFONT = QStringLiteral("InstrumentsDefinition");
const QString SynthRenderer::QSTR_SYNTHLIB = QStringLiteral("SynthLib");
const QString SynthRenderer::QSTR_GAIN = QStringLiteral("Gain");

const int SynthRenderer::DEF_BUFFERTIME = 60;
const int SynthRenderer::DEF_REVERBTYPE = EAS_PARAM_REVERB_HALL;
Expand Down Expand Up @@ -114,6 +115,14 @@ SynthRenderer::initEAS()
}
}

if ((m_gain >= 0) && (m_gain <= EAS_MAX_VOLUME)) {
eas_res = EAS_SetVolume(dataHandle, nullptr, m_gain);
if (eas_res != EAS_SUCCESS) {
m_diagnostics << QString("EAS_SetVolume(%1) error: %2").arg(m_gain).arg(eas_res);
return;
}
}

eas_res = EAS_OpenMIDIStream(dataHandle, &handle, nullptr);
if (eas_res != EAS_SUCCESS) {
m_diagnostics << QString("EAS_OpenMIDIStream error: %1").arg( eas_res );
Expand Down Expand Up @@ -200,8 +209,6 @@ SynthRenderer::~SynthRenderer()
void
SynthRenderer::initialize(QSettings *settings)
{
//qDebug() << Q_FUNC_INFO;

settings->beginGroup(QSTR_PREFERENCES);
m_bufferTime = settings->value(QSTR_BUFFERTIME, DEF_BUFFERTIME).toInt();
int reverbType = settings->value(QSTR_REVERBTYPE, DEF_REVERBTYPE).toInt();
Expand All @@ -210,8 +217,11 @@ SynthRenderer::initialize(QSettings *settings)
int chorusAmt = settings->value(QSTR_CHORUSAMT, DEF_CHORUSAMT).toInt();
m_synthLib = settings->value(QSTR_SYNTHLIB, DEF_SYNTHLIB).toInt();
m_soundfont = settings->value(QSTR_SOUNDFONT, QString()).toString();
m_gain = settings->value(QSTR_GAIN, m_defaultGain).toInt();
settings->endGroup();

// qDebug() << Q_FUNC_INFO << "gain:" << m_gain;

initEAS();
initSoundfont();
initReverb(reverbType);
Expand Down Expand Up @@ -278,6 +288,18 @@ SynthRenderer::run()
Q_EMIT finished();
}

int SynthRenderer::defaultGain() const
{
return m_defaultGain;
}

void SynthRenderer::setDefaultGain(int newDefaultGain)
{
if (m_defaultGain == newDefaultGain)
return;
m_defaultGain = newDefaultGain;
}

void
SynthRenderer::writeMIDIData(const QByteArray& message)
{
Expand Down Expand Up @@ -353,6 +375,7 @@ void SynthRenderer::writeSettings(QSettings *settings)
settings->setValue(QSTR_CHORUSAMT, m_chorusAmt);
settings->setValue(QSTR_SOUNDFONT, m_soundfont);
settings->setValue(QSTR_SYNTHLIB, m_synthLib);
settings->setValue(QSTR_GAIN, m_gain);
settings->endGroup();
}
}
Expand Down
7 changes: 6 additions & 1 deletion library/rt-backends/eassynth/synthrenderer.h
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ namespace drumstick { namespace rt {
static const QString QSTR_SONIVOXEAS;
static const QString QSTR_SOUNDFONT;
static const QString QSTR_SYNTHLIB;
static const QString QSTR_GAIN;

static const int DEF_BUFFERTIME;
static const int DEF_REVERBTYPE;
Expand All @@ -73,6 +74,9 @@ namespace drumstick { namespace rt {
static const int DEF_CHORUSAMT;
static const int DEF_SYNTHLIB;

int defaultGain() const;
void setDefaultGain(int newDefaultGain);

private:
void initEAS();
void initPulse();
Expand Down Expand Up @@ -108,7 +112,8 @@ namespace drumstick { namespace rt {
int m_chorusType{DEF_CHORUSTYPE};
int m_chorusAmt{DEF_CHORUSAMT};
int m_synthLib{DEF_SYNTHLIB};
int m_defaultGain{EAS_REF_VOLUME};
int m_gain{m_defaultGain};
};

}} /* drumstick::rt */
#endif /*SYNTHRENDERER_H_*/
10 changes: 10 additions & 0 deletions library/rt-backends/fluidsynth/fluidsynthengine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,16 @@ void FluidSynthEngine::retrieveDefaultSoundfont()
}
}

double FluidSynthEngine::getDefaultGain() const
{
return default_gain;
}

void FluidSynthEngine::setDefaultGain(double newDefault_gain)
{
default_gain = newDefault_gain;
}

void FluidSynthEngine::initialize()
{
//qDebug() << Q_FUNC_INFO;
Expand Down
6 changes: 5 additions & 1 deletion library/rt-backends/fluidsynth/fluidsynthengine.h
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,9 @@ class FluidSynthEngine : public QObject

Q_INVOKABLE void writeSettings(QSettings *settings);

double getDefaultGain() const;
void setDefaultGain(double newDefault_gain);

static const QString QSTR_FLUIDSYNTH_VERSION;

static const QString QSTR_FLUIDSYNTH;
Expand Down Expand Up @@ -141,7 +144,8 @@ class FluidSynthEngine : public QObject
double fs_sampleRate { DEFAULT_SAMPLERATE };
int fs_chorus { DEFAULT_CHORUS };
int fs_reverb { DEFAULT_REVERB };
double fs_gain { DEFAULT_GAIN };
double default_gain{DEFAULT_GAIN};
double fs_gain{default_gain};
int fs_polyphony { DEFAULT_POLYPHONY };

qreal fs_reverb_damp{DEFAULT_REVERB_DAMP};
Expand Down
10 changes: 10 additions & 0 deletions library/rt-backends/fluidsynth/fluidsynthoutput.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,16 @@ QString FluidSynthOutput::getSoundFont()
return m_synth->soundFont();
}

double FluidSynthOutput::getDefaultGain()
{
return m_synth->getDefaultGain();
}

void FluidSynthOutput::setDefaultGain(const double newValue)
{
m_synth->setDefaultGain(newValue);
}

void FluidSynthOutput::initialize(QSettings *settings)
{
//qDebug() << Q_FUNC_INFO;
Expand Down
3 changes: 3 additions & 0 deletions library/rt-backends/fluidsynth/fluidsynthoutput.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ namespace rt {
Q_PROPERTY(QString libversion READ getLibVersion)
Q_PROPERTY(bool status READ getStatus)
Q_PROPERTY(QString soundfont READ getSoundFont)
Q_PROPERTY(double defaultGain READ getDefaultGain WRITE setDefaultGain)

public:
explicit FluidSynthOutput(QObject *parent = nullptr);
Expand Down Expand Up @@ -80,6 +81,8 @@ namespace rt {
QString getLibVersion();
bool getStatus();
QString getSoundFont();
double getDefaultGain();
void setDefaultGain(const double newValue);
};

}} // namespace drumstick::rt
Expand Down
9 changes: 6 additions & 3 deletions library/widgets/fluidsettingsdialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,10 @@ void FluidSettingsDialog::readSettings()
ui->periodSize->setValue( settings->value(QSTR_PERIODSIZE, DEFAULT_PERIODSIZE).toInt() );
ui->periods->setValue( settings->value(QSTR_PERIODS, DEFAULT_PERIODS).toInt() );
ui->sampleRate->setCurrentText(settings->value(QSTR_SAMPLERATE, DEFAULT_SAMPLERATE).toString());
ui->gain->setValue(settings->value(QSTR_GAIN, DEFAULT_GAIN).toDouble());
ui->gain->setValue(
settings
->value(QSTR_GAIN, m_driver ? m_driver->property("defaultGain").toReal() : DEFAULT_GAIN)
.toDouble());
ui->polyphony->setValue(settings->value(QSTR_POLYPHONY, DEFAULT_POLYPHONY).toInt());
ui->soundFont->setText( settings->value(QSTR_INSTRUMENTSDEFINITION, m_defSoundFont).toString() );

Expand Down Expand Up @@ -306,7 +309,7 @@ void FluidSettingsDialog::writeSettings()
double sampleRate(DEFAULT_SAMPLERATE);
int chorus(DEFAULT_CHORUS);
int reverb(DEFAULT_REVERB);
double gain(DEFAULT_GAIN);
double gain(m_driver ? m_driver->property("defaultGain").toReal() : DEFAULT_GAIN);
int polyphony(DEFAULT_POLYPHONY);

double chorus_depth(DEFAULT_CHORUS_DEPTH);
Expand Down Expand Up @@ -374,7 +377,7 @@ void FluidSettingsDialog::restoreDefaults()
ui->periodSize->setValue(DEFAULT_PERIODSIZE);
ui->periods->setValue(DEFAULT_PERIODS);
ui->sampleRate->setCurrentText(QString::number(DEFAULT_SAMPLERATE));
ui->gain->setValue(DEFAULT_GAIN);
ui->gain->setValue(m_driver ? m_driver->property("defaultGain").toReal() : DEFAULT_GAIN);
ui->polyphony->setValue(DEFAULT_POLYPHONY);
ui->soundFont->setText(m_defSoundFont);
ui->chorus_depth->setValue(DEFAULT_CHORUS_DEPTH * CHORUS_REVERB_VALUE_SCALE);
Expand Down
6 changes: 6 additions & 0 deletions library/widgets/sonivoxsettingsdialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ const QString SonivoxSettingsDialog::QSTR_SOUNDFONT = QStringLiteral("Instrument
const QString SonivoxSettingsDialog::QSTR_DATADIR = QStringLiteral("soundfonts");
const QString SonivoxSettingsDialog::QSTR_DATADIR2 = QStringLiteral("sounds/sf2");
const QString SonivoxSettingsDialog::QSTR_SYNTHLIB = QStringLiteral("SynthLib");
const QString SonivoxSettingsDialog::QSTR_GAIN = QStringLiteral("Gain");
const int SonivoxSettingsDialog::SYNTHLIB_WT = 1;
const int SonivoxSettingsDialog::SYNTHLIB_FM = 2;

Expand Down Expand Up @@ -129,6 +130,7 @@ void SonivoxSettingsDialog::readSettings()
int chorusAmt = settings->value(QSTR_CHORUSAMT, 0).toInt();
int synthLib = settings->value(QSTR_SYNTHLIB, SYNTHLIB_WT).toInt();
QString soundfont = settings->value(QSTR_SOUNDFONT, QString()).toString();
int gain = settings->value(QSTR_GAIN, m_driver ? m_driver->property("defaultGain") : 100).toInt();
settings->endGroup();

if (qEnvironmentVariableIsSet("PULSE_LATENCY_MSEC")) {
Expand All @@ -155,6 +157,7 @@ void SonivoxSettingsDialog::readSettings()
}
ui->btn_soundfont->setEnabled(synthLib == 1);
ui->soundfont_dls->setEnabled(synthLib == 1);
ui->sliderGain->setValue(gain);

chkDriverProperties(settings.getQSettings());
}
Expand All @@ -171,6 +174,7 @@ void SonivoxSettingsDialog::writeSettings()
settings->setValue(QSTR_CHORUSAMT, ui->dial_Chorus->value());
settings->setValue(QSTR_SOUNDFONT, ui->soundfont_dls->text());
settings->setValue(QSTR_SYNTHLIB, ui->rbFM->isChecked() ? SYNTHLIB_FM : SYNTHLIB_WT);
settings->setValue(QSTR_GAIN, ui->sliderGain->value());
settings->endGroup();
settings->sync();
qputenv("PULSE_LATENCY_MSEC", QByteArray::number( ui->spnTime->value() ));
Expand Down Expand Up @@ -206,6 +210,8 @@ void SonivoxSettingsDialog::restoreDefaults()
ui->dial_Reverb->setValue(25800);
ui->combo_Chorus->setCurrentIndex(4);
ui->dial_Chorus->setValue(0);
ui->sliderGain->setValue(m_driver ? m_driver->property("defaultGain").toInt() : 100);
ui->rbWT->setChecked(true);
}

void SonivoxSettingsDialog::showFileDialog()
Expand Down
1 change: 1 addition & 0 deletions library/widgets/sonivoxsettingsdialog.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ namespace widgets {
static const QString QSTR_DATADIR;
static const QString QSTR_DATADIR2;
static const QString QSTR_SYNTHLIB;
static const QString QSTR_GAIN;

static const int SYNTHLIB_WT;
static const int SYNTHLIB_FM;
Expand Down
Loading
Loading