Examples of WaveData


Examples of org.lwjgl.util.WaveData

        setupEfx();

        // Create a source and buffer audio data
        final int source = AL10.alGenSources();
        final int buffer = AL10.alGenBuffers();
        WaveData waveFile = WaveData.create("Footsteps.wav");
        if (waveFile == null) {
            System.out.println("Failed to load Footsteps.wav! Skipping playback test.");
            AL.destroy();
            return;
        }
        AL10.alBufferData(buffer, waveFile.format, waveFile.data, waveFile.samplerate);
        waveFile.dispose();
        AL10.alSourcei(source, AL10.AL_BUFFER, buffer);
        AL10.alSourcei(source, AL10.AL_LOOPING, AL10.AL_TRUE);

        System.out.println("Playing sound unaffected by EFX ...");
        AL10.alSourcePlay(source);
View Full Code Here

Examples of org.lwjgl.util.WaveData

    if ((lastError = AL10.alGetError()) != AL10.AL_NO_ERROR) {
      exit(lastError);
    }

    //load wave data
    WaveData wavefile = WaveData.create(args[0]);

    //copy to buffers
    AL10.alBufferData(
      buffers.get(0),
      wavefile.format,
      wavefile.data,
      wavefile.samplerate);
    if ((lastError = AL10.alGetError()) != AL10.AL_NO_ERROR) {
      exit(lastError);
    }

    //unload file again
    wavefile.dispose();

    //set up source input
    AL10.alSourcei(sources.get(0), AL10.AL_BUFFER, buffers.get(0));
    if ((lastError = AL10.alGetError()) != AL10.AL_NO_ERROR) {
      exit(lastError);
View Full Code Here

Examples of org.lwjgl.util.WaveData

        if((lastError = AL10.alGetError()) != AL10.AL_NO_ERROR) {
            exit(lastError);
        }

      // load wave data from buffer
      WaveData wavefile = WaveData.create(getClass().getClassLoader().getResourceAsStream("Footsteps.wav"));

      //copy to buffers
      AL10.alBufferData(buffers.get(0), wavefile.format, wavefile.data, wavefile.samplerate);

      //unload file again
      wavefile.dispose();

        if((lastError = AL10.alGetError()) != AL10.AL_NO_ERROR) {
            exit(lastError);
        }
View Full Code Here

Examples of org.lwjgl.util.WaveData

            e.printStackTrace();
            Display.destroy();
            AL.destroy();
            System.exit(1);
        }
        WaveData data = WaveData.create(new BufferedInputStream(new FileInputStream("res" + File.separatorChar +
                "sounds" + File.separatorChar + "thump.wav")));
        int buffer = alGenBuffers();
        alBufferData(buffer, data.format, data.data, data.samplerate);
        data.dispose();
        int source = alGenSources();
        alSourcei(source, AL_BUFFER, buffer);
        while (!Display.isCloseRequested()) {
            while (Keyboard.next()) {
                if (Keyboard.isKeyDown(Keyboard.KEY_SPACE)) {
View Full Code Here

Examples of org.lwjgl.util.WaveData

                    if (JXAenvUtils._debug) {
                        System.err.println(" jlayer sound");
                    }
                }
                if ((soundState & bits._getMask(SND_INTERFACE_BIT) & SND_INTERFACE_OPENAL) != 0) {
                    WaveData waveFile = null;
                    Map<String, Serializable> map = null;
                    if (!_ALCache.containsKey(filename)) {
                        waveFile = WaveData.create(new BufferedInputStream(isInnerResourceModeEnabled() ? getClass().getResourceAsStream(filename) : new FileInputStream(file)));
                        map = new HashMap<String, Serializable>();
                        if (waveFile != null) {
                            map.put("data", new BufferIO(waveFile.data));
                            map.put("format", waveFile.format);
                            map.put("samplerate", waveFile.samplerate);
                            waveFile.dispose();
                            loaded = true;
                            _ALCache.put(filename, map);
                            if (JXAenvUtils._debug) {
                                System.err.println(" openAL sound");
                            }
View Full Code Here

Examples of org.lwjgl.util.WaveData

    public void onAdd() {
        Material material = loadMaterial(new File("textures/tex.jpg"));
        cube = box(material, 1, 1, 1);
        player = new Player(Vector3.zero());
        try {
            WaveData data = WaveData.create(new BufferedInputStream(new FileInputStream("sound/test.wav")));
            if (data == null) {
                throw new LWJGLException("data == null");
            }
            sound = new SoundPlayer(new AudioClip(data));
        } catch (LWJGLException | FileNotFoundException ex) {
View Full Code Here

Examples of org.lwjgl.util.WaveData

        }
    }

    public static AudioClip loadSound3D(InputStream source) {
        try {
            WaveData data = WaveData.create(new BufferedInputStream(source));
            AudioClip clip = new AudioClip(data);
            return clip;
        } catch (LWJGLException ex) {
            Logger.getLogger(Resources.class.getName()).log(Level.SEVERE, "Sound could not be loaded: ", ex);
            return null;
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.