提交 b1db35f1 编写于 作者: O omajid

8140620: Find and load default.sf2 as the default soundbank on Linux

Reviewed-by: serb
上级 29033f87
......@@ -666,6 +666,40 @@ public final class SoftSynthesizer implements AudioSynthesizer,
}
});
actions.add(new PrivilegedAction<InputStream>() {
public InputStream run() {
if (System.getProperties().getProperty("os.name")
.startsWith("Linux")) {
File[] systemSoundFontsDir = new File[] {
/* Arch, Fedora, Mageia */
new File("/usr/share/soundfonts/"),
new File("/usr/local/share/soundfonts/"),
/* Debian, Gentoo, OpenSUSE, Ubuntu */
new File("/usr/share/sounds/sf2/"),
new File("/usr/local/share/sounds/sf2/"),
};
/*
* Look for a default.sf2
*/
for (File systemSoundFontDir : systemSoundFontsDir) {
if (systemSoundFontDir.exists()) {
File defaultSoundFont = new File(systemSoundFontDir, "default.sf2");
if (defaultSoundFont.exists()) {
try {
return new FileInputStream(defaultSoundFont);
} catch (IOException e) {
// continue with lookup
}
}
}
}
}
return null;
}
});
actions.add(new PrivilegedAction<InputStream>() {
public InputStream run() {
if (System.getProperties().getProperty("os.name")
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册