use of javax.sound.midi.Soundbank in project jdk8u_jdk by JetBrains.
the class TestDisableLoadDefaultSoundbank method main.
public static void main(String[] args) throws Exception {
AudioSynthesizer synth = new SoftSynthesizer();
synth.openStream(null, null);
Soundbank defsbk = synth.getDefaultSoundbank();
if (defsbk != null) {
assertTrue(defsbk.getInstruments().length == synth.getLoadedInstruments().length);
}
synth.close();
Map<String, Object> p = new HashMap<String, Object>();
p.put("load default soundbank", false);
synth.openStream(null, p);
if (defsbk != null) {
assertTrue(synth.getLoadedInstruments().length == 0);
}
synth.close();
}
use of javax.sound.midi.Soundbank in project jdk8u_jdk by JetBrains.
the class GetAvailableInstruments2 method main.
public static void main(String[] args) throws Exception {
AudioSynthesizer synth = new SoftSynthesizer();
synth.openStream(null, null);
Soundbank defsbk = synth.getDefaultSoundbank();
if (defsbk != null) {
synth.unloadAllInstruments(defsbk);
assertTrue(defsbk.getInstruments().length == synth.getAvailableInstruments().length);
}
synth.close();
}
use of javax.sound.midi.Soundbank in project jdk8u_jdk by JetBrains.
the class LoadAllInstruments method main.
public static void main(String[] args) throws Exception {
AudioSynthesizer synth = new SoftSynthesizer();
synth.openStream(null, null);
Soundbank defsbk = synth.getDefaultSoundbank();
if (defsbk != null) {
synth.unloadAllInstruments(defsbk);
SimpleSoundbank sbk = new SimpleSoundbank();
SimpleInstrument ins = new SimpleInstrument();
ins.setPatch(new Patch(0, 1));
sbk.addInstrument(ins);
SimpleInstrument ins2 = new SimpleInstrument();
ins2.setPatch(new Patch(0, 2));
sbk.addInstrument(ins2);
synth.loadAllInstruments(sbk);
assertTrue(synth.getLoadedInstruments().length == 2);
}
synth.close();
}
use of javax.sound.midi.Soundbank in project jdk8u_jdk by JetBrains.
the class LoadInstruments method main.
public static void main(String[] args) throws Exception {
AudioSynthesizer synth = new SoftSynthesizer();
synth.openStream(null, null);
Soundbank defsbk = synth.getDefaultSoundbank();
if (defsbk != null) {
synth.unloadAllInstruments(defsbk);
SimpleSoundbank sbk = new SimpleSoundbank();
SimpleInstrument ins = new SimpleInstrument();
ins.setPatch(new Patch(0, 1));
sbk.addInstrument(ins);
SimpleInstrument ins2 = new SimpleInstrument();
ins2.setPatch(new Patch(0, 2));
sbk.addInstrument(ins2);
synth.loadInstruments(sbk, new Patch[] { ins2.getPatch() });
assertTrue(synth.getLoadedInstruments().length == 1);
}
synth.close();
}
use of javax.sound.midi.Soundbank in project jdk8u_jdk by JetBrains.
the class GetLoadedInstruments method main.
public static void main(String[] args) throws Exception {
AudioSynthesizer synth = new SoftSynthesizer();
synth.openStream(null, null);
Soundbank defsbk = synth.getDefaultSoundbank();
if (defsbk != null) {
synth.unloadAllInstruments(defsbk);
synth.loadAllInstruments(defsbk);
assertTrue(synth.getLoadedInstruments().length != 0);
}
synth.close();
}
Aggregations