本文整理匯總了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);
}
}
}
示例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());
}
}
}