com.sun.media.sound.RIFFReader Java Examples

The following examples show how to use com.sun.media.sound.RIFFReader. 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 readSoundbank(InputStream inputstream) throws IOException {
    RIFFReader riff = new RIFFReader(inputstream);
    if (!riff.getFormat().equals("RIFF")) {
        throw new RIFFInvalidFormatException(
                "Input stream is not a valid RIFF stream!");
    }
    if (!riff.getType().equals("sfbk")) {
        throw new RIFFInvalidFormatException(
                "Input stream is not a valid SoundFont!");
    }
    while (riff.hasNextChunk()) {
        RIFFReader chunk = riff.nextChunk();
        if (chunk.getFormat().equals("LIST")) {
            if (chunk.getType().equals("INFO"))
                readInfoChunk(chunk);
            if (chunk.getType().equals("sdta"))
                readSdtaChunk(chunk);
            if (chunk.getType().equals("pdta"))
                readPdtaChunk(chunk);
        }
    }
}
 
Example #2
Source File: SF2Soundbank.java    From tuxguitar with GNU Lesser General Public License v2.1 5 votes vote down vote up
private void readInfoChunk(RIFFReader riff) throws IOException {
    while (riff.hasNextChunk()) {
        RIFFReader chunk = riff.nextChunk();
        String format = chunk.getFormat();
        if (format.equals("ifil")) {
            major = chunk.readUnsignedShort();
            minor = chunk.readUnsignedShort();
        } else if (format.equals("isng")) {
            this.targetEngine = chunk.readString(chunk.available());
        } else if (format.equals("INAM")) {
            this.name = chunk.readString(chunk.available());
        } else if (format.equals("irom")) {
            this.romName = chunk.readString(chunk.available());
        } else if (format.equals("iver")) {
            romVersionMajor = chunk.readUnsignedShort();
            romVersionMinor = chunk.readUnsignedShort();
        } else if (format.equals("ICRD")) {
            this.creationDate = chunk.readString(chunk.available());
        } else if (format.equals("IENG")) {
            this.engineers = chunk.readString(chunk.available());
        } else if (format.equals("IPRD")) {
            this.product = chunk.readString(chunk.available());
        } else if (format.equals("ICOP")) {
            this.copyright = chunk.readString(chunk.available());
        } else if (format.equals("ICMT")) {
            this.comments = chunk.readString(chunk.available());
        } else if (format.equals("ISFT")) {
            this.tools = chunk.readString(chunk.available());
        }

    }
}