|
|
8ba7a7 |
# HG changeset patch
|
|
|
8ba7a7 |
# User omajid
|
|
|
8ba7a7 |
# Date 1445973555 14400
|
|
|
8ba7a7 |
# Node ID 3e006ea10d21a7fcf15725c51f2ab7ededce53ab
|
|
|
8ba7a7 |
# Parent dfeaf40df80032570558c031f37f6630dc729e3f
|
|
|
8ba7a7 |
8140620: Find and load default.sf2 as the default soundbank on Linux
|
|
|
8ba7a7 |
Reviewed-by: serb
|
|
|
8ba7a7 |
|
|
|
8ba7a7 |
+++ openjdk/jdk/src/share/classes/com/sun/media/sound/SoftSynthesizer.java
|
|
|
8ba7a7 |
--- openjdk/jdk/src/share/classes/com/sun/media/sound/SoftSynthesizer.java
|
|
|
8ba7a7 |
@@ -671,6 +671,40 @@
|
|
|
8ba7a7 |
actions.add(new PrivilegedAction<InputStream>() {
|
|
|
8ba7a7 |
public InputStream run() {
|
|
|
8ba7a7 |
if (System.getProperties().getProperty("os.name")
|
|
|
8ba7a7 |
+ .startsWith("Linux")) {
|
|
|
8ba7a7 |
+
|
|
|
8ba7a7 |
+ File[] systemSoundFontsDir = new File[] {
|
|
|
8ba7a7 |
+ /* Arch, Fedora, Mageia */
|
|
|
8ba7a7 |
+ new File("/usr/share/soundfonts/"),
|
|
|
8ba7a7 |
+ new File("/usr/local/share/soundfonts/"),
|
|
|
8ba7a7 |
+ /* Debian, Gentoo, OpenSUSE, Ubuntu */
|
|
|
8ba7a7 |
+ new File("/usr/share/sounds/sf2/"),
|
|
|
8ba7a7 |
+ new File("/usr/local/share/sounds/sf2/"),
|
|
|
8ba7a7 |
+ };
|
|
|
8ba7a7 |
+
|
|
|
8ba7a7 |
+ /*
|
|
|
8ba7a7 |
+ * Look for a default.sf2
|
|
|
8ba7a7 |
+ */
|
|
|
8ba7a7 |
+ for (File systemSoundFontDir : systemSoundFontsDir) {
|
|
|
8ba7a7 |
+ if (systemSoundFontDir.exists()) {
|
|
|
8ba7a7 |
+ File defaultSoundFont = new File(systemSoundFontDir, "default.sf2");
|
|
|
8ba7a7 |
+ if (defaultSoundFont.exists()) {
|
|
|
8ba7a7 |
+ try {
|
|
|
8ba7a7 |
+ return new FileInputStream(defaultSoundFont);
|
|
|
8ba7a7 |
+ } catch (IOException e) {
|
|
|
8ba7a7 |
+ // continue with lookup
|
|
|
8ba7a7 |
+ }
|
|
|
8ba7a7 |
+ }
|
|
|
8ba7a7 |
+ }
|
|
|
8ba7a7 |
+ }
|
|
|
8ba7a7 |
+ }
|
|
|
8ba7a7 |
+ return null;
|
|
|
8ba7a7 |
+ }
|
|
|
8ba7a7 |
+ });
|
|
|
8ba7a7 |
+
|
|
|
8ba7a7 |
+ actions.add(new PrivilegedAction<InputStream>() {
|
|
|
8ba7a7 |
+ public InputStream run() {
|
|
|
8ba7a7 |
+ if (System.getProperties().getProperty("os.name")
|
|
|
8ba7a7 |
.startsWith("Windows")) {
|
|
|
8ba7a7 |
File gm_dls = new File(System.getenv("SystemRoot")
|
|
|
8ba7a7 |
+ "\\system32\\drivers\\gm.dls");
|
|
|
8ba7a7 |
|
|
|
8ba7a7 |
|