当前位置: 首页>>代码示例>>Java>>正文


Java Soundbank.getInstrument方法代码示例

本文整理汇总了Java中javax.sound.midi.Soundbank.getInstrument方法的典型用法代码示例。如果您正苦于以下问题:Java Soundbank.getInstrument方法的具体用法?Java Soundbank.getInstrument怎么用?Java Soundbank.getInstrument使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在javax.sound.midi.Soundbank的用法示例。


在下文中一共展示了Soundbank.getInstrument方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: main

import javax.sound.midi.Soundbank; //导入方法依赖的package包/类
public static void main(String[] args) throws Exception {
    AudioSynthesizer synth = new SoftSynthesizer();
    synth.openStream(null, null);
    Soundbank defsbk = synth.getDefaultSoundbank();
    if(defsbk != null)
    {
        Instrument ins3 = defsbk.getInstrument(new Patch(0,3));
        Instrument ins10 = defsbk.getInstrument(new Patch(0,10));
        assertTrue(synth.remapInstrument(ins3, ins10));
        Instrument[] loaded = synth.getLoadedInstruments();
        for (int i = 0; i < loaded.length; i++) {
            if(loaded[i].getPatch().getBank() == ins3.getPatch().getBank())
            if(loaded[i].getPatch().getProgram() == ins3.getPatch().getProgram())
            {
                assertEquals(loaded[i].getName(), ins10.getName());
                break;
            }
        }

    }
    synth.close();

}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:24,代码来源:RemapInstrument.java

示例2: loadInstruments

import javax.sound.midi.Soundbank; //导入方法依赖的package包/类
public boolean loadInstruments(Soundbank soundbank, Patch[] patchList) {
    List<ModelInstrument> instruments = new ArrayList<ModelInstrument>();
    for (Patch patch: patchList) {
        Instrument ins = soundbank.getInstrument(patch);
        if (ins == null || !(ins instanceof ModelInstrument)) {
            throw new IllegalArgumentException(
                    "Unsupported instrument: " + ins);
        }
        instruments.add((ModelInstrument)ins);
    }
    return loadInstruments(instruments);
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:13,代码来源:SoftSynthesizer.java

示例3: unloadInstruments

import javax.sound.midi.Soundbank; //导入方法依赖的package包/类
public void unloadInstruments(Soundbank soundbank, Patch[] patchList) {
    if (soundbank == null || !isSoundbankSupported(soundbank))
        throw new IllegalArgumentException("Unsupported soundbank: " + soundbank);

    if (!isOpen())
        return;

    for (Patch pat: patchList) {
        Instrument ins = soundbank.getInstrument(pat);
        if (ins instanceof ModelInstrument) {
            unloadInstrument(ins);
        }
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:15,代码来源:SoftSynthesizer.java

示例4: loadInstruments

import javax.sound.midi.Soundbank; //导入方法依赖的package包/类
@Override
public boolean loadInstruments(Soundbank soundbank, Patch[] patchList) {
    List<ModelInstrument> instruments = new ArrayList<>();
    for (Patch patch: patchList) {
        Instrument ins = soundbank.getInstrument(patch);
        if (ins == null || !(ins instanceof ModelInstrument)) {
            throw new IllegalArgumentException(
                    "Unsupported instrument: " + ins);
        }
        instruments.add((ModelInstrument)ins);
    }
    return loadInstruments(instruments);
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:14,代码来源:SoftSynthesizer.java

示例5: unloadInstruments

import javax.sound.midi.Soundbank; //导入方法依赖的package包/类
@Override
public void unloadInstruments(Soundbank soundbank, Patch[] patchList) {
    if (soundbank == null || !isSoundbankSupported(soundbank))
        throw new IllegalArgumentException("Unsupported soundbank: " + soundbank);

    if (!isOpen())
        return;

    for (Patch pat: patchList) {
        Instrument ins = soundbank.getInstrument(pat);
        if (ins instanceof ModelInstrument) {
            unloadInstrument(ins);
        }
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:16,代码来源:SoftSynthesizer.java


注:本文中的javax.sound.midi.Soundbank.getInstrument方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。