Search in sources :

Example 1 with ModelPatch

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

the class TestCreateSoundbank method main.

public static void main(String[] args) throws Exception {
    Soundbank soundbank = EmergencySoundbank.createSoundbank();
    for (int i = 0; i < 128; i++) {
        Patch patch = new ModelPatch(0, i, false);
        ModelInstrument ins = (ModelInstrument) soundbank.getInstrument(patch);
        if (ins == null)
            throw new Exception("Instrument " + i + " is missing!");
        if (ins.getPerformers().length == 0)
            throw new Exception("Instrument " + i + " doesn't have any performers!");
    }
    Patch patch = new ModelPatch(0, 0, true);
    ModelInstrument ins = (ModelInstrument) soundbank.getInstrument(patch);
    if (ins == null)
        throw new Exception("Drumkit instrument is missing!");
    if (ins.getPerformers().length == 0)
        throw new Exception("Drumkit instrument doesn't have any performers!");
}
Also used : ModelPatch(com.sun.media.sound.ModelPatch) Soundbank(javax.sound.midi.Soundbank) EmergencySoundbank(com.sun.media.sound.EmergencySoundbank) ModelInstrument(com.sun.media.sound.ModelInstrument) Patch(javax.sound.midi.Patch) ModelPatch(com.sun.media.sound.ModelPatch)

Aggregations

EmergencySoundbank (com.sun.media.sound.EmergencySoundbank)1 ModelInstrument (com.sun.media.sound.ModelInstrument)1 ModelPatch (com.sun.media.sound.ModelPatch)1 Patch (javax.sound.midi.Patch)1 Soundbank (javax.sound.midi.Soundbank)1