A newer version of the JRE does not load the sound bank, but an older version

I have the following code that is trying to load a sound bank. I tested the code on Windows 7 with JRE 1.6.03 and 1.6.43. The old version of JRE (1.6.03) works fine, but the new version throws an exception. What's happening?

public Main() {
    try {
        Synthesizer synth = MidiSystem.getSynthesizer();
        synth.open();
        BufferedInputStream soundBankStream = new BufferedInputStream(
                getClass().getClassLoader().getResourceAsStream(
                        "soundbank.gm"));
        synth.loadAllInstruments(MidiSystem.getSoundbank(soundBankStream));
    } catch (MidiUnavailableException e) {
        e.printStackTrace();
    } catch (InvalidMidiDataException e) {
        e.printStackTrace();
    } catch (IOException e) {
        e.printStackTrace();
    }
}

.

F:\>java -version
java version "1.6.0_03"
Java(TM) SE Runtime Environment (build 1.6.0_03-b05)
Java HotSpot(TM) 64-Bit Server VM (build 1.6.0_03-b05, mixed mode)

F:\>java -jar Test2.jar

F:\>"C:\Program Files\Java\jre6\bin\java.exe" -version
java version "1.6.0_43"
Java(TM) SE Runtime Environment (build 1.6.0_43-b01)
Java HotSpot(TM) 64-Bit Server VM (build 20.14-b01, mixed mode)

F:\>"C:\Program Files\Java\jre6\bin\java.exe" -jar Test2.jar
javax.sound.midi.InvalidMidiDataException: cannot get soundbank from stream
        at javax.sound.midi.MidiSystem.getSoundbank(Unknown Source)
        at com.gulshansingh.test.Main.<init>(Main.java:24)
        at com.gulshansingh.test.Main.main(Main.java:14)

You can download sound banks from here: http://www.oracle.com/technetwork/java/soundbanks-135798.html

+5
source share
2 answers

Copy-paste from the Java Sound API: Soundbanks page

Java Sound API

, Java Sound. Soundbanks , Java Sound. , J2RE Windows , Java Sound MIDI engine. , MIDI-, Soundbank , MIDI , Java .

, Java Sound API , , JDK, .

, : 4887447, , , JAR

0

, , , java (1.7+), GM

http://www.oracle.com/technetwork/java/javase/compatibility-417013.html#incompatibilities

Java Sound . - : GM soundbank, RMF, OSS (Open Sound System) Linux. DLS SoundFont (SF2).

, DLS SF2 Soundbank ( , , ). , : http://www.ronimusic.com/smp_ios_dls_files.htm

0

All Articles