Java Code Examples for javax.sound.midi.Soundbank#getInstruments()

The following examples show how to use javax.sound.midi.Soundbank#getInstruments() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: SoftSynthesizer.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
public Instrument[] getAvailableInstruments() {
    Soundbank defsbk = getDefaultSoundbank();
    if (defsbk == null)
        return new Instrument[0];
    Instrument[] inslist_array = defsbk.getInstruments();
    Arrays.sort(inslist_array, new ModelInstrumentComparator());
    return inslist_array;
}
 
Example 2
Source File: SoftSynthesizer.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
@Override
public void unloadAllInstruments(Soundbank soundbank) {
    if (soundbank == null || !isSoundbankSupported(soundbank))
        throw new IllegalArgumentException("Unsupported soundbank: " + soundbank);

    if (!isOpen())
        return;

    for (Instrument ins: soundbank.getInstruments()) {
        if (ins instanceof ModelInstrument) {
            unloadInstrument(ins);
        }
    }
}
 
Example 3
Source File: SoftSynthesizer.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
public boolean loadAllInstruments(Soundbank soundbank) {
    List<ModelInstrument> instruments = new ArrayList<ModelInstrument>();
    for (Instrument ins: soundbank.getInstruments()) {
        if (ins == null || !(ins instanceof ModelInstrument)) {
            throw new IllegalArgumentException(
                    "Unsupported instrument: " + ins);
        }
        instruments.add((ModelInstrument)ins);
    }
    return loadInstruments(instruments);
}
 
Example 4
Source File: SoftSynthesizer.java    From dragonwell8_jdk with GNU General Public License v2.0 5 votes vote down vote up
public void unloadAllInstruments(Soundbank soundbank) {
    if (soundbank == null || !isSoundbankSupported(soundbank))
        throw new IllegalArgumentException("Unsupported soundbank: " + soundbank);

    if (!isOpen())
        return;

    for (Instrument ins: soundbank.getInstruments()) {
        if (ins instanceof ModelInstrument) {
            unloadInstrument(ins);
        }
    }
}
 
Example 5
Source File: SoftSynthesizer.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
public boolean loadAllInstruments(Soundbank soundbank) {
    List<ModelInstrument> instruments = new ArrayList<ModelInstrument>();
    for (Instrument ins: soundbank.getInstruments()) {
        if (ins == null || !(ins instanceof ModelInstrument)) {
            throw new IllegalArgumentException(
                    "Unsupported instrument: " + ins);
        }
        instruments.add((ModelInstrument)ins);
    }
    return loadInstruments(instruments);
}
 
Example 6
Source File: SoftSynthesizer.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
@Override
public boolean loadAllInstruments(Soundbank soundbank) {
    List<ModelInstrument> instruments = new ArrayList<>();
    for (Instrument ins: soundbank.getInstruments()) {
        if (ins == null || !(ins instanceof ModelInstrument)) {
            throw new IllegalArgumentException(
                    "Unsupported instrument: " + ins);
        }
        instruments.add((ModelInstrument)ins);
    }
    return loadInstruments(instruments);
}
 
Example 7
Source File: SoftSynthesizer.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
public Instrument[] getAvailableInstruments() {
    Soundbank defsbk = getDefaultSoundbank();
    if (defsbk == null)
        return new Instrument[0];
    Instrument[] inslist_array = defsbk.getInstruments();
    Arrays.sort(inslist_array, new ModelInstrumentComparator());
    return inslist_array;
}
 
Example 8
Source File: SoftSynthesizer.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
public boolean loadAllInstruments(Soundbank soundbank) {
    List<ModelInstrument> instruments = new ArrayList<ModelInstrument>();
    for (Instrument ins: soundbank.getInstruments()) {
        if (ins == null || !(ins instanceof ModelInstrument)) {
            throw new IllegalArgumentException(
                    "Unsupported instrument: " + ins);
        }
        instruments.add((ModelInstrument)ins);
    }
    return loadInstruments(instruments);
}
 
