Skip to content

Commit

Permalink
Midi Kit: Made it possible for the user to use a soundfont different
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
jackburton79 committed Sep 20, 2014
1 parent 937e70a commit bee3de4
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion src/kits/midi/SoftSynth.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@

using namespace BPrivate;

const static char* kSynthFileName = "synth.sf2";

BSoftSynth::BSoftSynth()
: fInitCheck(false),
Expand Down Expand Up @@ -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());
}
Expand All @@ -102,6 +113,7 @@ BSoftSynth::SetInstrumentsFile(const char* path)
if (IsLoaded())
Unload();

// TODO: Check for file existence ?
fInstrumentsFile = strdup(path);
return B_OK;
}
Expand Down

0 comments on commit bee3de4

Please sign in to comment.