Sound wont play

Started by TheBoneJarmer, December 06, 2014, 14:49:23

Previous topic - Next topic

TheBoneJarmer

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
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.

quew8

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.