hrev47887 adds 1 changeset to branch 'master' old head: 937e70aa28947b9c20e2ef1de523cae5dfc27863 new head: bee3de4dbbff09f90bfa2a67df4f9d37e60cd5ac overview: http://cgit.haiku-os.org/haiku/log/?qt=range&q=bee3de4+%5E937e70a ---------------------------------------------------------------------------- bee3de4: Midi Kit: Made it possible for the user to use a soundfont different from the one supplied by default. Since the PM move, it was not possible anymore to use a different soundfont, since the /boot/system/data folder became read only. Now the user has to put the soundfont (or, better, a symbolic link to it) into /home/config/settings/synth.sf2 In the future we'll supply a preflet to select the soundfont. [ Stefano Ceccherini <stefano.ceccherini@xxxxxxxxx> ] ---------------------------------------------------------------------------- Revision: hrev47887 Commit: bee3de4dbbff09f90bfa2a67df4f9d37e60cd5ac URL: http://cgit.haiku-os.org/haiku/commit/?id=bee3de4 Author: Stefano Ceccherini <stefano.ceccherini@xxxxxxxxx> Date: Sat Sep 20 16:56:09 2014 UTC ---------------------------------------------------------------------------- 1 file changed, 13 insertions(+), 1 deletion(-) src/kits/midi/SoftSynth.cpp | 14 +++++++++++++- ---------------------------------------------------------------------------- diff --git a/src/kits/midi/SoftSynth.cpp b/src/kits/midi/SoftSynth.cpp index 9bcc757..58ea09b 100644 --- a/src/kits/midi/SoftSynth.cpp +++ b/src/kits/midi/SoftSynth.cpp @@ -24,6 +24,7 @@ using namespace BPrivate; +const static char* kSynthFileName = "synth.sf2"; BSoftSynth::BSoftSynth() : fInitCheck(false), @@ -83,8 +84,18 @@ BSoftSynth::IsLoaded(void) const status_t BSoftSynth::SetDefaultInstrumentsFile() { + // We first search for a softsynth file (or symlink to it) + // in the user settings directory BPath path; - if (B_OK == find_directory(B_SYNTH_DIRECTORY, &path, false, NULL)) { + if (find_directory(B_USER_SETTINGS_DIRECTORY, &path, false, NULL) == B_OK) { + path.Append(kSynthFileName); + if (BEntry(path.Path()).Exists()) + return SetInstrumentsFile(path.Path()); + } + + // If no link is present, fall back to the default + // softsynth (big_synth.sy) + if (find_directory(B_SYNTH_DIRECTORY, &path, false, NULL) == B_OK) { path.Append(B_BIG_SYNTH_FILE); return SetInstrumentsFile(path.Path()); } @@ -102,6 +113,7 @@ BSoftSynth::SetInstrumentsFile(const char* path) if (IsLoaded()) Unload(); + // TODO: Check for file existence ? fInstrumentsFile = strdup(path); return B_OK; }