From 1943d6eb522fe5eb1196365179b0d9671658ccce Mon Sep 17 00:00:00 2001 From: Alexander Babikov Date: Sun, 8 Jun 2025 12:11:10 +0500 Subject: [PATCH 1/5] FluidSynth: Add .sf3 as a recognized extension for SoundFonts --- src/sound/midi_fluidsynth.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sound/midi_fluidsynth.c b/src/sound/midi_fluidsynth.c index 027c85b79..48bf825f7 100644 --- a/src/sound/midi_fluidsynth.c +++ b/src/sound/midi_fluidsynth.c @@ -324,7 +324,7 @@ static const device_config_t fluidsynth_config[] = { .type = CONFIG_FNAME, .default_string = NULL, .default_int = 0, - .file_filter = "SF2 Sound Fonts (*.sf2)|*.sf2", + .file_filter = "SoundFont files (*.sf2 *.sf3)|*.sf2,*.sf3", .spinner = { 0 }, .selection = { { 0 } }, .bios = { { 0 } } From aa9976d5c6a5a994426a484b2f6da7296ed95783 Mon Sep 17 00:00:00 2001 From: Alexander Babikov Date: Sat, 7 Jun 2025 20:30:51 +0500 Subject: [PATCH 2/5] Fix up file filters for filename fields of device configs for consistency - Filter descriptions are now translatable - Extensions get uppercase and lowercase variations on *nix - Add "All files" option --- src/qt/qt_deviceconfig.cpp | 22 +++++++++++++++++++--- src/qt/qt_util.cpp | 23 +++++++++++++++++++++++ src/qt/qt_util.hpp | 1 + 3 files changed, 43 insertions(+), 3 deletions(-) diff --git a/src/qt/qt_deviceconfig.cpp b/src/qt/qt_deviceconfig.cpp index 54923be06..255b3c39f 100644 --- a/src/qt/qt_deviceconfig.cpp +++ b/src/qt/qt_deviceconfig.cpp @@ -31,6 +31,7 @@ #include #include #include +#include extern "C" { #include <86box/86box.h> @@ -45,6 +46,7 @@ extern "C" { #include "qt_filefield.hpp" #include "qt_models_common.hpp" +#include "qt_util.hpp" #ifdef Q_OS_LINUX # include # include @@ -276,11 +278,25 @@ DeviceConfig::ProcessConfig(void *dc, const void *c, const bool is_dep) } case CONFIG_FNAME: { - auto *fileField = new FileField(); + auto *fileField = new FileField(this); fileField->setObjectName(config->name); fileField->setFileName(selected); - fileField->setFilter(QString(config->file_filter).left(static_cast(strcspn(config->file_filter, - "|")))); + /* Get the actually used part of the filter */ + QString filter = QString(config->file_filter).left(static_cast(strcspn(config->file_filter, "|"))); + /* Extract the description and the extension list */ + QRegularExpressionMatch match = QRegularExpression("(.+) \\((.+)\\)$").match(filter); + QString description = match.captured(1); + QString extensions = match.captured(2); + QStringList extensionList; + /* Split the extension list up and strip the filename globs */ + QRegularExpression re("\\*\\.(.*)"); + int i = 0; + while (extensions.section(' ', i, i) != "") { + QString extension = re.match(extensions.section(' ', i, i)).captured(1); + extensionList.append(extension); + i++; + } + fileField->setFilter(tr(description.toUtf8().constData()) % util::DlgFilter(extensionList) % tr("All files") % util::DlgFilter({ "*" }, true)); this->ui->formLayout->addRow(tr(config->description), fileField); break; } diff --git a/src/qt/qt_util.cpp b/src/qt/qt_util.cpp index 0c78c2f5e..5baaaaacf 100644 --- a/src/qt/qt_util.cpp +++ b/src/qt/qt_util.cpp @@ -92,6 +92,29 @@ DlgFilter(std::initializer_list extensions, bool last) return " (" % temp.join(' ') % ")" % (!last ? ";;" : ""); } +QString +DlgFilter(QStringList extensions, bool last) +{ + QStringList temp; + + for (auto ext : extensions) { +#ifdef Q_OS_UNIX + if (ext == "*") { + temp.append("*"); + continue; + } + temp.append("*." % ext.toUpper()); +#endif + temp.append("*." % ext); + } + +#ifdef Q_OS_UNIX + temp.removeDuplicates(); +#endif + return " (" % temp.join(' ') % ")" % (!last ? ";;" : ""); +} + + QString currentUuid() { auto configPath = QFileInfo(cfg_path).dir().canonicalPath(); diff --git a/src/qt/qt_util.hpp b/src/qt/qt_util.hpp index 9432610b6..e0d2648d0 100644 --- a/src/qt/qt_util.hpp +++ b/src/qt/qt_util.hpp @@ -11,6 +11,7 @@ namespace util { static constexpr auto UUID_MIN_LENGTH = 36; /* Creates extension list for qt filedialog */ QString DlgFilter(std::initializer_list extensions, bool last = false); +QString DlgFilter(QStringList extensions, bool last = false); /* Returns screen the widget is on */ QScreen *screenOfWidget(QWidget *widget); #ifdef Q_OS_WINDOWS From c5203c92ca2731b7d94f229d552c0e2b6ba05994 Mon Sep 17 00:00:00 2001 From: Alexander Babikov Date: Sun, 8 Jun 2025 13:54:47 +0500 Subject: [PATCH 3/5] FluidSynth: Add dynamic sample loading --- src/sound/midi_fluidsynth.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/sound/midi_fluidsynth.c b/src/sound/midi_fluidsynth.c index 48bf825f7..1afefd905 100644 --- a/src/sound/midi_fluidsynth.c +++ b/src/sound/midi_fluidsynth.c @@ -161,6 +161,7 @@ fluidsynth_init(UNUSED(const device_t *info)) fluid_settings_setnum(data->settings, "synth.sample-rate", 44100); fluid_settings_setnum(data->settings, "synth.gain", device_get_config_int("output_gain") / 100.0f); + fluid_settings_setint(data->settings, "synth.dynamic-sample-loading", device_get_config_int("dynamic_sample_loading")); data->synth = new_fluid_synth(data->settings); @@ -509,6 +510,17 @@ static const device_config_t fluidsynth_config[] = { }, .bios = { { 0 } } }, + { + .name = "dynamic_sample_loading", + .description = "Dynamic Sample Loading", + .type = CONFIG_BINARY, + .default_string = NULL, + .default_int = 0, + .file_filter = NULL, + .spinner = { 0 }, + .selection = { { 0 } }, + .bios = { { 0 } } + }, { .name = "", .description = "", .type = CONFIG_END } // clang-format on }; From 5779340e6d0743f50dd5da7cc9277c7814d4421d Mon Sep 17 00:00:00 2001 From: Alexander Babikov Date: Sun, 8 Jun 2025 15:37:38 +0500 Subject: [PATCH 4/5] ESC/P: Fix a handle leak on reset --- src/printer/prt_escp.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/printer/prt_escp.c b/src/printer/prt_escp.c index d0836e5f2..f238341c5 100644 --- a/src/printer/prt_escp.c +++ b/src/printer/prt_escp.c @@ -2053,6 +2053,7 @@ escp_close(void *priv) free(dev->page); } + FT_Done_Face(dev->fontface); free(dev); } From 490e1c5b3e0dd280d3d660026b8c31c1a2744c30 Mon Sep 17 00:00:00 2001 From: Alexander Babikov Date: Sun, 8 Jun 2025 16:33:52 +0500 Subject: [PATCH 5/5] Update the Russian translation --- src/qt/languages/ru-RU.po | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/qt/languages/ru-RU.po b/src/qt/languages/ru-RU.po index af427d670..19975c2c9 100644 --- a/src/qt/languages/ru-RU.po +++ b/src/qt/languages/ru-RU.po @@ -2194,4 +2194,13 @@ msgid "Toggle pause" msgstr "Переключить паузу" msgid "Toggle mute" -msgstr "Переключить беззвучный режим" \ No newline at end of file +msgstr "Переключить беззвучный режим" + +msgid "Text files" +msgstr "Текстовые файлы" + +msgid "ROM files" +msgstr "Файлы ПЗУ" + +msgid "SoundFont files" +msgstr "Файлы SoundFont"