本文整理汇总了Java中javax.sound.midi.Synthesizer.unloadAllInstruments方法的典型用法代码示例。如果您正苦于以下问题:Java Synthesizer.unloadAllInstruments方法的具体用法?Java Synthesizer.unloadAllInstruments怎么用?Java Synthesizer.unloadAllInstruments使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.sound.midi.Synthesizer
的用法示例。
在下文中一共展示了Synthesizer.unloadAllInstruments方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: main
import javax.sound.midi.Synthesizer; //导入方法依赖的package包/类
public static void main(String[] args) throws Exception {
// the internal synthesizer needs a soundcard to work properly
if (!isSoundcardInstalled()) {
return;
}
Synthesizer theSynth = MidiSystem.getSynthesizer();
System.out.println("Got synth: "+theSynth);
theSynth.open();
try {
Soundbank theSoundbank = theSynth.getDefaultSoundbank();
System.out.println("Got soundbank: "+theSoundbank);
theSynth.loadAllInstruments(theSoundbank);
try {
if (!checkInstrumentNames(theSynth)) {
throw new Exception("Test failed");
}
} finally {
theSynth.unloadAllInstruments(theSoundbank);
}
} finally {
theSynth.close();
}
System.out.println("Test passed.");
}
示例2: main
import javax.sound.midi.Synthesizer; //导入方法依赖的package包/类
public static void main(String[] args) throws Exception {
Synthesizer synth = MidiSystem.getSynthesizer();
synth.open();
synth.unloadAllInstruments(synth.getDefaultSoundbank());
synth.loadAllInstruments(new MyOscillator());
Sequence seq = MidiSystem.getSequence(FMTest1.class.getResource("/FMTest1.mid"));
Sequencer seqr = MidiSystem.getSequencer(false);
seqr.open();
seqr.getTransmitter().setReceiver(synth.getReceiver());
seqr.setSequence(seq);
seqr.start();
System.out.println();
System.out.println("Is active, press enter to stop");
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
br.readLine();
System.out.println("Stop...");
seqr.stop();
seqr.close();
synth.close();
System.exit(0);
}
示例3: initLotroSynthesizer
import javax.sound.midi.Synthesizer; //导入方法依赖的package包/类
public static void initLotroSynthesizer(Synthesizer synth) throws MidiUnavailableException,
InvalidMidiDataException, IOException
{
synth.open();
synth.unloadAllInstruments(getLotroSoundbank());
synth.loadAllInstruments(getLotroSoundbank());
}