Example 9
Source File: SoftSynthesizer.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
public void unloadAllInstruments(Soundbank soundbank) {
    if (soundbank == null || !isSoundbankSupported(soundbank))
        throw new IllegalArgumentException("Unsupported soundbank: " + soundbank);

    if (!isOpen())
        return;

    for (Instrument ins: soundbank.getInstruments()) {
        if (ins instanceof ModelInstrument) {
            unloadInstrument(ins);
        }
    }
}
 
Example 10
Source File: SoftSynthesizer.java    From Bytecoder with Apache License 2.0 5 votes vote down vote up
@Override
public Instrument[] getAvailableInstruments() {
    Soundbank defsbk = getDefaultSoundbank();
    if (defsbk == null)
        return new Instrument[0];
    Instrument[] inslist_array = defsbk.getInstruments();
    Arrays.sort(inslist_array, new ModelInstrumentComparator());
    return inslist_array;
}
 
Example 11
Source File: SoftSynthesizer.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
public void unloadAllInstruments(Soundbank soundbank) {
    if (soundbank == null || !isSoundbankSupported(soundbank))
        throw new IllegalArgumentException("Unsupported soundbank: " + soundbank);

    if (!isOpen())
        return;

    for (Instrument ins: soundbank.getInstruments()) {
        if (ins instanceof ModelInstrument) {
            unloadInstrument(ins);
        }
    }
}
 
Example 12
Source File: SimpleSoundbank.java    From openjdk-jdk9 with GNU General Public License v2.0 4 votes vote down vote up
public void removeAllInstruments(Soundbank soundbank) {
    for (Instrument ins : soundbank.getInstruments())
        removeInstrument(ins);
}
 
Example 13
Source File: SimpleSoundbank.java    From openjdk-jdk8u with GNU General Public License v2.0 4 votes vote down vote up
public void removeAllInstruments(Soundbank soundbank) {
    for (Instrument ins : soundbank.getInstruments())
        removeInstrument(ins);
}
 
Example 14
Source File: SimpleSoundbank.java    From Bytecoder with Apache License 2.0 4 votes vote down vote up
public void addAllInstruments(Soundbank soundbank) {
    for (Instrument ins : soundbank.getInstruments())
        addInstrument(ins);
}
 
Example 15
Source File: SimpleSoundbank.java    From jdk8u60 with GNU General Public License v2.0 4 votes vote down vote up
public void removeAllInstruments(Soundbank soundbank) {
    for (Instrument ins : soundbank.getInstruments())
        removeInstrument(ins);
}
 
Example 16
Source File: SimpleSoundbank.java    From openjdk-jdk9 with GNU General Public License v2.0 4 votes vote down vote up
public void addAllInstruments(Soundbank soundbank) {
    for (Instrument ins : soundbank.getInstruments())
        addInstrument(ins);
}
 
Example 17
Source File: SimpleSoundbank.java    From TencentKona-8 with GNU General Public License v2.0 4 votes vote down vote up
public void removeAllInstruments(Soundbank soundbank) {
    for (Instrument ins : soundbank.getInstruments())
        removeInstrument(ins);
}
 
Example 18
Source File: SimpleSoundbank.java    From TencentKona-8 with GNU General Public License v2.0 4 votes vote down vote up
public void addAllInstruments(Soundbank soundbank) {
    for (Instrument ins : soundbank.getInstruments())
        addInstrument(ins);
}
 
Example 19
Source File: SimpleSoundbank.java    From Bytecoder with Apache License 2.0 4 votes vote down vote up
public void removeAllInstruments(Soundbank soundbank) {
    for (Instrument ins : soundbank.getInstruments())
        removeInstrument(ins);
}
 
Example 20
Source File: SimpleSoundbank.java    From dragonwell8_jdk with GNU General Public License v2.0 4 votes vote down vote up
public void removeAllInstruments(Soundbank soundbank) {
    for (Instrument ins : soundbank.getInstruments())
        removeInstrument(ins);
}