當前位置: 首頁>>代碼示例>>Java>>正文


Java Synthesizer.unloadAllInstruments方法代碼示例

本文整理匯總了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.");
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:25,代碼來源:ExtraCharInSoundbank.java

示例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);
}
 
開發者ID:bluenote10,項目名稱:gervill,代碼行數:26,代碼來源:FMTest1.java

示例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());
}
 
開發者ID:digero,項目名稱:maestro,代碼行數:8,代碼來源:SynthesizerFactory.java


注:本文中的javax.sound.midi.Synthesizer.unloadAllInstruments方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。