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


Java RIFFReader類代碼示例

本文整理匯總了Java中com.sun.media.sound.RIFFReader的典型用法代碼示例。如果您正苦於以下問題:Java RIFFReader類的具體用法?Java RIFFReader怎麽用?Java RIFFReader使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


RIFFReader類屬於com.sun.media.sound包,在下文中一共展示了RIFFReader類的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: readSoundbank

import com.sun.media.sound.RIFFReader; //導入依賴的package包/類
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);
        }
    }
}
 
開發者ID:theokyr,項目名稱:TuxGuitar-1.3.1-fork,代碼行數:23,代碼來源:SF2Soundbank.java

示例2: readInfoChunk

import com.sun.media.sound.RIFFReader; //導入依賴的package包/類
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());
        }

    }
}
 
開發者ID:theokyr,項目名稱:TuxGuitar-1.3.1-fork,代碼行數:33,代碼來源:SF2Soundbank.java


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