LWJGL Forum

Please login or register.

Login with username, password and session length

Author Topic: Sound wont play  (Read 1312 times)

TheBoneJarmer

  • Regular nerd
  • **
  • Offline Offline
  • Posts: 70
Sound wont play
« on: December 06, 2014, 14:49:23 »

Hey guys

I know there are topics with the same kind of problems, but the solutions couldn't solve my problems. I've started with OpenAL today and my audio just won't play. Code compiles fine without errors, but I hear nothing. OpenAL however returns error 40962 which is AL_INVALID_ENUM.

Code: (Sound.java) [Select]
import util.*;

import jarmer.*;
import jarmer.core.*;
import jarmer.graphics.*;
import jarmer.input.*;
import jarmer.light.*;
import jarmer.math.*;

import java.io.*;
import java.nio.*;

import org.lwjgl.*;
import org.lwjgl.openal.*;
import org.lwjgl.openal.AL.*;
import org.lwjgl.openal.AL10.*;
import static org.lwjgl.openal.AL10.*;

public class Game {

private static IntBuffer buffer;
private static IntBuffer source;
private static FloatBuffer sourcePos;
private static FloatBuffer sourceVel;
private static FloatBuffer listenerPos;
private static FloatBuffer listenerVel;
private static FloatBuffer listenerOri;

public void run() {

//Initialize display
Window.create(640,480,false);

Sound snd = new Sound("spawn.wav");
snd.play();

System.out.println(alGetError());
//System.out.println(AL_INVALID_ENUM);

//Main loop
while (!Window.isClosed()) {
update();
render();
Window.update();
}

//Clean up

Window.destroy();
}

//Events
public void update() {

//Quit game with the ESC key
if (Keyboard.isKeyDown(Keys.escape)) {
Window.close();
}
}
public void render() {

}
}

The sound I'd like to play is attached.
Logged

quew8

  • Nerdus Imperius
  • *****
  • Offline Offline
  • Posts: 562
  • Because Square Eyes Look More Real
Re: Sound wont play
« Reply #1 on: December 07, 2014, 12:41:11 »

You haven't shown us any of the OpenAL code in "Sound." There is no way we can diagnose this error. Also make sure you track down the exact function call which is causing the AL_INVALID_ENUM error.
Logged