Search in sources :

Example 1 with SF2SoundbankReader

use of com.sun.media.sound.SF2SoundbankReader in project jdk8u_jdk by JetBrains.

the class TestGetSoundbankFile method main.

public static void main(String[] args) throws Exception {
    File file = new File(System.getProperty("test.src", "."), "ding.sf2");
    Soundbank sf2 = new SF2SoundbankReader().getSoundbank(file);
    assertTrue(sf2.getInstruments().length == 1);
    Patch patch = sf2.getInstruments()[0].getPatch();
    assertTrue(patch.getProgram() == 0);
    assertTrue(patch.getBank() == 0);
}
Also used : Soundbank(javax.sound.midi.Soundbank) SF2SoundbankReader(com.sun.media.sound.SF2SoundbankReader) File(java.io.File) Patch(javax.sound.midi.Patch)

Example 2 with SF2SoundbankReader

use of com.sun.media.sound.SF2SoundbankReader in project jdk8u_jdk by JetBrains.

the class TestGetSoundbankInputStream method main.

public static void main(String[] args) throws Exception {
    File file = new File(System.getProperty("test.src", "."), "ding.sf2");
    FileInputStream fis = new FileInputStream(file);
    BufferedInputStream bis = new BufferedInputStream(fis);
    try {
        Soundbank sf2 = new SF2SoundbankReader().getSoundbank(bis);
        assertTrue(sf2.getInstruments().length == 1);
        Patch patch = sf2.getInstruments()[0].getPatch();
        assertTrue(patch.getProgram() == 0);
        assertTrue(patch.getBank() == 0);
    } finally {
        bis.close();
    }
}
Also used : Soundbank(javax.sound.midi.Soundbank) BufferedInputStream(java.io.BufferedInputStream) SF2SoundbankReader(com.sun.media.sound.SF2SoundbankReader) File(java.io.File) Patch(javax.sound.midi.Patch) FileInputStream(java.io.FileInputStream)

Example 3 with SF2SoundbankReader

use of com.sun.media.sound.SF2SoundbankReader in project jdk8u_jdk by JetBrains.

the class TestGetSoundbankInputStream2 method main.

public static void main(String[] args) throws Exception {
    File file = new File(System.getProperty("test.src", "."), "ding.sf2");
    FileInputStream fis = new FileInputStream(file);
    BufferedInputStream bis = new BufferedInputStream(fis);
    try {
        InputStream badis = new BadInputStream(bis);
        Soundbank sf2 = new SF2SoundbankReader().getSoundbank(badis);
        assertTrue(sf2.getInstruments().length == 1);
        Patch patch = sf2.getInstruments()[0].getPatch();
        assertTrue(patch.getProgram() == 0);
        assertTrue(patch.getBank() == 0);
    } finally {
        bis.close();
    }
}
Also used : Soundbank(javax.sound.midi.Soundbank) BufferedInputStream(java.io.BufferedInputStream) BufferedInputStream(java.io.BufferedInputStream) FileInputStream(java.io.FileInputStream) InputStream(java.io.InputStream) SF2SoundbankReader(com.sun.media.sound.SF2SoundbankReader) File(java.io.File) Patch(javax.sound.midi.Patch) FileInputStream(java.io.FileInputStream)

Example 4 with SF2SoundbankReader

use of com.sun.media.sound.SF2SoundbankReader in project jdk8u_jdk by JetBrains.

the class TestGetSoundbankUrl method main.

public static void main(String[] args) throws Exception {
    File file = new File(System.getProperty("test.src", "."), "ding.sf2");
    URL url = file.toURI().toURL();
    Soundbank sf2 = new SF2SoundbankReader().getSoundbank(url);
    assertTrue(sf2.getInstruments().length == 1);
    Patch patch = sf2.getInstruments()[0].getPatch();
    assertTrue(patch.getProgram() == 0);
    assertTrue(patch.getBank() == 0);
}
Also used : Soundbank(javax.sound.midi.Soundbank) SF2SoundbankReader(com.sun.media.sound.SF2SoundbankReader) File(java.io.File) Patch(javax.sound.midi.Patch) URL(java.net.URL)

Aggregations

SF2SoundbankReader (com.sun.media.sound.SF2SoundbankReader)4 File (java.io.File)4 Patch (javax.sound.midi.Patch)4 Soundbank (javax.sound.midi.Soundbank)4 BufferedInputStream (java.io.BufferedInputStream)2 FileInputStream (java.io.FileInputStream)2 InputStream (java.io.InputStream)1 URL (java.net.URL)1