Search in sources :

Example 11 with WaveData

use of org.lwjgl.util.WaveData in project lwjgl by LWJGL.

the class WaveDataTest method executeMidStreamCreationTest.

private void executeMidStreamCreationTest() {
    try {
        AudioInputStream ais = AudioSystem.getAudioInputStream(WaveDataTest.class.getClassLoader().getResource(filePath));
        int totalSize = ais.getFormat().getChannels() * (int) ais.getFrameLength() * ais.getFormat().getSampleSizeInBits() / 8;
        // skip 1/4 of the stream
        int skip = totalSize / 4;
        long skipped = ais.skip(skip);
        WaveData wd = WaveData.create(ais);
        if (wd == null) {
            System.out.println("executeMidStreamCreationTest::success");
        }
    } catch (Exception e) {
        e.printStackTrace();
    }
}
Also used : AudioInputStream(javax.sound.sampled.AudioInputStream) WaveData(org.lwjgl.util.WaveData) LWJGLException(org.lwjgl.LWJGLException)

Aggregations

WaveData (org.lwjgl.util.WaveData)11 IntBuffer (java.nio.IntBuffer)4 ByteBuffer (java.nio.ByteBuffer)2 AudioInputStream (javax.sound.sampled.AudioInputStream)2 LWJGLException (org.lwjgl.LWJGLException)2 File (java.io.File)1 Vector3f (org.lwjgl.util.vector.Vector3f)1