com.sun.media.sound.SF2Region Java Examples

The following examples show how to use com.sun.media.sound.SF2Region. 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: SF2Soundbank.java    From tuxguitar with GNU Lesser General Public License v2.1 6 votes vote down vote up
private void writeGenerators(RIFFWriter writer, Map<Integer, Short> generators)
        throws IOException {
    Short keyrange = (Short) generators.get(SF2Region.GENERATOR_KEYRANGE);
    Short velrange = (Short) generators.get(SF2Region.GENERATOR_VELRANGE);
    if (keyrange != null) {
        writer.writeUnsignedShort(SF2Region.GENERATOR_KEYRANGE);
        writer.writeShort(keyrange);
    }
    if (velrange != null) {
        writer.writeUnsignedShort(SF2Region.GENERATOR_VELRANGE);
        writer.writeShort(velrange);
    }
    for (Map.Entry<Integer, Short> generator : generators.entrySet()) {
        if (generator.getKey() == SF2Region.GENERATOR_KEYRANGE)
            continue;
        if (generator.getKey() == SF2Region.GENERATOR_VELRANGE)
            continue;
        writer.writeUnsignedShort(generator.getKey());
        writer.writeShort(generator.getValue());
    }
}
 
Example #2
Source File: SF2Instrument.java    From tuxguitar with GNU Lesser General Public License v2.1 4 votes vote down vote up
private short getGeneratorValue(Map<Integer, Short> generators, int gen) {
    if (generators.containsKey(gen))
        return generators.get(gen);
    return SF2Region.getDefaultValue(gen);
}