Java Code Examples for javax.sound.sampled.AudioFileFormat#getType()

The following examples show how to use javax.sound.sampled.AudioFileFormat#getType() . 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: RecognizeHugeWaveExtFiles.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * 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());
}
 
Example 2
Source File: AiffFileFormat.java    From openjdk-8-source with GNU General Public License v2.0 4 votes vote down vote up
AiffFileFormat( AudioFileFormat aff ) {
    this( aff.getType(), aff.getByteLength(), aff.getFormat(), aff.getFrameLength() );
}
 
Example 3
Source File: AiffFileFormat.java    From dragonwell8_jdk with GNU General Public License v2.0 4 votes vote down vote up
AiffFileFormat( AudioFileFormat aff ) {
    this( aff.getType(), aff.getByteLength(), aff.getFormat(), aff.getFrameLength() );
}
 
Example 4
Source File: AiffFileFormat.java    From jdk8u_jdk with GNU General Public License v2.0 4 votes vote down vote up
AiffFileFormat( AudioFileFormat aff ) {
    this( aff.getType(), aff.getByteLength(), aff.getFormat(), aff.getFrameLength() );
}
 
Example 5
Source File: AiffFileFormat.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 4 votes vote down vote up
AiffFileFormat( AudioFileFormat aff ) {
    this( aff.getType(), aff.getByteLength(), aff.getFormat(), aff.getFrameLength() );
}
 
Example 6
Source File: AiffFileFormat.java    From hottub with GNU General Public License v2.0 4 votes vote down vote up
AiffFileFormat( AudioFileFormat aff ) {
    this( aff.getType(), aff.getByteLength(), aff.getFormat(), aff.getFrameLength() );
}
 
Example 7
Source File: AiffFileFormat.java    From jdk8u-jdk with GNU General Public License v2.0 4 votes vote down vote up
AiffFileFormat( AudioFileFormat aff ) {
    this( aff.getType(), aff.getByteLength(), aff.getFormat(), aff.getFrameLength() );
}
 
Example 8
Source File: WaveFileFormat.java    From jdk8u-jdk with GNU General Public License v2.0 2 votes vote down vote up
WaveFileFormat( AudioFileFormat aff ) {

        this( aff.getType(), aff.getByteLength(), aff.getFormat(), aff.getFrameLength() );
    }
 
Example 9
Source File: WaveFileFormat.java    From jdk8u_jdk with GNU General Public License v2.0 2 votes vote down vote up
WaveFileFormat( AudioFileFormat aff ) {

        this( aff.getType(), aff.getByteLength(), aff.getFormat(), aff.getFrameLength() );
    }
 
Example 10
Source File: WaveFileFormat.java    From openjdk-8-source with GNU General Public License v2.0 2 votes vote down vote up
WaveFileFormat( AudioFileFormat aff ) {

        this( aff.getType(), aff.getByteLength(), aff.getFormat(), aff.getFrameLength() );
    }
 
Example 11
Source File: WaveFileFormat.java    From hottub with GNU General Public License v2.0 2 votes vote down vote up
WaveFileFormat( AudioFileFormat aff ) {

        this( aff.getType(), aff.getByteLength(), aff.getFormat(), aff.getFrameLength() );
    }
 
Example 12
Source File: AuFileFormat.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 2 votes vote down vote up
AuFileFormat( AudioFileFormat aff ) {

        this( aff.getType(), aff.getByteLength(), aff.getFormat(), aff.getFrameLength() );
    }
 
Example 13
Source File: AuFileFormat.java    From openjdk-jdk8u with GNU General Public License v2.0 2 votes vote down vote up
AuFileFormat( AudioFileFormat aff ) {

        this( aff.getType(), aff.getByteLength(), aff.getFormat(), aff.getFrameLength() );
    }
 
Example 14
Source File: WaveFileFormat.java    From openjdk-jdk8u with GNU General Public License v2.0 2 votes vote down vote up
WaveFileFormat( AudioFileFormat aff ) {

        this( aff.getType(), aff.getByteLength(), aff.getFormat(), aff.getFrameLength() );
    }
 
Example 15
Source File: AuFileFormat.java    From openjdk-8-source with GNU General Public License v2.0 2 votes vote down vote up
AuFileFormat( AudioFileFormat aff ) {

        this( aff.getType(), aff.getByteLength(), aff.getFormat(), aff.getFrameLength() );
    }
 
Example 16
Source File: AuFileFormat.java    From hottub with GNU General Public License v2.0 2 votes vote down vote up
AuFileFormat( AudioFileFormat aff ) {

        this( aff.getType(), aff.getByteLength(), aff.getFormat(), aff.getFrameLength() );
    }
 
Example 17
Source File: WaveFileFormat.java    From jdk8u60 with GNU General Public License v2.0 2 votes vote down vote up
WaveFileFormat( AudioFileFormat aff ) {

        this( aff.getType(), aff.getByteLength(), aff.getFormat(), aff.getFrameLength() );
    }
 
Example 18
Source File: AuFileFormat.java    From jdk8u-jdk with GNU General Public License v2.0 2 votes vote down vote up
AuFileFormat( AudioFileFormat aff ) {

        this( aff.getType(), aff.getByteLength(), aff.getFormat(), aff.getFrameLength() );
    }
 
Example 19
Source File: AuFileFormat.java    From TencentKona-8 with GNU General Public License v2.0 2 votes vote down vote up
AuFileFormat( AudioFileFormat aff ) {

        this( aff.getType(), aff.getByteLength(), aff.getFormat(), aff.getFrameLength() );
    }
 
Example 20
Source File: WaveFileFormat.java    From TencentKona-8 with GNU General Public License v2.0 2 votes vote down vote up
WaveFileFormat( AudioFileFormat aff ) {

        this( aff.getType(), aff.getByteLength(), aff.getFormat(), aff.getFrameLength() );
    }