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

The following examples show how to use javax.sound.sampled.AudioFileFormat#getByteLength() . 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: 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 2
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 3
Source File: AiffFileFormat.java    From TencentKona-8 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: RecognizeHugeAuFiles.java    From openjdk-jdk9 with GNU General Public License v2.0 4 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 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());
}
 
Example 5
Source File: AiffFileFormat.java    From openjdk-8 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 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 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: AiffFileFormat.java    From openjdk-jdk8u 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 9
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 10
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 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 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 13
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 14
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 15
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 16
Source File: AuFileFormat.java    From jdk8u60 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 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 19
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() );
    }
 
Example 20
Source File: AuFileFormat.java    From dragonwell8_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() );
    }