OpenAL crashing on Mac

Hi

I’ve encountered a problem with using OpenAL. When I run my program, it shows a black screen for a second then outputs the following error file. I’m using LWJGL 2.9.3 on Mac OS X Yosemite. My OpenAL code looks like this.


public static void playAudio() {
		WaveData data;
		try {
			data = WaveData.create(new BufferedInputStream(
					new FileInputStream("forrest.wav")));

			int buffer = alGenBuffers();
			alBufferData(buffer, data.format, data.data, data.samplerate);
			data.dispose();
			int source = alGenSources();
			alSourcei(source, AL_BUFFER, buffer);
			alSourcePlay(source);
			alDeleteBuffers(buffer);
		} catch (FileNotFoundException e) {
			e.printStackTrace();
		}
	}

Can anyone shed some light on this problem?

Thanks, DarkCart

You delete it as its playing?

Also, you can encounter this when you use a faulty file. Get a new sound file.

Already tried removing the lines that delete it, nothing happens. The audio file is fine. I already tried a different file, still didn’t work

I don’t see where you are creating a context. You have to create a context before you can use it’s functions.


AL.create();

and finally you also have to destroy the context.

Do you suspend the thread like this?

while(!Display.isCloseRequested()) {
Display.sync(60);
Display.update();
}

Or LWJGL3 way?

Well now I feel f**king stupid. Thanks.