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