Commit 58641aea authored by Pino Toscano's avatar Pino Toscano

fluidsynth: improve loading of soundfont

limit only the QStandardPaths::locate as OS-dependent (thus using
fluid_synth_sfload in an OS-agnostic block), and make the Linux block
used generically for any non-Windows system

in case the path needs to be adjusted on other OSes, new cases can be
added easily
parent 7b09849f
...@@ -46,12 +46,12 @@ FluidSynthSoundController::FluidSynthSoundController(QObject *parent) ...@@ -46,12 +46,12 @@ FluidSynthSoundController::FluidSynthSoundController(QObject *parent)
fluid_synth_cc(m_synth, 1, 100, 0); fluid_synth_cc(m_synth, 1, 100, 0);
#ifdef Q_OS_LINUX
int fluid_res = fluid_synth_sfload(m_synth, QStandardPaths::locate(QStandardPaths::AppDataLocation, QStringLiteral("soundfonts/GeneralUser-v1.47.sf2")).toLatin1(), 1);
#ifdef Q_OS_WIN #ifdef Q_OS_WIN
int fluid_res = fluid_synth_sfload(m_synth, QStandardPaths::locate(QStandardPaths::AppDataLocation, QStringLiteral("minuet/soundfonts/GeneralUser-v1.47.sf2")).toLatin1(), 1); const QString sf_path = QStandardPaths::locate(QStandardPaths::AppDataLocation, QStringLiteral("minuet/soundfonts/GeneralUser-v1.47.sf2"));
const QString sf_path = QStandardPaths::locate(QStandardPaths::AppDataLocation, QStringLiteral("soundfonts/GeneralUser-v1.47.sf2"));
#endif #endif
int fluid_res = fluid_synth_sfload(m_synth, sf_path.toLatin1(), 1);
if (fluid_res == FLUID_FAILED) if (fluid_res == FLUID_FAILED)
qCritical() << "Error when loading soundfont!"; qCritical() << "Error when loading soundfont!";
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment