本文整理匯總了Java中javax.sound.sampled.AudioFileFormat.getType方法的典型用法代碼示例。如果您正苦於以下問題:Java AudioFileFormat.getType方法的具體用法?Java AudioFileFormat.getType怎麽用?Java AudioFileFormat.getType使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類javax.sound.sampled.AudioFileFormat
的用法示例。
在下文中一共展示了AudioFileFormat.getType方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: testAFF
import javax.sound.sampled.AudioFileFormat; //導入方法依賴的package包/類
/**
* Tests the {@code AudioFileFormat} fetched from the fake header.
* <p>
* Note that the frameLength and byteLength are stored as int which means
* that {@code AudioFileFormat} will store the data above {@code MAX_INT} as
* NOT_SPECIFIED.
*/
private static void testAFF(final byte[] type, final int rate,
final int channel, final long size)
throws Exception {
final byte[] header = createHeader(type, rate, channel, size);
final ByteArrayInputStream fake = new ByteArrayInputStream(header);
final AudioFileFormat aff = AudioSystem.getAudioFileFormat(fake);
final AudioFormat format = aff.getFormat();
if (aff.getType() != AudioFileFormat.Type.WAVE) {
throw new RuntimeException("Error");
}
final long frameLength = size / format.getFrameSize();
if (frameLength <= Integer.MAX_VALUE) {
if (aff.getFrameLength() != frameLength) {
System.err.println("Expected: " + frameLength);
System.err.println("Actual: " + aff.getFrameLength());
throw new RuntimeException();
}
} else {
if (aff.getFrameLength() != AudioSystem.NOT_SPECIFIED) {
System.err.println("Expected: " + AudioSystem.NOT_SPECIFIED);
System.err.println("Actual: " + aff.getFrameLength());
throw new RuntimeException();
}
}
validateFormat(type[1], rate, channel, aff.getFormat());
}
示例2: testAFF
import javax.sound.sampled.AudioFileFormat; //導入方法依賴的package包/類
/**
* Tests the {@code AudioFileFormat} fetched from the fake header.
* <p>
* Note that the frameLength and byteLength are stored as int which means
* that {@code AudioFileFormat} will store the data above {@code MAX_INT} as
* NOT_SPECIFIED.
*/
private static void testAFF(final int[] type, final int rate,
final int channel, final long size)
throws Exception {
final byte[] header = createHeader(type, rate, channel, size);
final ByteArrayInputStream fake = new ByteArrayInputStream(header);
final AudioFileFormat aff = AudioSystem.getAudioFileFormat(fake);
final AudioFormat format = aff.getFormat();
if (aff.getType() != AudioFileFormat.Type.WAVE) {
throw new RuntimeException("Error");
}
final long frameLength = size / format.getFrameSize();
if (frameLength <= Integer.MAX_VALUE) {
if (aff.getFrameLength() != frameLength) {
System.err.println("Expected: " + frameLength);
System.err.println("Actual: " + aff.getFrameLength());
throw new RuntimeException();
}
} else {
if (aff.getFrameLength() != AudioSystem.NOT_SPECIFIED) {
System.err.println("Expected: " + AudioSystem.NOT_SPECIFIED);
System.err.println("Actual: " + aff.getFrameLength());
throw new RuntimeException();
}
}
validateFormat(type[1], rate, channel, aff.getFormat());
}
示例3: testAFF
import javax.sound.sampled.AudioFileFormat; //導入方法依賴的package包/類
/**
* Tests the {@code AudioFileFormat} fetched from the fake header.
* <p>
* Note that the frameLength and byteLength are stored as int which means
* that {@code AudioFileFormat} will store the data above {@code MAX_INT} as
* NOT_SPECIFIED.
*/
private static void testAFF(final byte bits, final int rate,
final int channel, final long frameLength)
throws Exception {
final byte[] header = createHeader(bits, rate, channel, frameLength);
final ByteArrayInputStream fake = new ByteArrayInputStream(header);
final AudioFileFormat aff = AudioSystem.getAudioFileFormat(fake);
if (aff.getType() != AudioFileFormat.Type.AIFF) {
throw new RuntimeException("Error");
}
if (frameLength <= Integer.MAX_VALUE) {
if (aff.getFrameLength() != frameLength) {
System.err.println("Expected: " + frameLength);
System.err.println("Actual: " + aff.getFrameLength());
throw new RuntimeException();
}
} else {
if (aff.getFrameLength() != AudioSystem.NOT_SPECIFIED) {
System.err.println("Expected: " + AudioSystem.NOT_SPECIFIED);
System.err.println("Actual: " + aff.getFrameLength());
throw new RuntimeException();
}
}
validateFormat(bits, rate, channel, aff.getFormat());
}
示例4: AiffFileFormat
import javax.sound.sampled.AudioFileFormat; //導入方法依賴的package包/類
AiffFileFormat( AudioFileFormat aff ) {
this( aff.getType(), aff.getByteLength(), aff.getFormat(), aff.getFrameLength() );
}
示例5: testAFF
import javax.sound.sampled.AudioFileFormat; //導入方法依賴的package包/類
/**
* Tests the {@code AudioFileFormat} fetched from the fake header.
* <p>
* Note that the frameLength and byteLength are stored as int which means
* that {@code AudioFileFormat} will store the data above {@code MAX_INT}
* as NOT_SPECIFIED.
*/
private static void testAFF(final byte[] type, final int rate,
final int channel, final long size)
throws Exception {
final byte[] header = createHeader(type, rate, channel, size);
final ByteArrayInputStream fake = new ByteArrayInputStream(header);
final AudioFileFormat aff = AudioSystem.getAudioFileFormat(fake);
final AudioFormat format = aff.getFormat();
if (aff.getType() != AudioFileFormat.Type.AU) {
throw new RuntimeException("Error");
}
final long frameLength = size / format.getFrameSize();
if (size != MAX_UNSIGNED_INT && frameLength <= Integer.MAX_VALUE) {
if (aff.getFrameLength() != frameLength) {
System.err.println("Expected: " + frameLength);
System.err.println("Actual: " + aff.getFrameLength());
throw new RuntimeException();
}
} else {
if (aff.getFrameLength() != AudioSystem.NOT_SPECIFIED) {
System.err.println("Expected: " + AudioSystem.NOT_SPECIFIED);
System.err.println("Actual: " + aff.getFrameLength());
throw new RuntimeException();
}
}
final long byteLength = size + AU_HEADER;
if (byteLength <= Integer.MAX_VALUE) {
if (aff.getByteLength() != byteLength) {
System.err.println("Expected: " + byteLength);
System.err.println("Actual: " + aff.getByteLength());
throw new RuntimeException();
}
} else {
if (aff.getByteLength() != AudioSystem.NOT_SPECIFIED) {
System.err.println("Expected: " + AudioSystem.NOT_SPECIFIED);
System.err.println("Actual: " + aff.getByteLength());
throw new RuntimeException();
}
}
validateFormat(type[1], rate, channel, aff.getFormat());
}
示例6: WaveFileFormat
import javax.sound.sampled.AudioFileFormat; //導入方法依賴的package包/類
WaveFileFormat( AudioFileFormat aff ) {
this( aff.getType(), aff.getByteLength(), aff.getFormat(), aff.getFrameLength() );
}
示例7: AuFileFormat
import javax.sound.sampled.AudioFileFormat; //導入方法依賴的package包/類
AuFileFormat( AudioFileFormat aff ) {
this( aff.getType(), aff.getByteLength(), aff.getFormat(), aff.getFrameLength() );
}