Search in sources :

Example 1 with SoundbankResource

use of javax.sound.midi.SoundbankResource in project jdk8u_jdk by JetBrains.

the class IsSoundbankSupported method main.

public static void main(String[] args) throws Exception {
    AudioSynthesizer synth = new SoftSynthesizer();
    synth.openStream(null, null);
    SimpleSoundbank sbk = new SimpleSoundbank();
    SimpleInstrument ins = new SimpleInstrument();
    sbk.addInstrument(ins);
    assertTrue(synth.isSoundbankSupported(sbk));
    Soundbank dummysbk = new Soundbank() {

        public String getName() {
            return null;
        }

        public String getVersion() {
            return null;
        }

        public String getVendor() {
            return null;
        }

        public String getDescription() {
            return null;
        }

        public SoundbankResource[] getResources() {
            return null;
        }

        public Instrument[] getInstruments() {
            Instrument ins = new Instrument(null, null, null, null) {

                public Object getData() {
                    return null;
                }
            };
            return new Instrument[] { ins };
        }

        public Instrument getInstrument(Patch patch) {
            return null;
        }
    };
    assertTrue(!synth.isSoundbankSupported(dummysbk));
    synth.close();
}
Also used : Soundbank(javax.sound.midi.Soundbank) SoundbankResource(javax.sound.midi.SoundbankResource) Instrument(javax.sound.midi.Instrument) Patch(javax.sound.midi.Patch)

Example 2 with SoundbankResource

use of javax.sound.midi.SoundbankResource in project jdk8u_jdk by JetBrains.

the class AddResource method main.

public static void main(String[] args) throws Exception {
    SimpleSoundbank soundbank = new SimpleSoundbank();
    SoundbankResource res = new SoundbankResource(soundbank, "test", null) {

        public Object getData() {
            return null;
        }
    };
    soundbank.addResource(res);
    assertEquals(soundbank.getResources().length, 1);
    assertEquals(soundbank.getResources()[0], res);
}
Also used : SoundbankResource(javax.sound.midi.SoundbankResource)

Aggregations

SoundbankResource (javax.sound.midi.SoundbankResource)2 Instrument (javax.sound.midi.Instrument)1 Patch (javax.sound.midi.Patch)1 Soundbank (javax.sound.midi.Soundbank)1